I have an Ubuntu 20.04.6 LTS server.
- It suddenly started refusing ssh connections citing
/bin/bash: No such file or directory. - Reboot the machine fails with a kernel panic, with the following excerpts:
Begin: Running /scripts/init-bottom ... mkdir: can't create directory '/root/lib/modules': Read-only file system
[...]
run-init: can't execute '/sbin/init', No such file or directory
[...]
run-init, can't execute '/etc/init': Permission denied
[...]
Kernel panic not syncing: Attempted to kill Init! exitcode-Ox00000100`
- Booting from a live USB, and looking inside the root disk.
/sbin/initis not missing but it is a softlink and the/lib/systemd/systemdit points to is missing. This leads me to find out that/libis a directory containing only ax86_64-linux-gnufolder, while in other machines,/libis usually a softlink tousr/lib - After backing up
/liband replacing it with a softlink tousr/lib, I am now able to reboot and ssh into the machine! - However, when trying to run
sudo apt updateandsudo apt upgradeto make sure my packages are in order, I am now faced with these errors that make apt fail:
/usr/bin/python3: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.35' not found (required by /usr/bin/python3)
/usr/bin/python3: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /usr/bin/python3)
/usr/bin/python3: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /usr/bin/python3)
/usr/bin/python3: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /usr/bin/python3)
How may I recover the system in this situation, short of re-installing Ubuntu? Also, what may have caused this situation?
Edit 1:
Here is the content of the x86_64-linux-gnu I found at /lib originally. I don't think it contains as many files as it's supposed to
$ ls [...]/lib/x86_64-linux-gnu/
libexpat.so.1 libexpat.so.1.8.7 libhistory.so.8 libhistory.so.8.1 libreadline.so.8 libreadline.so.8.1
$ diff [...]/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu | grep -v "Only in /lib/x86_64-linux-gnu"
Binary files [...]/lib/x86_64-linux-gnu/libexpat.so.1 and /lib/x86_64-linux-gnu/libexpat.so.1 differ
Only in [...]/lib/x86_64-linux-gnu: libexpat.so.1.8.7
Binary files [...]/lib/x86_64-linux-gnu/libhistory.so.8 and /lib/x86_64-linux-gnu/libhistory.so.8 differ
Only in [...]/lib/x86_64-linux-gnu: libhistory.so.8.1
Binary files [...]/lib/x86_64-linux-gnu/libreadline.so.8 and /lib/x86_64-linux-gnu/libreadline.so.8 differ
Only in [...]/lib/x86_64-linux-gnu: libreadline.so.8.1
Also, these warnings also show up just when I SSH in:
/usr/bin/xauth: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /usr/bin/xauth)
/usr/bin/xauth: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /usr/bin/xauth)
/usr/bin/xauth: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libX11.so.6)
/usr/bin/xauth: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /lib/x86_64-linux-gnu/libX11.so.6)
/usr/bin/xauth: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libXau.so.6)
/usr/bin/xauth: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libbsd.so.0)
/usr/bin/xauth: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libmd.so.0)
x86_64-linux-gnuthat you backed up from/lib/x86_64-linux-gnuto/usr/lib/x86_64-linux-gnuassuming you have previously moved it from its original location and it's still intact ... You seem to have messed up your filesystem hierarchy quiet a bit. – Raffa Jul 20 '23 at 11:22x86_64-linux-gnuI backed up. I don't think it has everything it's supposed to, and the few packages still in it don't seem to relate to the warnings. – LemmeTestThat Jul 21 '23 at 02:19libc&libmto match what is now being required? All without being able to useapt? – LemmeTestThat Jul 21 '23 at 02:23/usr/bin/python3 -> python3.10and there is apython3.8available there. Maybe I could try redirecting/usr/bin/python3to 3.8? – LemmeTestThat Jul 21 '23 at 02:32/usr/bin/python3topython3.8should help – steeldriver Jul 21 '23 at 11:33python3.8did seem to get apt going further, but then It still crashed with an error from/lib/x86_64-linux-gnu/libsqlite3.so.0– LemmeTestThat Jul 24 '23 at 02:58