Cant login / use / chroot update system due to corrupt libraries

Hi all,

I somehow bricked my system. I guess it might stem from trying to update with no disk space remaining which apparently lets pacman create empty files. At least that is what I read somewhere in the past 2 hours.

When I started booting into linux recently, the computer told me that I would need to load the kernel first. Then it did nothing. I also tried using the failback kernel - still nothing. So I now chrooted into the system from a liveiso.

I first tried pacman -Syu which only threw errors at me. The main one seems to be

ldconfig: /usr/lib/ is not an ELF file - it has the wrong magic bytes at the start

but repeated several times (all lines at the bottom of the post). I guess there are around 15 error messages, though there are not 15 different libs affected. Several websites recommended just doing a system upgrade - that doesnt work though. Others have suggested removing the packages affecting the afforementioned libraries, but how do I do that? The libraries have rather ominous names and looking the first few up online didn’t help either.

What can I do to make my system do anything again? How can I find out which package uses / installed a certain library? Any help is greatly appreciated.

Manually written error message, please pardon any spelling in there:

ldconfig: /usr/lib/ is not an ELF file - it has the wrong magic bytes at the start.
and several more that I am to exhausted to type here. I tried getting the singles that repeat here with uniq, that didn't work at all. Sorry.

I should be running on linux 5.15.80-1 (LTS kernel), but uname -r returns 5.19.4-arch1-1, which is weird. That kernel isn’t even installed as per pacman -Qs.

Boot off the live ISO, download pacman-static from here:

Mount your partitions to prepare for an arch-chroot.

Before you start the chroot, copy pacman-static into the mount location then arch-chroot into your system.

Once inside the chroot try this command:

sudo pacman-static -Syu suitesparse
1 Like

The liveiso won’t let me arch-chroot /usr/bin/arch-chroot: Input/output error

Can you share the full series of commands you used for that from the point of booting of the live iso.

I did a regular chroot before that, not much else. Ill try rebooting the iso and see again, it has been up for a for minutes. It has been spewing that error around for a lot of commands though.

Did you mount all your partitions first?

Please share the full series of commands.

I rebooted and performed the following series just now (which magically worked, I don’t know anymore). I am fairly sure I did the same before. The drive had always been mounted, I know that much. /home is on another partition, but the problem appears to be in root, so I did not mount that.

lsblk -ft
sudo mount /dev/nvme.. /mnt 
arch-chroot /mnt

I am chrooted now, it can’t find the command. Should I temporarily extend $PATH or move to file to another folder, as in /usr/bin?

This requires sudo.

Did you download it and copy it in before chrooting as described above? If so, just use the full path to pacman-static when you run it.

I did sudo it, I do have do type these things by hand which makes me a bit clumsy.

I downloaded it from the browser and cp’d it into the then already mounted path, /mnt that is. It is now in / for the other system. I tried both sudo ./pacman-statc aswell as sudo /pacman-static just now, both returned command not found.

What does ls / from within the chroot show?

bin boot dev etc home lib lib64 lost+found mnt opt pacman-static proc root run sbin servers.json srv sys tmp usr var + 3 txts I made for debugging.

Is it executable? Try chmod a+x /pacman-static

It was not, it ran now.

Return after checking for file conflicts:

Error: failed to commit transaction (conflicting files)
[several files listed as suitesparse: /usr/bin/mongoose exists in filesystem]
errors occured, no packages were upgraded.

Ouch. I wonder if your database is corrupt. What does /pacman-static -Qo /usr/bin/mongoose return?

Error: No package owns /usr/bin/mongoose

And there are 101 more lines of errors.

Your system is in a mess it seems.

Your best bet is probably sudo /pacman-static -Syu suitesparse --overwrite "*"

The screen ran wild for a little, seemed kind of scary, but at least ldconfig doesn’t throw around any more of those lib errors. Should I dare reboot?

First try normal pacman and see if it works.

Worked and booted just fine! Thanks a bunch! Time to get some rest.

1 Like