'mount: error while loading shared libraries: libudev.so.0 : no such file or directory' error while booting

I was trying to load a version of CGminer which was returning a libudev type error, and followed a supposed solution here but it destroyed my system (so it seems).

I loaded the system in recovery mode from GRUB but all that done was actually tell me what I something is broken, do not know what to do next.

I think I somehow associated a libudev.so.0 to 1 or 1 to 0, I am not sure what I did and how to fix it.


I see that some of the solutions posted on the other question overwrite libudev.so.0, because of the -f option supplied to ln. This is not due to malicious intent, but because these solutions were designed for newer versions of Ubuntu, in which the libudev1 package is used. The solution creates libudev.so.0 symbolic link. But in 12.04, libudev0 is used. So the libudev.so.0 library file is overwritten with a broken symbolic link to libudev.so.1 which doesn't exist. The solutions should not have included the -f option for ln in the command line, which overwrites files.

Enough of the explanation, here is a solution:

Basically the library file is replaced with a broken symbolic link. Start in recovery mode and select the root shell option. Then run this command: apt-get install libudev0. Once you are done, type exit and reboot. If you are using WiFi, download the libudev0 package and copy it into a USB drive. Then in the root shell in recovery, plug the USB drive and run: (tip: you can use Tab to autocomplete many things, including file paths )

sudo mount -o remount, rw / # (re)mount the filesystem in read-write mode.
mkdir /media/usb
mount /dev/sdb1 /media/usb
dpkg -i /media/usb/path_to_package_file

Then reboot and hopefully your system should work.