As noted by @David in his comment ... Saving your important personal data usually in /home
and reinstalling is the recommended way ... Although, this would be my only advice if you were asking about an Ubuntu desktop system ... But, this might not be as simple as it sounds for servers ... /home
on a server might(mostly) be the least important part of the system to care about as servers are mostly used for websites, databases, and other jobs and user accounts are mostly merely used for managing those jobs rather than saving user personal data in their home directories.
Therefore, it might be worth it to try and fix a server.
Taking your word for it:
Some team in my company messed up with the /lib directory
And assuming only that ... It appears from the error messages that the whole /lib/
directory is either not present or it is severely damaged.
As a result, I booted up from a live usb-key to an ubuntu desktop
version to try and fix the issue and to avoid a clean install process.
What shall I do next to avoid reinstalling?
What you can do in your case is to mount your root partition from the installed OS on the original hard disk in the live system to e.g. /mnt/
with something like:
sudo mount /dev/sda3 /mnt
Where /dev/sda3
is the root partition on the server ... Find it with e.g. sudo fdisk -l
.
Or if your root partition contains logical volume/s, you can scan for them with e.g. sudo vgscan
then activate them with sudo vgchange -ay
then display them with sudo lvdisplay
and mount with e.g.:
sudo mount /dev/Logical-Volume-Name /mnt
After that copy the /lib
directory from the live system(Ubuntu server is preferred but Ubuntu desktop will work) preserving attributes to the root partition on the hard disk like so:
sudo cp -r --preserve /lib/ /mnt/
If needed, you can also install packages, upgrade the system or run other commands to fix the server system on the hard disk in a chroot
environment.
Then, reboot into your server.
This should bring your server back online as quickly as possible but you might need to troubleshoot and fix installed packages(especially manually installed ones) ... In most cases a reinstall of a certain non-working package should take care of fixing its missing libraries if any.