Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 252977 - sys-apps/baselayout-1.12.11.1: NFS bug in /etc/init.d/checkroot
Summary: sys-apps/baselayout-1.12.11.1: NFS bug in /etc/init.d/checkroot
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-29 11:38 UTC by thomas
Modified: 2016-08-28 15:25 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to make checkroot work with NFS root (untested with other rootfs) (checkroot.patch,465 bytes, patch)
2009-01-12 02:09 UTC, Douglas Paul
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description thomas 2008-12-29 11:38:18 UTC
After updating sys-apps/util-linux, 2.13.1.1 -> 2.14.1, my diskless client (PXE) did not boot anymore, because checkroot did not remount hte NFS root rw during boot.

Reason is, mount -f now behaves differently for NFS mounts.

This code in checkroot has a general problem with NFS roots (diskless clients):

     # Should we mount root rw ?  the touch check is to see if the / is
        # already mounted rw in which case there's nothing for us to do
        if mount -vf -o remount / 2> /dev/null | \
           awk '{ if ($6 ~ /rw/) exit 0; else exit 1; }' && \
           ! touch -c / >& /dev/null
        then
                ebegin "Remounting root filesystem read/write"
                mount -n -o remount,rw / &> /dev/null 


"mount -vf -o remount" writes for local mounts something like this:
/dev/hda7 on /extra type xfs (rw)

So, the "if" condition in checkroot works.

But for NFS mounts, mount writes NOTHING in the older util-linux, so the if condition is always true. On the other hand, mount from the newer util-linux writes something like this:
mount.nfs: timeout set for Sun Dec 28 23:24:35 2008
mount.nfs: text-based options: 'nfsvers=3,tcp,intr,nolock,rsize=8192,wsize=8192,addr=192.168.0.7'

There is no "rw" in $6 and so the if condition is always false and hence no remount attempt in my case.

So, the if condition is and was always wrong for NFS roots. With older util-linux, it always tried to remount, even if it should not and with newer util-linux, it never tries to remount.

For the first case, there is already a bug report: #186542

For my case, even moving netmount to the boot runlevel (as suggested by the Gentoo diskless client howto) did not solve my problem. Maybe it still is being executed too late.

As a workaround, I removed the offending "if" in checkroot.

Reproducible: Always

Steps to Reproduce:
1. set up diskless NFS client
2. checkroot in the boot runlevel
3. NFS root rw in /etc/fstab

Actual Results:  
System stops booting, because NFS root stays read-only.

Expected Results:  
checkroot should remount NFS root rw.

This is the filesystem in /etc/exports:
/pxe/frontend 192.168.0.5(rw,sync,no_root_squash)

This is /etc/fstab on the client:
192.168.0.7:/pxe/frontend / nfs nfsvers=3,tcp,intr,rw,nolock,rsize=8192,wsize=8192 0 0

These are the boot options in pxelinux.cfg:
append initrd=initramfs-genkernel-x86-2.6.25-gentoo-r8 ip=dhcp real_root=/dev/nfs nfsroot=192.168.0.7:/pxe/frontend vga=791 splash=silent,theme:livecd-2007.0 console=tty1 quiet
Comment 1 Panagiotis Christopoulos (RETIRED) gentoo-dev 2008-12-31 12:24:18 UTC
Hm, this seems real bug.
Comment 2 Douglas Paul 2009-01-12 02:08:53 UTC
I also ran into this problem with my servers that run with NFS root.

It seems to be that when you run mount -vf, it will run mount.nfs which provides different output than the normal mount command.

I was able to work around this by changing the mount -vf to mount -vfi. The 'i' option tells it not to run the /sbin/mount.<fstype> helper. (See attached patch)

I haven't tested this change with any root filesystem type other than NFS, but it should work.
Comment 3 Douglas Paul 2009-01-12 02:09:54 UTC
Created attachment 178143 [details, diff]
Patch to make checkroot work with NFS root (untested with other rootfs)
Comment 4 Jan Písačka 2009-05-21 11:37:24 UTC
> After updating sys-apps/util-linux, 2.13.1.1 -> 2.14.1, my diskless client
> (PXE) did not boot anymore, because checkroot did not remount hte NFS root rw
> during boot.

It seems that the util-linux update need not be the only reason. I was using  sys-apps/util-linux-2.14.2 and checkroot happily remounted the nfsroot rw.

Something changed in nfs-utils after the 1.1.0-r1 version, which is the last that works for me (in combination with sys-apps/baselayout-1.12.11.1 and sys-apps/util-linux-2.14.2). After updating to any newer version, I see the same symptoms. Nevertheless, the suggested workaround does not work for me:

# mount -n -o remount,rw /
# mount.nfs: an incorrect mount option was specified 
(with nfs-utils-1.1.4-r1)

I actually still have to run diskless pcs with that revision, which has already been removed from the portage tree. I hope GLSA 200903-06 doesn't affect me as I do not use netgroups. 

Reproducible: Always
Steps to reproduce:

1. Setup diskless workstation from current amd64 packages, but with nfs-utils-1.1.0-r1

2. The workstation boots correctly

3. Update nfs-utils-1.1.0-r1 --> nfs-utils-1.1.4-r1

4. The workstation has ro root

5. Downgrade to nfs-utils-1.1.0-r1

6. The workstation boots correctly

# emerge --info
Portage 2.1.6.11 (default/linux/amd64/2008.0/desktop, gcc-4.3.2, glibc-2.8_p20080602-r1, 2.6.28-gentoo-r5 x86_64)
=================================================================
System uname: Linux-2.6.28-gentoo-r5-x86_64-Intel-R-_Core-TM-2_Duo_CPU_E6550_@_2.33GHz-with-glibc2.2.5
Timestamp of tree: Thu, 21 May 2009 07:15:01 +0000
app-shells/bash:     3.2_p39
dev-java/java-config: 2.1.7
dev-lang/python:     2.5.4-r2
dev-python/pycrypto: 2.0.1-r8
dev-util/cmake:      2.6.2-r1
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=nocona -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="ftp://ftp.linux.cz/pub/linux/gentoo"
LANG="cs_CZ.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="en_GB cs en de es fr hu pt pt_PT sk"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 acl acpi alsa amd64 berkdb branding bzip2 cairo cdr cli cracklib crypt cups dbus dri dvd dvdr dvdread eds emboss encode esd evo fam ffmpeg firefox fortran gdbm gif gnome gpm gstreamer gtk hal iconv isdnlog java jpeg ldap libnotify mad midi mikmod mmx mp3 mpeg mudflap multilib ncurses nls nptl nptlonly ogg opengl openmp pam pcre pdf perl png ppds pppd python qt3 qt3support qt4 quicktime readline reflection sdl session spell spl sse sse2 ssl startup-notification svg sysfs tcpd tiff truetype unicode usb vorbis x264 xattr xinerama xml xorg xulrunner xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CAMERAS="ptp2" ELIBC="glibc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_GB cs en de es fr hu pt pt_PT sk" USERLAND="GNU" VIDEO_CARDS="intel"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 5 Doug Paul 2009-05-21 14:58:57 UTC
I had the same problem with a recent upgrade, but only on my amd64 systems, not on x86. I assumed it was related to a kernel upgrade (to 2.6.28-gentoo-r5 as it happens) but I haven't checked into it yet in detail.

I usually pass options to nfsroot to mount via tcp, but these weren't taking affect after the upgrade, so mount was choking on the options in fstab. I had to strip out the options I put in dealing with tcp and then it worked.

In any case, I think this is a separate issue as you are getting as far as the remount r/w part.
Comment 6 Doug Paul 2009-05-21 15:05:25 UTC
Actually seems like the issue I described was due to this bug: 262915

http://bugs.gentoo.org/show_bug.cgi?id=262915
Comment 7 Jan Písačka 2009-05-26 13:51:56 UTC
OK, I stopped wanting to mount the nfsroot ro initially. If it is mounted rw from the very beginning, everything seems to work correctly. It is later remounted through /etc/init.d/netmount with new options found in /etc/fstab. 

In my case, mounting nfsroot rw is achieved by including rw kernel option in the APPEND line of pxelinux.cfg. 
Comment 8 James M Leddy 2009-11-08 19:53:53 UTC
(In reply to comment #7)
> OK, I stopped wanting to mount the nfsroot ro initially. If it is mounted rw
> from the very beginning, everything seems to work correctly. It is later
> remounted through /etc/init.d/netmount with new options found in /etc/fstab. 
> 
> In my case, mounting nfsroot rw is achieved by including rw kernel option in
> the APPEND line of pxelinux.cfg. 

That ins't that great a solution, I still can't remount with any current version of nfs-utils 

Comment 9 Pacho Ramos gentoo-dev 2016-08-24 08:53:19 UTC
AS far as I remember, nfs handling has changed a lot with baselayout-2 and recent nfs-utils versions... is this still valid?
Comment 10 thomas 2016-08-24 15:15:48 UTC
No, this is solved right now.