Error while loading shared libraries: Invalid ELF header

March 7, 2014 12.2k views
All of a sudden without change any configuration, my server suddenly restart around 4AM SGT. When I access the droplet console I get this error message. Begin: Running /scripts/init-bottom ... done. /sbin/init: error while loading shared libraries: /lib/i386-linux-gnu/ invalid ELF header [ 2.295850] Kernel panic - not syncing: Attempted to kill init!
6 Answers
a complete stab in the dark, but are you booting a 32 bit kernel on a 64 bit userland? that won't work.
Its a 64bit kernel 512MB Ram 20GB SSD Disk San Francisco 1 LAMP on Ubuntu 12.04
boot using the rescue kernel
mount /dev/vda
and look at /lib/i386-linux-gnu/
Tried mount /dev/vda or /dev/sda for my case, but it has an error of can't read '/etc/fstab': No such file .. /etc only contains the following in the rescue kernel.

I also dont have the /lib/i386-linux-gnu/ directory but have this one instead /lib/x86_64-linux-gnu .. this directory contains
you have to mount /dev/sda somewhere, like

mkdir /mnt
mount /dev/sda /mnt

but it would be a good idea to fsck it first
fsck -yf /dev/sda
Using disk recovery I just copied all the data and transferred it to a new droplet.
by Justin Ellingwood
Linux includes a filesystem checking utility called fsck that can be used to recover your system in cases of corruption. In this guide, we will discuss how to attempt to recover your filesystem if there are filesystem issues by using the fsck kernel and a recovery ISO.
Have another answer? Share your knowledge.