Thursday, January 12, 2012

Get to know the libraries requried for an executable

1.  ldd
          ldd exe-binary
example:
[root@localhost home] ldd /bin/netstat
                                         linux-gate.so.1 =>  (0x00cfa000)
                                         libselinux.so.1 => /lib/libselinux.so.1 (0x0071c000)
                                         libc.so.6 => /lib/libc.so.6 (0x004f4000)
                                         libdl.so.2 => /lib/libdl.so.2 (0x00689000)
                                         /lib/ld-linux.so.2 (0x004cc000)

2 . readelf

[root@localhost static&shared]# readelf -a /bin/netstat | grep NEEDED
      0x00000001 (NEEDED)                     Shared library: [libselinux.so.1]
      0x00000001 (NEEDED)                     Shared library: [libc.so.6]









Wednesday, January 11, 2012

Reasons for root file system mount failure during Embedded Linux Start-up

Kernel panic: VFS: Unable to mount root fs on 02:00

We all have encountered this error while booting Linux. There might be many reasons for it, but most of the times the error is simple and yet goes undetected and causes problem before we detect it. Some of the obvious reasons are:

1. Driver for blockdev is not found in the kernel hence it can’t talk to the device
2. Driver for the corresponding file system is not present in the kernel hence it does not know how to interpret the data on the device
3. Root partition passed to the kernel is wrong
4. In case of nfs, it is not set up correctly. That is, the nfs mount point cannot be accessed from other Linux systems as well