ramdisk: shared executables hang

From: Hans Unterberger (unterbergerhans_at_hotmail.com)
Date: 10/24/04

  • Next message: Peter T. Breuer: "Re: When I try to copy (or ftp) huge file, I am getting below error, any idea why?"
    Date: 24 Oct 2004 10:10:59 -0700
    
    

    I previously created a ramdisk with a libc5 and libclite-4, which
    works fine for a diskless boot over the network. I'm using the netboot
    package to create the net-bootable images (kernel + ramdisk).

    I created the working ramdisk in 1997 and used it at the time with 2.0
    kernels. It still works today with a 2.4 kernel. The strange thing
    however is that I can't create a functional ramdisk that works with
    libc6. I've created an image of a filesystem, mounted that loopback,
    populated the filesystem from a working redhat 9 installation. When I
    then use that filesystem image as a ramdisk the kernel boots, claims
    it (succesfully) mounted the root filesystem (the ramdisk) and then
    just hangs when otherwise init would be called.

    kernel parameters such as 'init=/...' allow alternative processes to
    be initted, but it seems as if anything that's a dynamically linked
    executable doesn't exec. If I use 'init=/linuxrc' the bootprocess
    hangs at the same place when exec'ing /linuxrc (which is a shell
    script). Even 'init=/bin/bash' hangs.

    What doesn't hang is any static executable used for 'init=...'. So
    one would tend to think there's something wrong with the dynamic
    load(er|ing). When the ramdisk is mounted loopback I can 'chroot
    /mnt/ramdisk /bin/bash' just fine. I can do an 'ldconfig -r
    /mnt/ramdisk' to create '(/mnt/ramdisk)/etc/ld.so.cache' and I've
    checked all library dependencies with ldd and nothing's missing, e.g.
    not found.

    The funny thing is that when '/sbin/init' is missing the boot process
    does actually complain about a missing init, but when '/sbin/init' is
    present it just hangs. No matter what value is passed for kernel boot
    parameter 'init=...', the booting just hangs, unless the value is a
    static executable.

    I've tried creating a static executable that forks, exec's 'ldconfig'
    from the child, then exec's '/sbin/init' from the parent which once
    again hangs.

    I'd like to do the 'normal' stuff one does in /linuxrc but since
    /linuxrc is normally a shell script and since bash is a dynamically
    linked executable I can't get that or any other dynamically linked
    executable to run.

    My previously and still working filesystem I created in 1997 also has
    dynamically linked executables but obviously in a different ELF format
    and linked against libc5. I'd like to migrate my boot-/ramdisks to a
    libc6 package but no matter how hard I try I keep banging my head
    against the loading of dynmically linked (libc6) executables. And I've
    created the libc6 ramdisk using executables/libraries from a redhat 9
    installation, obviously not from the 1997 libc5-based ramdisk image
    ;-)

    Here's some of the steps I've performed:

    configure the net-bootable kernel with options:
    - ELF executables
    - a.out executables
    - Ram disk (compiled in)
    - Initial ram disk (compiled in)
    - Initial ramdisk size 16384
    - Loopback (compiled in)
    - ext2 (compiled in)
    - xfs (compiled in)

    dd if=/dev/zero of=ramdisk.img count=8192 bs=1k
    mke2fs -m 0 -F -b 1024 ramdisk.img
    mount -t ext2 ramdisk.img /mnt/ramdisk -o loop

    cd /mnt/ramdisk
    ... populate filesystem ...
    .. /dev mem, kmem, zero, null, tty[0-9], console, initctl, initrd ...
    .. /lib libc-2.3.2.so ld-linux.so...
    .. /bin mount ls ...
    .. /sbin init ldconfig ...
    .. /etc inittab passwd group rc ...
    .. /var run log
    .. /linuxrc

    umount /mnt/ramdisk
    mknbi-linux -d initrd -a 'root=/dev/ram0 init=/linuxrc' -k vmlinuz -r
    ramdisk.img -o netbootable-kernel-ramdisk.img

    I'm at a loss as to why init hangs. Any suggestions are appreciated.

    Hans


  • Next message: Peter T. Breuer: "Re: When I try to copy (or ftp) huge file, I am getting below error, any idea why?"
  • Quantcast