You are not logged in.

#1 2024-06-10 22:28:14

baxbear
Member
Registered: 2022-05-06
Posts: 5

[SOLVED] Removed most system packages - how to restore

Dear Community,

I intended to remove unnecessary dependencies and removed instead every package on my system... (didn't notice that yay wasn't aware of the reinstalling - or whatever it confused here)

Someone was babbling in me ear all day and at some point I fucked up. I didn't read and just clicked ...

I intended to remove only unnecessary dependencies but removed basically all installed packages (including sudo, cd, pacman, ...).

I had a problem a while ago and reinstalled all explicit packages using

pacman -Qqen > pkglist_exp.txt
pacman --force -S $(< pkglist_exp.txt)

So, I have that list. I also have the console output of my failed attempt, where I started deleting everything:

https://pastebin.com/QaD7vqWV

If I can somehow extract those 500 packages into a pkglist (in case pkglist_exp.txt is missing some?) can I simply reinstall them using an usb-stick to boot archlinux and then

mount /dev/nvme0n1p3 /mnt
mount /dev/nvme0n1p1 /mnt/boot/efi

pacstrap -K /mnt base linux linux-firmware

I was using the latest lts kernel, not sure how to substitute this correctly here. Maybe you can suggest a case-specific substitution.

Afterwards probably:

arch-chroot /mnt
pacman --overwrite '*' -S pkglist_exp.txt

Are there some crucial parts I am missing. What else can go wrong, what do I have to consider in this particular case? Please have a look into https://pastebin.com/QaD7vqWV to tell me what potential failures I have to be aware of.

Thank you so much in advance for your support in this particularly stupid situation I caused.

@Edit:

Found this: https://wiki.archlinux.org/title/pacman with 3.6 Pacman crashes during an upgrade, would this be more fitting instead of arch-chroot - maybe even instead of pacstrap?

mount /dev/nvme0n1p3 /mnt
mount -t proc proc /mnt/proc  (typo in wiki?)
mount --rbind /sys /mnt/sys
mount --rbind /dev /mnt/dev
pacman --root=/mnt --cachedir=/mnt/var/cache/pacman/pkg --overwrite '*' -S /some/path/pkglist_exp.txt

What is getting me additionally nervous are those lines at the beginning and in between in

(1/4) Removing linux initcpios...
(2/4) Remove DKMS modules
==> dkms remove --no-depmod vboxhost/7.0.18_OSE -k 6.6.32-1-lts
==> dkms remove --no-depmod vboxhost/7.0.18_OSE -k 6.9.3-arch1-1
==> dkms remove --no-depmod v4l2loopback/0.13.2 -k 6.6.32-1-lts
==> dkms remove --no-depmod v4l2loopback-dc/2.1.3 -k 6.6.32-1-lts
==> dkms remove --no-depmod v4l2loopback/0.13.2 -k 6.9.3-arch1-1
==> dkms remove --no-depmod v4l2loopback-dc/2.1.3 -k 6.9.3-arch1-1
==> depmod 6.6.32-1-lts
==> depmod 6.9.3-arch1-1
(3/4) Unregistering Haskell modules...
(4/4) Removing old entries from the info directory file...
warning: /etc/texmf/web2c/fmtutil.cnf saved as /etc/texmf/web2c/fmtutil.cnf.pacsave
warning: /etc/sudoers saved as /etc/sudoers.pacsave
Privileges for realtime have been removed. However, the group 'realtime' will remain on the system.
Removed "/etc/systemd/user/sockets.target.wants/pipewire-pulse.socket".

The warnings are probably easy to solve by copying them back to the original file from the restored version, with realtime, I don't know which privileges it had. The pipewire-pulse thing can probably be restored with systemctl enable pipewire-pulse.socket after reinstalling it.

PS.: all my data is safe (missed saying that) but I am quite scared just trying something and hope that you may support me and give me important hints before I start "fixing" anything. I am not used to configure large parts of the system, e.g. it is more than a year ago that I switched to the lts kernel and for me, it was quite a hassle. I also set up multiple arch systems, but it is always pretty time-consuming, because in between there is often more than a year in which I do other stuff. So I am always relearning. For this reason, I ask for your experience first. It gets a lot more complicated after "trying" multiple things that did not work but changed a lot more about the system - further extending this threat and adding additional, unforeseen stumbling blocks.

Last edited by baxbear (2024-06-12 12:02:01)

Offline

#2 2024-06-12 05:25:22

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: [SOLVED] Removed most system packages - how to restore

I've read your whole thread and I'm not sure what's not working yet. You're basically doing what everybody would have suggested, using the installer ISO and a combination of pacstrap and arch-chroot or the pacman --root switch.

You've also understoody that pacsave files will need special care.

As for systemd services: The ones you activated manually as root should still exist as symlinks in the /etc/systemd/ tree.

Maybe the dkms packages may need an additional step, I can't tell from the output.

Offline

#3 2024-06-12 09:26:59

baxbear
Member
Registered: 2022-05-06
Posts: 5

Re: [SOLVED] Removed most system packages - how to restore

Awebb wrote:

I've read your whole thread, and I'm not sure what's not working yet.

Thank you for taking the time. Haven't tried anything yet, I am quite anxious about doing stupid stuff, e.g., because I missed something.

Awebb wrote:

You've also understoody that pacsave files will need special care.

Yeah, but what I don't know is whether there are files pacsave ignored/got deleted but are paramount to restore the system...

Awebb wrote:

As for systemd services: The ones you activated manually as root should still exist as symlinks in the /etc/systemd/ tree.

Didn't know about that one. Do I have to reactivate them or will they be active automatically again?

Awebb wrote:

Maybe the dkms packages may need an additional step, I can't tell from the output.

e.g. something like:

sudo dkms add vboxhost/7.0.18_OSE -k 6.6.32-1-lts
sudo dkms add v4l2loopback/0.13.2 -k 6.6.32-1-lts
sudo dkms add v4l2loopback-dc/2.1.3 -k 6.6.32-1-lts

sudo dkms install vboxhost/7.0.18_OSE -k 6.6.32-1-lts
sudo dkms install v4l2loopback/0.13.2 -k 6.6.32-1-lts
sudo dkms install v4l2loopback-dc/2.1.3 -k 6.6.32-1-lts

sudo mkinitcpio -P

Thanks so far, I think I start an attempt to recover the system now.

Offline

#4 2024-06-12 12:01:36

baxbear
Member
Registered: 2022-05-06
Posts: 5

Re: [SOLVED] Removed most system packages - how to restore

Thanks again, everything works fine - no remaining problems! I was maybe a little bit too scared ...

Offline

Board footer

Powered by FluxBB