Control: tags -1 + patch Hi,
On Fri, Nov 06, 2015 at 01:27:58PM +0100, Salvatore Bonaccorso wrote: > Hi, > > On Wed, Apr 15, 2015 at 03:01:44PM +0100, fc3452-00 wrote: > > Package: initramfs-tools > > Version: 0.120 > > Severity: normal > > > > Dear Maintainer, > > > > Problem occurs when attempting to do an nfs network boot with no /usr > > directory > > present on the nfs root partition. > > > > At https://www.debian.org/releases/jessie/i386/apcs02.html.en it says that > > /etc, /bin, /sbin, /lib & /dev must be present on the root partition in > > order > > to boot. > > > > But in the script /usr/share/initramfs-tools/scripts/nfs there is: > > > > # loop until nfsmount succeeds > > nfs_mount_root_impl > > nfs_retry_count=0 > > while [ ${nfs_retry_count} -lt ${delay} ] \ > > && ! chroot "${rootmnt}" test -x "${init}" ; do > > [ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount" > > /bin/sleep 1 > > nfs_mount_root_impl > > nfs_retry_count=$(( ${nfs_retry_count} + 1 )) > > [ "$quiet" != "y" ] && log_end_msg > > done > > > > which attempts to execute /usr/bin/test immediately after mounting the root > > partition and before mounting any of the filesystems in /etc/fstab. This > > fails > > if your are trying to mount /usr from another filesystem by using an entry > > in > > /etc/fstab. The script could be modified to use the shell built-in "test" > > command by changing the line > > > > && ! chroot "${rootmnt}" test -x "${init}" ; do > > > > to > > > > && ! chroot "${rootmnt}" sh -c "[ -x \"${init}\" ]" ; do > > > > which enables the system to boot when /usr is not present. > > Untested: One other option might be to move the validate_init() > wrapper from init to scripts/functions and use that from there as well > in scripts/nfs. After thinking a bit more on it, maybe doing the file check to test if the rootfs mount was successful could be better replaced by a return value check. The init is validated aftwards. Attached is proposed patch for #782641 . Does it looks good to go ahead? Regards, Salvatore
From be2122fb1368697870ded2b2495c1265086e5ddd Mon Sep 17 00:00:00 2001 From: Salvatore Bonaccorso <car...@debian.org> Date: Fri, 6 Nov 2015 14:12:44 +0100 Subject: [PATCH] scripts/nfs: Check return value from nfs_mount_root_impl Check if mount of rootfs was successful. This avoids doing a file test within the mount. Closes: #782641 --- scripts/nfs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/nfs b/scripts/nfs index 1c29850..359bd46 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -90,12 +90,14 @@ nfs_mount_root() # loop until nfsmount succeeds nfs_mount_root_impl + ret=$? nfs_retry_count=0 while [ ${nfs_retry_count} -lt ${delay} ] \ - && ! chroot "${rootmnt}" test -x "${init}" ; do + && [ $ret -ne 0 ] ; do [ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount" /bin/sleep 1 nfs_mount_root_impl + ret=$? nfs_retry_count=$(( ${nfs_retry_count} + 1 )) [ "$quiet" != "y" ] && log_end_msg done -- 2.6.2
signature.asc
Description: PGP signature