Opened 11 years ago

Closed 11 years ago

#647 closed defect (fixed)

Issues with minimal.conf contents and bash in ramdisk image.

Reported by: Matthew Ross Owned by: Bruno Cornec
Priority: normal Milestone: 3.0.3
Component: mindi Version: 3.0.2
Severity: normal Keywords: mindi, bash, minimal.conf
Cc:

Description

I have run into a few issues with mindi's boot disk on RHEL/CentOS 6. On boot I was noticing the following:

  1. /etc/init.d/rcS: line 825: /sbin/start_udev: not found
  2. /bin/sh: can't access tty; job control turned off

From browsing existing bug reports it seems that both these issues should be addressed; #600 for start_udev and several for the job control. However, the issue is that bash is not available on the ramdisk.

I started with including bash in my deplist.txt. This resolved problem 2 for tty1 but not the rest (unless bash was manually started in those terminals).

The fact that bash was not being included in the ramdisk image is causing start_udev to fail execution since it now includes #!/bin/bash at the start of the script and the bash I included in all.tar.gz is not yet available this early in rcS.

I checked the minimal.conf only to see bash listed but it appears that mindi is selecting just a subset of the minimal.conf due to the following line (~2525) in TurnTgzIntoRdz:

mountlis=`grep -E "mount|fuse|ssh|libnss" $DEPLIST_FILE $DEPLIST_DIR/* | grep -v " *#.*" | cut -d: -f2 | sort -u`

Indeed /bin/bash does not exist in mindi.log under "Content of initial ramdisk:".

To briefly test with bash in the ramdisk I added /bin/bash as follows in TurnTgzIntoRdz:

mountlis=`grep -E "mount|fuse|ssh|libnss" $DEPLIST_FILE $DEPLIST_DIR/* | grep -v " *#.*" | cut -d: -f2 | sort -u`
rm -f $MINDI_TMP/minimal.lis
for f in $MINDI_LIB/rootfs/bin/busybox /bin/bash $mountlis; do
    echo $f >> $MINDI_TMP/minimal.lis
done
LocateDeps $MINDI_LIB/rootfs/bin/busybox /bin/bash $mountlis >> $MINDI_TMP/minimal.lis

Extracting the initrd.img I was able to verify bash existed in the ramdisk and that /bin/sh looked to be linked to it.

However on boot I received the following:

can't run '/etc/init.d/rcS': No such file or directory

Please press Enter to activate this console. <enter>

can't run '-/bin/sh': No such file or directory

Please press Enter to activate this console.

Looking again at the contents of the ramdisk it seemed that the symbolic link for /bin/sh might be causing the problem so I changed the following in mindi (line ~2545):

grep -q bin/bash $MINDI_TMP/minimal.lis
if [ $? -eq 0 ]; then
    ln -sf bin/bash bin/sh
    LogIt "INFO: Using bash as default shell"
fi
rm -f $MINDI_TMP/minimal.lis

To (note the ln call):

grep -q bin/bash $MINDI_TMP/minimal.lis
if [ $? -eq 0 ]; then
    ln -sf /bin/bash bin/sh
    LogIt "INFO: Using bash as default shell"
fi
rm -f $MINDI_TMP/minimal.lis

Voila, issues one and two disappeared.

Looking at changeset [3036] under the 3.0 branch it appears that these issues should still be present.

I have verified that most of the contents of minimal.conf are not being included in the ramdisk. Is there a reason for the subset selection in mindi? I was able to rebuild the ramdisk with all of minimal.conf and boot successfully, albeit with a few additional warnings.

Change History (1)

comment:1 by Bruno Cornec, 11 years ago

Resolution: fixed
Status: newclosed

Interesting related previsouly fixed bugs: #600 and #620 which will give hints on why we don't use all of minimal.conf

Thanks for finding this issue. It should now be solved in rev [3039].

Note: See TracTickets for help on using tickets.