Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Solved] Accidently uninstalled systemd and now it's unlinked from Grub

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
WaltzNightray
Posts: 9
Joined: 2023-08-29 14:56
LinkedIN: https://www.linkedin
Has thanked: 4 times

[Solved] Accidently uninstalled systemd and now it's unlinked from Grub

#1 Post by WaltzNightray »

Hey guys,

I messed up my installation of Debian 12 bookworm...

I was trying to install a dependency package for a legacy one and didn't see that this package tried to reinstall systemd and systemctl with another version, no less... In the middle of the reinstallation, everything went black, and upon reboot, I got to the text-mode screen with no Gnome, no Systemd or Systemctl, no apt, no network-manager...

Well, I was able to reinstall everything back by downloading the packages and installing them manually with dpkg, but now the system is not booting with Systemd as the boot init system anymore (System has not been booted with systemd as init system (PID 1) )

It seems systemd has been unlinked from Grub somehow, so no service gets up, no Gnome, no DE....

Anyone knows anyway I can get my system back? A fresh install is not an option as of now...

I thank anyone who might provide any help

[Edit]
Thanks to everyone who provided answers. You guys are awesome. I was able to solve the issue just going through with the "apt --fix-broken install" command and letting it remove the previous packages. It actually replaced it with a new one (and a new kernel too!). After that, I just used tasksel to reinstall Gnome, and everything was back to normal, no need for fresh install :)

This is resolved. Thanks everyone
Last edited by WaltzNightray on 2023-11-10 19:12, edited 1 time in total.

CwF
Global Moderator
Global Moderator
Posts: 2741
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 45 times
Been thanked: 206 times

Re: Accidently uninstalled systemd and now it's unlinked from Grub

#2 Post by CwF »

I got an idea, Start Over !

WaltzNightray
Posts: 9
Joined: 2023-08-29 14:56
LinkedIN: https://www.linkedin
Has thanked: 4 times

Re: Accidently uninstalled systemd and now it's unlinked from Grub

#3 Post by WaltzNightray »

Thanks CwF for your reply

Unfortunately I cannot do that for now, as I haven't done any backups (never expected for a package installation to do this)

Anyway, someone suggested this for me:

"boot the installer in rescue mode, chroot into the installation and fix the problem there. https://wiki.debian.org/DebianInstaller/Rescue

installing the package systemd-sysv should reinstate systemd as init system."

And this is the result:

I can actually get into a text mode login screen, like a server, just can't get into Gnome and systemd doesn't initiate. I actually think it's initializing with sysvinit because the command "service" works, like "service network-manager status" returns that this is running. But systemctl doesn't work.

I've logged into the rescue media anyway. From there i've tried to reinstall grub but that failed with code 1

So when trying to install systemd-sysv, this is the result

Code: Select all

"Reading package lists...
Building dependency tree...
Reading state information...
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
dbus : Depends: dbus-bin (= 1.14.10-1~deb12u1)
Depends: dbus-daemon (= 1.14.10-1~deb12u1)
Depends: dbus-system-bus-common (>= 1.14.10-1~deb12u1) but 1.14.8-2~deb12u1 is to be installed
Depends: libdbus-1-3 (= 1.14.10-1~deb12u1) but 1.14.8-2~deb12u1 is to be installed
libdbus-1-3:i386 : Depends: libsystemd0:i386
polkitd : Depends: default-logind or
logind
systemd-boot : Depends: systemd-boot-efi (= 252.17-1~deb12u1) but it is not going to be installed
Recommends: efibootmgr
systemd-sysv : Conflicts: sysvinit-core but 3.06-4 is to be installed
Recommends: libpam-systemd but it is not going to be installed
Recommends: libnss-systemd but it is not going to be installed
sysvinit-core : Conflicts: systemd-sysv
Conflicts: systemd-sysv:i386
And trying to run apt --fix-broken install returns this

Code: Select all

Reading package lists...
Building dependency tree...
Reading state information...
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
apache2-bin apg appstream apt-config-icons apt-config-icons-hidpi
bluez-obexd bogofilter bogofilter-bdb bogofilter-common bolt colord-data
dbus-system-bus-common distro-info-data dnsmasq-base evolution-common
exfatprogs fwupd fwupd-amd64-signed gdebi-core gdisk
gir1.2-accountsservice-1.0 gir1.2-evince-3.0 gir1.2-gck-1 gir1.2-gcr-3
gir1.2-gdm-1.0 gir1.2-gnomebluetooth-3.0 gir1.2-gnomedesktop-3.0
gir1.2-goa-1.0 gir1.2-grilo-0.3 gir1.2-gtksource-4 gir1.2-handy-1
gir1.2-javascriptcoregtk-4.0 gir1.2-javascriptcoregtk-4.1 gir1.2-json-1.0
gir1.2-malcontent-0 gir1.2-mediaart-2.0 gir1.2-mutter-11 gir1.2-nm-1.0
gir1.2-nma-1.0 gir1.2-packagekitglib-1.0 gir1.2-polkit-1.0 gir1.2-rsvg-2.0
gir1.2-soup-2.4 gir1.2-soup-3.0 gir1.2-tracker-3.0 gir1.2-upowerglib-1.0
gir1.2-vte-2.91 gir1.2-webkit2-4.0 gir1.2-webkit2-4.1
gnome-bluetooth-3-common gnome-control-center-data gnome-session-common
gnome-settings-daemon-common gnome-shell-common gnome-software-common
gstreamer1.0-pipewire gvfs-common gvfs-libs jq libabsl20220623:i386
libaccountsservice0 libaom3:i386 libappstream4 libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap libavahi-common-data:i386
libavahi-common3:i386 libavahi-core7 libavif15:i386 libblkid1:i386
libblockdev-crypto2 libblockdev-fs2 libblockdev-loop2 libblockdev-part-err2
libblockdev-part2 libblockdev-swap2 libblockdev-utils2 libblockdev2
libbrotli1:i386 libbz2-1.0:i386 libcairo2:i386 libcap2:i386 libcdio-cdda2
libcdio-paranoia2 libcmark0.30.2 libcolord-gtk4-1 libcolorhug2
libcom-err2:i386 libcurl3-gnutls:i386 libcurl4:i386 libdav1d6:i386
libdb5.3:i386 libde265-0:i386 libdee-1.0-4 libdeflate0:i386 libduktape207
libept1.6.0 libevolution libexif12:i386 libflashrom1 libflatpak0
libfontconfig1:i386 libfreetype6:i386 libftdi1-2 libfwupd2 libgail-3-0
libgav1-1:i386 libgcab-1.0-0 libgcrypt20:i386 libgd3:i386
libgdbm-compat4:i386 libgdbm6:i386 libgdm1 libglib2.0-0:i386 libgmp10:i386
libgnome-autoar-0-0 libgnome-autoar-gtk-0-0 libgnome-bluetooth-3.0-13
libgnome-bluetooth-ui-3.0-13 libgnome-rr-4-2 libgnutls30:i386
libgpg-error0:i386 libgphoto2-6:i386 libgphoto2-port12:i386 libgsl27
libgslcblas0 libgssapi-krb5-2:i386 libgtksourceview-4-0
libgtksourceview-4-common libheif1:i386 libhogweed6:i386 libieee1284-3:i386
libimobiledevice6 libjaylink0 libjbig0:i386 libjcat1 libjim0.81
libjpeg62-turbo:i386 libjq1 libk5crypto3:i386 libkeyutils1:i386
libkrb5-3:i386 libkrb5support0:i386 liblcms2-2:i386 libldap-2.5-0:i386
liblerc4:i386 libltdl7:i386 liblz4-1:i386 libmalcontent-0-0
libmalcontent-ui-1-1 libmbim-glib4 libmbim-proxy libmbim-utils
libmount1:i386 libndp0 libnettle8:i386 libnghttp2-14:i386 libnma-common
libnma-gtk4-0 libnma0 libnsl2:i386 libnspr4:i386 libnss3:i386 libnuma1:i386
libonig5 libopenjp2-7:i386 libostree-1-1 libp11-kit0:i386
libparted-fs-resize0 libpci3:i386 libpcre2-8-0:i386 libperl5.36:i386
libpixman-1-0:i386 libplist3 libplymouth5 libpng16-16:i386
libpolkit-agent-1-0 libpoppler-glib8:i386 libpoppler126:i386
libportal-gtk4-1 libpsl5:i386 libpst4 libpulse-mainloop-glib0 libqmi-glib5
libqmi-proxy libqmi-utils libqrtr-glib0 librav1e0:i386 librtmp1:i386
libsasl2-2:i386 libsasl2-modules:i386 libsasl2-modules-db:i386
libselinux1:i386 libsmbios-c2 libsnapd-glib-2-1 libsnmp40:i386
libsoup-gnome2.4-1 libsqlite3-0:i386 libssh2-1:i386 libssl3:i386
libtasn1-6:i386 libteamdctl0 libtiff6:i386 libtirpc3:i386 libudev1:i386
libunity-protocol-private0 libunity-scopes-json-def-desktop libunity9
libusb-1.0-0:i386 libusbmuxd6 libvolume-key1 libwebkit2gtk-4.0-37
libwebp7:i386 libwrap0:i386 libx265-199:i386 libxapian30 libxcb-render0:i386
libxmlb2 libxpm4:i386 libxrender1:i386 libytnef0 libyuv0:i386
mobile-broadband-provider-info nautilus-data orphan-sysvinit-scripts
pipewire-alsa pipewire-audio power-profiles-daemon python-apt-common
python3-apt python3-blinker python3-dateutil python3-debian
python3-distro-info python3-gi-cairo python3-httplib2 python3-jwt
python3-lazr.restfulclient python3-lazr.uri python3-oauthlib
python3-pyparsing python3-software-properties python3-wadllib realmd
switcheroo-control usb-modeswitch usb-modeswitch-data usbmuxd
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
systemd-sysv
Recommended packages:
libpam-systemd libnss-systemd
The following packages will be REMOVED:
accountsservice avahi-daemon bluetooth bluez dbus evolution
evolution-plugin-bogofilter evolution-plugin-pstimport evolution-plugins
flatpak gnome-bluetooth-sendto gnome-session-bin gnome-sushi
gnome-user-share gvfs gvfs-backends gvfs-daemons ipp-usb
libapache2-mod-dnssd libavahi-client3:i386 libdbus-1-3:i386 libsane:i386
libsane1:i386 nautilus network-manager polkitd sane-airscan:i386
systemd-boot systemd-container systemd-homed systemd-resolved
systemd-timesyncd systemd-userdbd sysvinit-core udisks2 upower
The following NEW packages will be installed:
systemd-sysv
0 upgraded, 1 newly installed, 36 to remove and 0 not upgraded.
10 not fully installed or removed.
Need to get 41,6 kB of archives.
After this operation, 63,6 MB disk space will be freed.
Do you want to continue? [Y/n]

User avatar
artytux
Posts: 77
Joined: 2022-10-20 09:00
Has thanked: 18 times
Been thanked: 14 times

Re: Accidently uninstalled systemd and now it's unlinked from Grub

#4 Post by artytux »

Can you not backup your data files now after all the rest of it is just the fresh install nothing precious in there . ? . ? .

jmgibson1981
Posts: 308
Joined: 2015-06-07 14:38
Has thanked: 11 times
Been thanked: 36 times

Re: Accidently uninstalled systemd and now it's unlinked from Grub

#5 Post by jmgibson1981 »

The help I can provide is you trying to install packages outside of the repositories therefore you are kind of on your own. Debian can't control or fix what you broke without know what you mean by "Legacy". If this package demanded different a different version of Systemd then you have just learned something that is very bad to do, albeit the hard way. This honestly sounds like a rogue repository somewhere that is so far out of date it's ridiculous.

Make your backups from the live boot of your data and reinstall.

WaltzNightray
Posts: 9
Joined: 2023-08-29 14:56
LinkedIN: https://www.linkedin
Has thanked: 4 times

Re: Accidently uninstalled systemd and now it's unlinked from Grub

#6 Post by WaltzNightray »

Thanks for all the replies guys,

I understand yours points and I'm coming to the sad but inevitable conclusion that a fresh install is the only solution... I could backup data like photos and documents, but there's actually little of that kind of data. What I can't backup and restore are the applications and configurations, where countless hours were spent, from so many sources I don't even remember

The legacy packages I refer to could be either libpm0g, libsystemd-shared or systemd-resolved, all downloaded from packages.debian.com. I don't remember exactly which because I installed them all on a rapid succession. I remember that systemd-resolved from apt required systemd to be version 252.12.17-1 but mine was 252.12.12-1 and running apt upgrade didn't update my systemd version and I couldn't understand the reason for this difference, so I started to install the dependencies required to update my systemd version manually to the newer one, and one of these dependencies caused all this...

Anyway, if there are any solutions by downloading and installing packages manually, I'm down for the task... But I understand if there's no real solution
Last edited by WaltzNightray on 2023-11-10 01:11, edited 1 time in total.

User avatar
artytux
Posts: 77
Joined: 2022-10-20 09:00
Has thanked: 18 times
Been thanked: 14 times

Re: Accidently uninstalled systemd and now it's unlinked from Grub

#7 Post by artytux »

WaltzNightray wrote: 2023-11-10 01:10 What I can't backup and restore are the applications and configurations, where countless hours were spent, from so many sources I don't even remember

OK you got a unusable install and need to re-install and restore the applications and configurations,
now yes now
take a TimeShift snapshot Inc the hidden config etc files and put that into an Ext_storage/HDD or usb big stick.

then reinstall the distro AND selectively copy/paste the config files for what you have customized,
the key words are *selectively* not just dump the whole lot in,
copy/paste is not the same as cut/paste.

With a fresh install please do updates first before anything,
after updates done do TimeShift for the system and BackInTime for your own data ::: set both up and run the programs both even thou you have yet no personal data in yet or anything customized.
and then
proceed with either adding your data or goto copy/paste/ the application list and configs from your TimeShift snapshot.

That is all I can think ATM, there is something else just not remembering, what did I forget anything ?.

User avatar
nooblinx
Posts: 36
Joined: 2023-02-03 20:43
Has thanked: 1 time
Been thanked: 1 time

Re: Accidently uninstalled systemd and now it's unlinked from Grub

#8 Post by nooblinx »

install a fresh one somewhere else and copy all of current system over there include all system folders

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1420
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 80 times
Been thanked: 191 times

Re: Accidently uninstalled systemd and now it's unlinked from Grub

#9 Post by steve_v »

* Making changes to low-level userland components (or anything your DE relies on) from the GUI is generally a bad idea.
* Manually installing .deb packages without checking their dependencies is generally a bad idea.
* Overruling apt to install specific versions without carefully examining proposed changes is a very bad idea. If those versions belong to a different release, what you're creating is a frankendebian.
* Running without any backups is... I have no words. Disk space in incredibly cheap these days, why do people still do this?

* If you want to know definitively whether systemd is running as PID1, go look what's running as PID1. You can also tell the kernel what to run as PID1 with the 'init=' command-line.
* You clearly still have something installed that is holding back package updates, and fixing the install will require you to find it and remove it. /var/log/dpkg.log and /var/log/apt/history.log may shed light, so too doing an 'aptitude why-not <package>' and/or generally seeing what aptitude's alternate resolver offers as solutions.

As already suggested, you're almost certainly better off backing up the system as it is now and reinstalling. Then you can pick through the wreckage to recover your configuration, or even virtualise or boot your old install from another disk to try fixing it, at your leisure.


artytux wrote: 2023-11-10 10:08TimeShift... TimeShift... BackInTime... TimeShift
Why complicate matters? Who's to say the OP even has that cruft installed? A simple dd, tar, rsync, or even just plain cp to another disk will do just fine here.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

WaltzNightray
Posts: 9
Joined: 2023-08-29 14:56
LinkedIN: https://www.linkedin
Has thanked: 4 times

Re: Accidently uninstalled systemd and now it's unlinked from Grub

#10 Post by WaltzNightray »

steve_v wrote: 2023-11-10 14:17 * Making changes to low-level userland components (or anything your DE relies on) from the GUI is generally a bad idea.
* Manually installing .deb packages without checking their dependencies is generally a bad idea.
* Overruling apt to install specific versions without carefully examining proposed changes is a very bad idea. If those versions belong to a different release, what you're creating is a frankendebian.
* Running without any backups is... I have no words. Disk space in incredibly cheap these days, why do people still do this?

* If you want to know definitively whether systemd is running as PID1, go look what's running as PID1. You can also tell the kernel what to run as PID1 with the 'init=' command-line.
* You clearly still have something installed that is holding back package updates, and fixing the install will require you to find it and remove it. /var/log/dpkg.log and /var/log/apt/history.log may shed light, so too doing an 'aptitude why-not <package>' and/or generally seeing what aptitude's alternate resolver offers as solutions.

As already suggested, you're almost certainly better off backing up the system as it is now and reinstalling. Then you can pick through the wreckage to recover your configuration, or even virtualise or boot your old install from another disk to try fixing it, at your leisure.


artytux wrote: 2023-11-10 10:08TimeShift... TimeShift... BackInTime... TimeShift
Why complicate matters? Who's to say the OP even has that cruft installed? A simple dd, tar, rsync, or even just plain cp to another disk will do just fine here.
Thanks for your reply steve,

Indeed, this was all done very carelessly and I understand that I've done this without knowledge and that now I'm asking for help to fix it when I'm responsible for it. I'm really trying to be respectful though, and it's obviously not anyone's job to do that; I just wanted to check if maybe it was something that was fixable and that someone might have the answer at the top of their heads, but seeing it now, it seems that it's a rather complex issue.

I agree with the safety precautions advised on the DontBreakDebian page, although, on the other hand, that's the big differentiator for Linux, that it's modular and you can shape it the way you like (obviously, that is for someone with knowledge on how to fix things when they go bad... but how would you gain that knowledge without trying things out? There are VMs of course... but anyway).

About the PID 1 process, the system reports that what's running on PID 1 is "???"... But I haven't tried to use the "init=" command, will try that.
I'll check the apt logs also to verify the information there, but it already seems that the issue lies in the conflicting of systemd (which is now the version on packages.debian.com, which is 252.12-17.1) and the rest of the dependencies left on the system, some of which may be for the earlier 252.12-12.1 version. I've already reinstalled all of the dependencies listed on the package page but that still didn't do the trick. I'll check if the "why-not" command shows anything different.

On one last note, if anyone has insights on what folders I could backup that might contain configuration and applications (from apt, snap, flathub, PPAs), that would be greatly appreciated.

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1420
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 80 times
Been thanked: 191 times

Re: Accidently uninstalled systemd and now it's unlinked from Grub

#11 Post by steve_v »

WaltzNightray wrote: 2023-11-10 17:19 I just wanted to check if maybe it was something that was fixable and that someone might have the answer at the top of their heads, but seeing it now, it seems that it's a rather complex issue.
Everything is fixable, it's just highly unlikely anyone will be able to talk you through it on a forum. One would need to know know exactly what was done and the current state of the system, i.e. have physical access to the machine.
Apt is powerful and flexible, and Debian packaging is very granular... Which means that once you start messing about, things can get complicated rather quickly.
WaltzNightray wrote: 2023-11-10 17:19how would you gain that knowledge without trying things out?
By having backups so you can recover if you break things, of course.
WaltzNightray wrote: 2023-11-10 17:19I'll check the apt logs also to verify the information there, but it already seems that the issue lies in the conflicting of systemd.
Again, from that apt output you posted it appears something you have installed (or requested to be installed) is requiring a specific version of dbus and/or sysvinit-core. You need to find out what that is and remove it.
Note that's only the first problem apt encountered, the rabbithole probably goes deeper.

I mentioned aptitude because it will often give you several possible ways to achive the action you ask of it, where apt will just pick the "best" dependency solution and bail out if that isn't possible. You might try asking aptitude to install the current version of dbus-system-bus-common or remove sysvinit-core, and see if it identifies any sane solutions.
WaltzNightray wrote: 2023-11-10 17:19On one last note, if anyone has insights on what folders I could backup that might contain configuration and applications (from apt, snap, flathub, PPAs), that would be greatly appreciated.
Everything. Disk is cheap, and that way you won't miss anything.

Dpkg / apt keeps installed package info in /var/lib/dpkg/status, or dump it with 'dpkg --get-selections'. As for snap: don't want / never used / don't know. Flatpak, ditto.
PPAs... Please read Don'tBreakDebian regarding PPAs and frankendebian, they're an Ubuntu thing and shouldn't be on your system to begin with. If you have a bunch of unofficial sources / PPAs configured, that just makes this even more complicated to sort out, and even more unlikely you'll find an answer (let alone a simple one) here.
Most configuration is in /etc, as always.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Post Reply