Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 432454 - sys-block/open-iscsi - init script has problems with automatic mounting of iSCSI
Summary: sys-block/open-iscsi - init script has problems with automatic mounting of iSCSI
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-23 14:39 UTC by Seraphim Mellos
Modified: 2014-04-06 13:41 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Seraphim Mellos 2012-08-23 14:39:01 UTC
This is somewhat related to https://bugs.gentoo.org/show_bug.cgi?id=232347

So, iSCSI mounts that are configured to be mounted on boot require the iscsid process to be running before the actual mounting happens. This was the problem described in the ticket I mentioned above and it was fixed by rationalizing the localmount/netmount init scripts in openrc. 

However, the init script provided by open-iscsi still lacks the `before netmount` statement in the depend section. Even though it works (probably because of the default ordering) it is a bit fragile and I think the default init script should have "before netmount" included. 

Another issue that causes netmount to fail is that even if iscsid is run before netmount, the actual device nodes aren't created early enough and as a result netmount complains about the device nodes being unavailable. I couldn't find a bugtracker for open-iscsi but this discussion offers some more information about the problem:

https://groups.google.com/forum/#!topic/open-iscsi/uUVyk24pWgU

In order to work around this issue, I have added "sleep 1" after the login command in the starttargets() function which seems to work but this again is somewhat unsafe. I'm not sure if there is a better way to handle this. My starttargets() looks like this:

starttargets() {
        ebegin "Setting up iSCSI targets"
        /usr/sbin/iscsiadm -m node --loginall=automatic
        ret=$?
        sleep 1
        eend $ret
        return $ret
}

And last but no least, the iscsid init script can't handle stopping the iscsid process when there are mounted filesystems. It fails with the following error:

# /etc/init.d/iscsid stop
 * Caching service dependencies ...   [ ok ]
 * Disconnecting iSCSI targets ...    [ ok ]
 * Stopping iscsid ...                [ ok ]
 * Removing iSCSI modules iscsi_tcp ...
FATAL: Module iscsi_tcp is in use.    [ !! ]
 * ERROR: iscsid failed to stop

I'm not sure if this is the expected behavior or if the init script should handle unmounting the filesystems as well but I thought it's worth mentioning.

Tested with openrc-0.9.8.4 and open-iscsi-2.0.871-r1 and 2.0.871.3

Reproducible: Always




Portage 2.1.11.9 (default/linux/x86/10.0, gcc-4.1.2, glibc-2.9_p20081201-r2, 2.6.31-gentoo-r6 i686)
=================================================================
System uname: Linux-2.6.31-gentoo-r6-i686-Intel-R-_Xeon-TM-_CPU_2.80GHz-with-gentoo-2.1
Timestamp of tree: Wed, 22 Aug 2012 21:30:01 +0000
app-shells/bash:          4.0_p35
dev-lang/python:          2.6.4
dev-util/pkgconfig:       0.23
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.9.8.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.68
sys-devel/automake:       1.10.2, 1.11.1
sys-devel/binutils:       2.18-r3
sys-devel/gcc:            4.1.2, 4.3.4
sys-devel/gcc-config:     1.4.1
sys-devel/libtool:        2.2.6b
sys-devel/make:           3.81::<unknown repository>
sys-kernel/linux-headers: 2.6.27-r2 (virtual/os-headers)
sys-libs/glibc:           2.9_p20081201-r2
Repositories: gentoo fcpl
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -march=i686 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -march=i686 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/fcpl"
SYNC="rsync://portage.slg0.fcpl.com/gentoo-portage"
USE="acl berkdb bzip2 cli cracklib crypt cxx dri fortran gdbm iconv ipv6 modules mudflap ncurses nls nptl openmp pam pcre pppd readline session ssl tcpd unicode vhosts x86 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 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 cgi cgid 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" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Seraphim Mellos 2012-10-22 15:49:51 UTC
Any chance to have someone take a look at this?

I've also found out that the open-iscsi init script breaks LSB compatibility with the custom status() method that it's using. Even when the service isn't running, the return code is 0 but according to LSB it should be 3[1]. 

[1] http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
Comment 2 Doug Goldstein (RETIRED) gentoo-dev 2012-10-22 16:06:25 UTC
Gentoo is not a LSB distro.
Comment 3 Seraphim Mellos 2012-10-22 16:22:50 UTC
Never mind the LSB compatibility, I think it'd make sense to have status() return a different return code depending on the status of the service similar to the way the default status() works.