Bind mount in initrd fails on centos-6 (dracut generated)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
 
I have a bind mount problem on centos-6 only (works fin on centos-7)
>From within the systemimager dracut generated centos-6 initrd:
mkdir -p /mnt/test
mount --bind /bin /mnt/test # This fails on centos-6 (and succeed on all recent linux distro including centos-7)
mount --bind /dev /mnt/test # succeed on centos-6 (and all linux distros)
 
Resultwhen failing is: errno=32
Mount: wronf fs type, bad option, bad superblock on /bin,
                Missing codepage or helper program, or other error
                In some cases useful info is found in syslog – try
                Dmesg | tail or so
 
Unfortunately, nothing in dmesg
 
If I cat /etc/mtab  I see that root filesystem is and ext2 fs mounted from /dev/ram0 (this device does not exists). (while it is a rootfs filesystem mounted on / from rootfs device on centos-7)
If I create the device (mknod /dev/ram0 b 1 0) on centos-6 it doesn’t help.
tune2fs -l /dev/ram0 says that this is not an ext2 fs
 
As I understand, mount --bind (from strace) follows any eventual symlink until it finds a directory, then it calls mount with the bind option.
The mount tries to find the device associated with this directory and fails to find a file filesystem there (missing device of fake device or compressed squashfs which is not and ext2 as the /etc/mtab lists.
 
My questions:
1/ Is it an expected behavior to fail to bind-mount from intrd filesystem?
2/ Is there a way to bind mount a directory from initrd in centos-6? (some kernel module to insert, some device node to create, some line to update in /etc/mtab ???
 
NOTE: This is required by my systemimager dracut module, a module that images a client from initqueue custom scripts. After imaging the client I need to run some post install scripts in /sysroot chrooted environment. Bind mounting initrd.img:/scripts was an elegant way to expose those scripts in the chrooted environment. (The dracut module source is available here: https://github.com/finley/SystemImager/tree/initrd-from-imageserver-and-dont-package-initrd/lib/dracut/modules.d/51systemimager)
 
Any elegant alternative I could use instead of doing a specific case for centos-6 where I would copy recursively the scripts to /sysroot/tmp/scripts then run them and remove the things afterwards?
 
Details here:
https://github.com/finley/SystemImager/blob/initrd-from-imageserver-and-dont-package-initrd/lib/dracut/modules.d/51systemimager/systemimager-lib.sh#L1392
 
Many thanks for any help or elegant alternative ways to expose /scripts directory in /sysroot chrooted environment
 
Cheers,
 
SystemImager project: https://github.com/finley/SystemImager/wiki
 
--
Olivier LAHAYE
CEA Saclay
 


-- 
Olivier LAHAYE
CID & ASSI - DRT Saclay
 





[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux