Bug 218713 - net-fs/nfs-utils-1.1.2 nfsmount init script asks for nonexistent rpc.idmapd service
Bug#: 218713 Product:  Gentoo Linux Version: 2006.1 Platform: AMD64
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: net-fs@gentoo.org Reported By: paolo.pedroni@iol.it
Component: Applications
URL: 
Summary: net-fs/nfs-utils-1.1.2 nfsmount init script asks for nonexistent rpc.idmapd service
Keywords:  
Status Whiteboard: 
Opened: 2008-04-21 10:31 0000
Description:   Opened: 2008-04-21 10:31 0000
After upgrading to nfs-utils-1.1.2 following bug #217977, I have the problem
above on two out of three clients. Trying to restart the service after emerging
version 1.1.2 yields the error message below:

# /etc/init.d/nfsmount restart
 * Caching service dependencies ...
 *  Can't find service 'rpc.idmapd' needed by 'nfsmount';  continuing... [ ok ]
 * Unmounting NFS filesystems ...                                        [ ok ]
rpc.idmapd
 * ERROR:  Some services needed are missing.  Run
 *         './nfsmount broken' for a list of those
 *         services.  nfsmount was not started.

Subsequently trying to start the service yield the same error. './nfsmount
broken' yields:

# /etc/init.d/nfsmount broken
 * Caching service dependencies ...
 *  Can't find service 'rpc.idmapd' needed by 'nfsmount';  continuing... [ ok ]
rpc.idmapd

and no remote filesystem is mounted.

As far as I understand rpc.idmapd is needed only for nfs4 mounts, which I do
not have, and is added to nfsmount dependencies in the 'if' block between lines
10 and 15 of /etc/init.d/nfsmount through some arcane 'awk' magic which I don't
pretend to understand but must obviously be wrong.

The client which yields no error is testing baselayout-2 and openrc, the ones
yielding errors are still on stable baselayout-1.

Reproducible: Always

Steps to Reproduce:
1. Upgrade to net-fs/nfs-utils-1.1.2
2. /etc/init.d/nfsmount restart
Actual Results:  
The nfsmount service requires missing rpc.idmapd service.

Expected Results:  
Mount remote nfs filesystems normally

# emerge --info (1st non-working client)
Portage 2.1.4.4 (default-linux/x86/2007.0/server, gcc-4.1.2, glibc-2.6.1-r0,
2.6.24-gentoo-r4 i686)
=================================================================
System uname: 2.6.24-gentoo-r4 i686 AMD Athlon(tm) XP 1800+
Timestamp of tree: Mon, 21 Apr 2008 05:33:01 +0000
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632)
[enabled]
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p17-r1
dev-java/java-config: 1.3.7, 2.1.4
dev-lang/python:     2.4.4-r9
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.10.1
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/revdep-rebuild
/etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache collision-protect digest distcc distlocks
fixpackages metadata-transfer sandbox sfperms strict test unmerge-orphans
userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://mirror.switch.ch/ftp/mirror/gentoo/
http://ftp.vein.hu/pub/linux/distributions/gentoo/
http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/
http://ftp.uni-erlangen.de/pub/mirrors/gentoo"
LANG="it_IT.UTF-8"
LC_ALL="it_IT.UTF-8"
LINGUAS="it"
MAKEOPTS="-j14"
PKGDIR="/usr/portage/packages"
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"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://pedroni03/gentoo-portage"
USE="acpi bash-completion bcmath berkdb bzip2 caps cli cracklib crypt curl
curlwrappers dbus dri fbcon fftw fortran ftp gdbm gmp gnutls gpm hal
hardenedphp iconv isdnlog java jikes lm_sensors maildir midi mime mmap mpi
mudflap ncurses nls nptl nptlonly offensive openmp pam pcre perl posix pppd
python readline recode reflection samba session sharedmem shorten sockets spell
spl ssl symlink syslog sysvipc tcl tcpd threads tidy tokenizer truetype unicode
usb vim-syntax x86 xml xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp
atiixp-modem bt87x ca0106 cmipci emu10k1 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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux"
LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses
text" LINGUAS="it" USERLAND="GNU" VIDEO_CARDS="via"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS,
PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

# cat /etc/fstab (1st non-working client)
/dev/sda1   /boot       ext2    defaults,noauto,noatime                 1 2
/dev/sda3   /           xfs     defaults,noatime,logbufs=8              0 1
/dev/sda2   none        swap    defaults,pri=1,sw                       0 0
/dev/sr0    /mnt/cdrom  auto    defaults,noauto,ro,users                0 0
/dev/fd0    /mnt/floppy auto    defaults,noauto,users                   0 0
xxx.xxx.xxx.xxx:/var/nfs/maildir_cluster01 /home/paolo/.maildir nfs
rw,rsize=8192,wsize=8192,hard,intr,nosuid,nodev,noexec      0 0
proc        /proc       proc    defaults,nosuid,noexec                  0 0
shm         /dev/shm    tmpfs   nodev,nosuid,noexec                     0 0
none        /tmp        tmpfs   defaults,mode=1777,nodev,noatime        0 0
udev        /dev        tmpfs   size=10M,nr_inodes=4k                   0 0

# emerge --info (2nd non-working client)
Portage 2.1.4.4 (default-linux/amd64/2007.0/desktop, gcc-4.1.2, glibc-2.6.1-r0,
2.6.24-gentoo-r4 x86_64)
=================================================================
System uname: 2.6.24-gentoo-r4 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor
4600+
Timestamp of tree: Mon, 21 Apr 2008 05:33:01 +0000
distcc 2.18.3 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632)
[enabled]
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p17-r1
dev-java/java-config: 1.3.7, 2.1.4
dev-lang/python:     2.4.4-r9
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=k8 -O2 -pipe -fomit-frame-pointer"
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/kde/4.0/env /usr/kde/4.0/share/config
/usr/kde/4.0/shutdown /usr/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf
/etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=k8 -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache collision-protect distcc distlocks fixpackages
metadata-transfer sandbox sfperms strict test unmerge-orphans userfetch
userpriv usersandbox"
GENTOO_MIRRORS="http://pandemonium.tiscali.de/pub/gentoo/
http://gentoo.mirror.solnet.ch http://gentoo.inode.at/
http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/
http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://ftp.du.se/pub/os/gentoo"
LANG="it_IT.UTF-8"
LC_ALL="it_IT.UTF-8"
LINGUAS="it"
MAKEOPTS="-j14"
PKGDIR="/usr/portage/packages"
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"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://10.20.30.18/gentoo-portage"
USE="X Xaw3d a52 aac aalib acpi alsa amd64 ao arts audiofile avahi
bash-completion berkdb bluetooth branding bzip2 cairo caps cddb cdparanoia cdr
cli cracklib crypt cups curl dbus dga dio dri dvd dvdr dvdread emboss encode
exif expat fam fbcon ffmpeg fftw firefox flac fontconfig foomaticdb fortran ftp
gd gdbm ggi gif glut gmp gnutls gphoto2 gpm gtk guile hal htmlhandbook iconv
idn ieee1394 imagemagick imlib isdnlog jack java javascript jbig jikes joystick
jpeg jpeg2k kde kdeenablefinal lcms libcaca libsamplerate lm_sensors lua lzo
mad maildir matroska memlimit midi mime mmap mmx mng mozilla mp3 mpeg mpi
mplayer mudflap ncurses nls nptl nptlonly nsplugin offensive ogg openal openexr
opengl openmp oss pam pcre pdf perl png portaudio posix ppds pppd python qt3
qt3support qt4 quicktime rdesktop readline recode reflection ruby samba scanner
sdl session sharedmem shorten sndfile sockets sox speex spell spl sse sse2 ssl
startup-notification svg symlink syslog sysvipc tcl tcpd theora threads tidy
tiff timidity tk truetype unicode usb vcd vim-syntax vorbis wmf wxwindows x264
xcb xcomposite xine xinerama xml xorg xosd xpm xscreensaver xv xvid yahoo zlib"
ALSA_CARDS="intel-8x0 virmidi" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix
dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter
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="kodak ptp2" ELIBC="glibc"
INPUT_DEVICES="keyboard evdev joystick mouse" KERNEL="linux"
LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses
text" LINGUAS="it" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS,
PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

# cat /etc/fstab (2nd non-working client)
/dev/mapper/nvidia_cdjahgde1 /boot    ext2   defaults,noauto,noatime     1 2
/dev/mapper/nvidia_cdjahgde6 /        xfs    defaults,noatime,logbufs=8  0 1
/dev/mapper/nvidia_cdjahgde5 none     swap   defaults,sw,pri=1           0 0
/dev/mapper/nvidia_cdjahgde3 /mnt/winxp32 ntfs-3g defaults,umask=007,gid=users
0 0
/dev/mapper/nvidia_cdjahgde2 /mnt/vista32 ntfs-3g defaults,umask=007,gid=users 
                          0 0
/dev/mapper/nvidia_cdjahgde7 /mnt/windows vfat
defaults,umask=007,gid=users,utf8,shortname=win95 0 0
/dev/sr0                     /mnt/cdrom   auto    defaults,noauto,users     0 0
/dev/fd0                     /mnt/floppy  vfat    defaults,noauto,users     0 0
xxx.xxx.xxx.xxx:/home/paolo/ClusterRip /home/paolo/ClusterRip nfs
rw,rsize=8192,wsize=8192,hard,intr,nosuid,nodev,noexec 0 0
xxx.xxx.xxx.xxx:/home/paolo/.maildir_mediacenter /home/paolo/.maildir nfs
rw,rsize=8192,wsize=8192,hard,intr,nosuid,nodev,noexec 0 0
xxx.xxx.xxx.xxx:/home/paolo/mp3 /var/mp3 nfs
rw,rsize=8192,wsize=8192,hard,intr,nosuid,nodev,noexec 0 0
xxx.xxx.xxx.xxx:/home/paolo/.Pippo /home/paolo/Pippo nfs
rw,rsize=8192,wsize=8192,hard,intr,nosuid,nodev 0 0
xxx.xxx.xxx.xxx:/usr/portage/packages /usr/portage/packages nfs
rw,rsize=8192,wsize=8192,hard,intr,nosuid,nodev,noexec 0 0
proc       /proc    proc  defaults,nosuid,noexec                            0 0
shm        /dev/shm tmpfs defaults,nodev,nosuid,noexec,noatime              0 0
none       /tmp     tmpfs defaults,mode=1777,nodev,nosuid,noexec,noatime    0 0
udev       /dev     tmpfs size=10M,nr_inodes=4k                             0 0

------- Comment #1 From SpanKY 2008-04-21 18:17:02 0000 -------
should be fixed in cvs now

http://sources.gentoo.org/net-fs/nfs-utils/files/nfsmount.initd?r1=1.9&r2=1.10

------- Comment #2 From Paolo Pedroni 2008-04-21 21:30:10 0000 -------
Nope, it doesn't work. Same error as before.

------- Comment #3 From teidakankan@gmail.com 2008-04-21 21:55:40 0000 -------
(In reply to comment #2)
> Nope, it doesn't work. Same error as before.
> 

Fixed it here.  Not to be insulting, but did you do an etc-update to replace
the init.d script?

------- Comment #4 From Paolo Pedroni 2008-04-22 06:08:57 0000 -------
(In reply to comment #3)
> (In reply to comment #2)
> > Nope, it doesn't work. Same error as before.
> > 
> 
> Fixed it here.  Not to be insulting, but did you do an etc-update to replace
> the init.d script?
> 

No insult taken. Yes, I did. I'll try now on the 2nd affected system and report
my findings.

------- Comment #5 From Paolo Pedroni 2008-04-22 07:27:16 0000 -------
I can confirm it also on the second computer: problem not solved.

Thanks to the tutorial at
http://www.oracle.com/technology/pub/articles/dulaney_awk.html
I think I can now understand the 'awk' statement in the ebuild and maybe what
is the problem with it. Let's see if I got it right:

Line 11: awk '!/^[[:space:]]*#/ && $3 == "nfs4" { exit ($4 ~ /sec=krb/ ? 10 :
20) }' /etc/fstab
It check each line of /etc/fstab not startint with whitespace or '#' and for
each line in which the third field is "nfs4" it exits with 10 if the fourth
field contains sec=krb and with 20 if it does not.

Line 12: local ret=$?
It assigns the exit value of the 'awk' command to local variable 'ret'

Line 13: [ ${ret} -eq 10 ] && myneed="${myneed} rpc.gssd"
If 'ret' is equal to 10 then add rpc.gssd to the dependancies

Line 14: [ ${ret} -ne 20 ] && myneed="${myneed} rpc.idmapd"
If 'ret' is _not_ equal to 20 then add rpc.idmapd to the dependancies

I think that the error is in this line: shouldn't it be [ ${ret} -eq 20 ], that
is add rpc.idmapd if we have an nfs4 filesystem _without_ kerberos security? In
the current way, if no nfs4 filesystems are found, 'awk' returns some value
(for no matches found) which is nor 10 (thus not triggering the first
conditional), neither 20 (thus _triggering_ the second conditional).

I hope I got it right.

------- Comment #6 From SpanKY 2008-04-22 07:43:22 0000 -------
it was supposed to be changed to -eq but i missed that in the previous commit

http://sources.gentoo.org/net-fs/nfs-utils/files/nfsmount.initd?r1=1.10&r2=1.11