I removed a symbolic link, and Ubuntu became unusable

I removed the symbolic link for '/lib/x86_64-linux-gnu/ld-2.31.so' in the directory '/usr/lib64'. Suddenly most everything stopped working. I cannot even issue simple Linux commands like 'pwd', 'ls', 'sudo'. Since 'sudo' disappeared, I cannot even restore the symbolic link I removed.

I am DIW. Please help if you know what I should do to recover.

For the record, I am running Ubuntu Mate 20.04 LTS on a desktop machine.


Solution 1:

You removed a component of libc6, which is used by nearly everything. You should probably boot a live USB, mount your harddisk and fix the error using the live boot. Please note that I didn't test this.

Please use the official Ubuntu guide to boot a Live USB with Ubuntu.

Find out what your harddisk device name is: (I assume it's the old root partition - find the partion that matches the size)

lsblk

When the live system is running, mount your harddisk: (I assume your harddisk is /dev/sda2)

sudo mkdir -p /mnt/disk
sudo mount /dev/sda2 /mnt/disk

Create the missing symlink:

sudo ln -s /lib/x86_64-linux-gnu/ld-2.31.so /mnt/disk/usr/lib64/ld-linux-x86-64.so.2

Now shut down the system, remove the USB, and start Ubuntu as normal. Functionality should be restored.