You are not logged in.

#1 2022-08-04 13:37:07

hyxud
Member
Registered: 2022-07-20
Posts: 10

[SOLVED] Accidentally Deleted /usr/lib

I deleted /usr/lib by accident, pacman failed everything failed, I tried to reboot I got an error, I booted from USB and attempted to fix it, after hours I managed to fix some of it, I can boot successfully but only on emergency mode

I tried to update package by running pacman -Syu but failed
It was a network error, after running nmcli I got an error

Error: Could not create NMClient object: Could not connect: No such file or directory

I tried reinstalling Network manager from bootable USB but still get the same error

I don't know what to do, I tried iwctl but kept getting "Waiting for IWD to start..." And I'm stuck here and I don't know what to do now and after I fix Network manager to fix the entire system.

And I really don't want to do a reinstall

Last edited by hyxud (2022-08-04 14:32:18)

Offline

#2 2022-08-04 13:38:18

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: [SOLVED] Accidentally Deleted /usr/lib

First thing I would do is boot the Arch ISO, mount everything, and use pacman's --sysroot option to reinstall all packages.

Offline

#3 2022-08-04 13:41:10

hyxud
Member
Registered: 2022-07-20
Posts: 10

Re: [SOLVED] Accidentally Deleted /usr/lib

Scimmia wrote:

First thing I would do is boot the Arch ISO, mount everything, and use pacman's --sysroot option to reinstall all packages.

I already did all that by mounting everything and running pacman --sysroot /mnt -S $(pacman --sysroot /mnt -Qnq) and pacman --sysroot /mnt -Syu

Offline

#4 2022-08-04 14:11:30

hyxud
Member
Registered: 2022-07-20
Posts: 10

Re: [SOLVED] Accidentally Deleted /usr/lib

UPDATE

I think I can't use Network Manager because of Emergency Mode, when booting I get an error of failing to mount /boot, I get "unknown file system type: vfat" I booted to USB and ran "lsmod | grep vfat" and it lists vfat and fat, I tried doing "modprobe vfat" and got this error:

mobprobe: FATAL: Module vfat not found in directory /lib/modules/5.18.7-arch1-1

How can I fix this?

Offline

#5 2022-08-04 14:14:52

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: [SOLVED] Accidentally Deleted /usr/lib

That means you didn't have /boot mounted when you reinstalled/updated everything. You need to go back, make sure to mount everything, then reinstall the kernel (either chrooting or with --sysroot).

Offline

#6 2022-08-04 14:31:38

hyxud
Member
Registered: 2022-07-20
Posts: 10

Re: [SOLVED] Accidentally Deleted /usr/lib

Scimmia wrote:

That means you didn't have /boot mounted when you reinstalled/updated everything. You need to go back, make sure to mount everything, then reinstall the kernel (either chrooting or with --sysroot).

Thank you, after installing Linux kernel it booted fine and everything works! I previously deleted it and only used linux-lts but it seems like I need to have them both

Offline

#7 2022-08-04 15:04:41

hyxud
Member
Registered: 2022-07-20
Posts: 10

Re: [SOLVED] Accidentally Deleted /usr/lib

For anyone facing same issue:

boot to USB
have network connection
mount your file system root and proc, sys and dev

mount /dev/sdaX /mnt/
mount -t proc proc /mnt/proc; mount --rbind /sys /mnt/sys; mount --rbind /dev /mnt/dev

then run

pacman --sysroot /mnt -Syu

after that reinstall all packages to install missing deps with

pacman --sysroot /mnt -S $(pacman --sysroot /mnt -Qnq)

if you get package already in filesystem errors add --overwrite flag
note: if you get PgP key errors while using pacman set SigLevel to TrustAll in /etc/pacman.conf (make sure to revert it back after repair for security reasons)

chroot in /mnt and check if pacman works, if it does you can reboot, once you reboot if you get booted to emergency mode try to find errors while booting that may cause any issues

in my case it was /boot failing to mount, i went back and booted to USB and reinstalled the linux kernel

this may not be the full solution since you'll have to find the issue yourself and fix it, try to dig in different sources to find a solution
if you're stuck always ask help here in arch linux forums people are always willing to help

Offline

Board footer

Powered by FluxBB