LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   mkinitrd library load failure, '-s', 13.37 / current / RC3 (http://www.linuxquestions.org/questions/slackware-14/mkinitrd-library-load-failure-s-13-37-current-rc3-870641/)

lazardo 03-24-2011 12:48 AM

mkinitrd library load failure, '-s', 13.37 / current / RC3
 
mkinitrd seems to be failing to load some libraries OR I'm being stupid and can't see it.
Code:

bash-4.1# echo $x
virtio_blk:virtio_net:virtio_balloon:virtio:virtio_pci:virtio_ring:virtio-rng:virtio_console
bash-4.1# mkinitrd -k 2.6.37.4 -c -o initrd_2.6.37.4 -s initrd_2.6.37.4-tree -f ext4 -r /dev/sda1 -m ext4:$x
OK: /lib/modules/2.6.37.4/kernel/fs/jbd2/jbd2.ko added.
OK: /lib/modules/2.6.37.4/kernel/fs/mbcache.ko added.
OK: /lib/modules/2.6.37.4/kernel/fs/ext4/ext4.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/virtio/virtio_ring.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/virtio/virtio.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/block/virtio_blk.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/net/virtio_net.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/virtio/virtio_balloon.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/virtio/virtio_pci.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/char/hw_random/virtio-rng.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/char/virtio_console.ko added.
cp: with --parents, the destination must be a directory
Try `cp --help' for more information.
cp: with --parents, the destination must be a directory
Try `cp --help' for more information.
cp: with --parents, the destination must be a directory
Try `cp --help' for more information.
4016 blocks
/boot/initrd_2.6.37.4 created.
Be sure to run lilo again if you use it.

The mkinitrd section that seems to be the source:
Code:

  (
    cd $SOURCE_TREE
    for i in $(find -L . -type l -exec readlink -m /{} \; 2>/dev/null ) ; do
      cp -P --parents ${i} $SOURCE_TREE
    done
  )

The missing libraries are 'libnsl-2.13.so', 'libm-2.13.so' and 'libc-2.13.so'. Running the same command without '-s' works. mkinitrd-1.4.6-x86_64-7

Cheers,

GazL 03-24-2011 05:42 AM

Although the man page doesn't explicitly say so, it looks like the mkinitrd script relies on the -s argument being an absolute path.

Input validation is a little lacking in this script. It really ought to either canonicalize it with readlink or throw out an error and abort if a relative path is passed.

volkerdi 03-24-2011 03:03 PM

Quote:

Originally Posted by GazL (Post 4301510)
Although the man page doesn't explicitly say so, it looks like the mkinitrd script relies on the -s argument being an absolute path.

Input validation is a little lacking in this script. It really ought to either canonicalize it with readlink or throw out an error and abort if a relative path is passed.

Another thing gets canonicalized. ;)

Thanks, GazL!

lazardo 03-24-2011 03:04 PM

[PATCH] mkinitrd-1.4.6-x86_64-7 in 13.37 current RC3
 
Quote:

Originally Posted by GazL (Post 4301510)
Although the man page doesn't explicitly say so, it looks like the mkinitrd script relies on the -s argument being an absolute path.

Input validation is a little lacking in this script. It really ought to either canonicalize it with readlink or throw out an error and abort if a relative path is passed.

Thanks to GazL hint:

Code:

--- /sbin/mkinitrd        2011-03-21 16:04:57.000000000 -0700
+++ ./mkinitrd.patch        2011-03-24 12:37:58.863271061 -0700
@@ -327,6 +327,9 @@
      ;;
    -s)
      SOURCE_TREE="$2"
+      if [ ! "$(echo $SOURCE_TREE | cut -b1)" = "/" ]; then
+        SOURCE_TREE=$(pwd)/$SOURCE_TREE
+      fi
      shift 2
      ;;
    -u)

Eliminates need for '-s' argument absolute path in mkinitrd-1.4.6-x86_64-7.

After thought for side-effect readers: In the real virtual world, only the 'virtio_blk' module is required for 'mkinitrd' since [in this case] the root device uses it.

Code:

bash-4.1$ sudo ./mkinitrd.patch -k 2.6.37.4 -c -f ext4 -r /dev/sda1 \
> -m ext4:virtio_blk:virtio_net:virtio_balloon:virtio:virtio_pci:virtio_ring:virtio-rng:virtio_console \
> -o test4 -s test4-tree
OK: /lib/modules/2.6.37.4/kernel/fs/jbd2/jbd2.ko added.
OK: /lib/modules/2.6.37.4/kernel/fs/mbcache.ko added.
OK: /lib/modules/2.6.37.4/kernel/fs/ext4/ext4.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/virtio/virtio_ring.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/virtio/virtio.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/block/virtio_blk.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/net/virtio_net.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/virtio/virtio_balloon.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/virtio/virtio_pci.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/char/hw_random/virtio-rng.ko added.
OK: /lib/modules/2.6.37.4/kernel/drivers/char/virtio_console.ko added.
9205 blocks
/boot/test4 created.
Be sure to run lilo again if you use it.

# list is complete
bash-4.1$ find test4-tree -name \*.so
test4-tree/lib64/libnsl-2.13.so
test4-tree/lib64/libnss_compat-2.13.so
test4-tree/lib64/libnss_files-2.13.so
test4-tree/lib64/libm-2.13.so
test4-tree/lib64/ld-2.13.so
test4-tree/lib64/libc-2.13.so


GazL 03-24-2011 03:42 PM

Quote:

Originally Posted by volkerdi (Post 4302121)
Another thing gets canonicalized. ;)

Thanks, GazL!

:)
Just be careful not to hit the shift key when typing that first letter 'c'. Wouldn't want to see Slackware accidentally Ubuntized due to a typo!


All times are GMT -5. The time now is 05:01 PM.