Re: linuxrc, initrd and shared libraries



On Fri, 25 Aug 2006 23:19:26 +0200, Jiri Skiskibowski wrote:

Hi,

I am trying to set up an inital ramdisk which contains a linuxrc script. A
test version of this linuxrc looks like this:

-------------------- linuxrc --------------------
#!/bin/sh
#
# $Id: linuxrc,v 1.11 2004/04/26 12:04:46 herbert Exp $

export PATH=/sbin:/bin
export LD_LIBRARY_PATH=/lib:/lib/tls
mount
-------------------------------------------------

The mount command ends up with this error:
./linuxrc: 3 mount: not found


The mount command needs these libraires:

ldd /bin/mount
libc.so.6 => /lib/tls/libc.so.6 (0xb7ea6000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0xb7fe0000)

My initrd contains these files:

vdr:~# ls -l /mnt/bin
total 361
-rwxr-xr-x 1 root root 86616 Jan 1 1970 awk
-rwxr-xr-x 1 root root 16504 Jan 1 1970 cat
-rwxr-xr-x 1 root root 83960 Jan 1 1970 dash
-rwxr-xr-x 1 root root 28588 Jan 1 1970 dd
-rwxr-xr-x 1 root root 75 Jan 1 1970 echo
-rwxr-xr-x 1 root root 19180 Jan 1 1970 mknod
-rwsr-xr-x 1 root root 76888 Jan 1 1970 mount
lrwxrwxrwx 1 root root 4 Jan 1 1970 sh -> dash
-rwsr-xr-x 1 root root 39960 Jan 1 1970 umount
-rwxr-xr-x 1 root root 13848 Jan 1 1970 uname

vdr:~# ls -l /mnt/etc/
total 2
-rw-r--r-- 1 root root 584 Jan 1 1970 ld.so.cache
drwxr-xr-x 1 root root 44 Jan 1 1970 modprobe.d
-rw-r--r-- 1 root root 0 Jan 1 1970 mtab

vdr:~# ls -l /mnt/lib/
total 229
-rwxr-xr-x 1 root root 90248 Jan 1 1970 ld-linux.so.2
-rw-r--r-- 1 root root 23504 Jan 1 1970 libblkid.so.1
-rw-r--r-- 1 root root 5900 Jan 1 1970 libcom_err.so.2
-rw-r--r-- 1 root root 16720 Jan 1 1970 libe2p.so.2
-rw-r--r-- 1 root root 86564 Jan 1 1970 libext2fs.so.2
-rw-r--r-- 1 root root 9128 Jan 1 1970 libuuid.so.1
drwxr-xr-x 1 root root 24 Jan 1 1970 modules
drwxr-xr-x 1 root root 48 Jan 1 1970 tls

vdr:~# ls -l /mnt/lib/tls
total 1357
-rwxr-xr-x 1 root root 1254468 Jan 1 1970 libc.so.6
-rw-r--r-- 1 root root 134496 Jan 1 1970 libm.so.6


All this is done with Debian 3.1 and Kernel 2.6.17.8

What is wrong with my initrd?

Thanks,
Jiri

The initrd must be complete enough to act as a root filesystem. Any
commands which will be issued, need to be available and have no broken
library links. One simple way to test an initrd is to chroot to it. If
there are no errors and you can issue commands, then you can try booting
using it. But if that fails, you will need to fix broken links,
probably by adding libraries. Another quick way of building a more
complete initrd is by compiling and using busybox.

This example corrects one common mistake, bad library dependancies.

Assume you have an initrd mounted on loopback at /mnt/initrd-test

# ldconfig -r /mnt/initrd-test
# cd /mnt/initrd-test
# chroot .
:
:
:
# exit

--
Douglas Mayne
.



Relevant Pages

  • linuxrc, initrd and shared libraries
    ... I am trying to set up an inital ramdisk which contains a linuxrc script. ... The mount command ends up with this error: ... My initrd contains these files: ...
    (comp.os.linux.setup)
  • Re: read/only root filesystem strategy
    ... Turned out my root file system was ... Doing a mount directly ... If we changed the mount command to automatically ... Only that user is allowed to umount ...
    (comp.os.linux.development.system)
  • Initrd trouble
    ... Freeing initrd memory: 2213k freed ... mount: wrong fs type, bad option, badsuperblock on tmpfs, ... special device /dev2/root2 does not exist ... initrd image), and using local loop device to mount the image: ...
    (Debian-User)
  • Re: Beige PowerMac G3/266 trouble
    ... that you still have to mount /dev/ram as root fs to make use of the ... initrd is mounted read-write as root ... you have to boot the kernel and load initrd. ... fs mounted under some other mount point, ...
    (comp.os.linux.powerpc)
  • Re: [opensuse] LILO/Grub Problem
    ... Linux kernel must be loaded before initrd. ... Should be as easy as, in a console as root, mount /dev/hdb1 /mnt, then ... partition to /data1 to get to it. ...
    (SuSE)