Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 372703 - net-misc/vde service script unloads module when it is still needed
Summary: net-misc/vde service script unloads module when it is still needed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Jorge Manuel B. S. Vicetto
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-23 19:50 UTC by Guenther Brunthaler
Modified: 2017-09-20 22:36 UTC (History)
2 users (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 Guenther Brunthaler 2011-06-23 19:50:22 UTC
The stop() function in /etc/init.d/vde contains the lines

[ "${VDE_MODPROBE_TUN}" == "yes" ] && modprobe -r tun
start-stop-daemon --stop --quiet --exec /usr/bin/vde_switch

This is obviously incorrect, because the module is needed and cannot be unloaded as long as the service is still running.

The order of those two lines should therefore be reversed.
Comment 1 Guenther Brunthaler 2011-06-26 00:23:01 UTC
As it turns out, the scope of the problem is wider than initially assumed.

When I applied my fix, the net.* scripts for VDE interfaces suddenly failed to start!

The problem is that those scripts need the loaded tun.ko module, but vde which loads it will be started *after* those scripts.

A similar problem occurs at unloading: when vde is stopped first according to the service dependencies, it unloads tun.ko and die VDE interfaces won't work - or unloading will display a warning message and fail.

In fact, the VDE net.* scripts only worked so far *because* of the incorrect ordering of lines!

The incorrect order effectively disabled the script from unloading the tun module as intended, but therefore the *.net scripts did not run into the beforementioned problems.

The clean solution seems to be to remove the module loading/unloading part completely from /etc/init.d/vde, and add them to the net.* scripts instead.

Perhaps the tun module should never be unloaded at all - it doesn't seem to be worth the hassle.

Otherwise we would need some sort of reference count or "holder list" in order to determine when it is safe to unload tun.ko and no-one else needs the module.
Comment 2 Pacho Ramos gentoo-dev 2011-07-10 17:09:40 UTC
Please post "emerge --info vde" output
Comment 3 Guenther Brunthaler 2011-07-10 20:16:01 UTC
Here it is:

Portage 2.1.10.3 (default/linux/amd64/10.0, gcc-4.4.5, glibc-2.12.2-r0, 2.6.27.59-xquad-11.145 x86_64)
=================================================================
                        System Settings
=================================================================
System uname: Linux-2.6.27.59-xquad-11.145-x86_64-AMD_Phenom-tm-_9600_Quad-Core_Processor-with-gentoo-2.0.2
Timestamp of tree: Thu, 07 Jul 2011 16:45:01 +0000
distcc 3.1 x86_64-pc-linux-gnu [disabled]
ccache version 2.4 [enabled]
app-shells/bash:          4.1_p9
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.1-r1, 3.1.3-r1
dev-util/ccache:          2.4-r9
dev-util/cmake:           2.8.4-r1
dev-util/pkgconfig:       0.25-r2
sys-apps/baselayout:      2.0.2
sys-apps/openrc:          0.8.3-r1
sys-apps/sandbox:         2.4
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:       2.20.1-r1
sys-devel/gcc:            4.4.5
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.2.10
sys-devel/make:           3.82
sys-kernel/linux-headers: 2.6.30-r1 (virtual/os-headers)
sys-libs/glibc:           2.12.2
Repositories: gentoo sunrise x-mscgen x-simplux x-xworld x-xworld_attic x-xworld_experimental x-xworld_hotfixes x-xworld_serviced x-xworld_thirdparty gamerlay-stable proaudio x-kde4noconkit x-crossdev-m68k x-overlay x-local_sets_overlay
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=amdfam10 -O3 -DNDEBUG -pipe -fno-stack-check"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/fax /usr/local/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa /var/lib/citadel /var/lib/hsqldb /var/spool/fax/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/host-variants/ /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /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"
CXXFLAGS="-march=amdfam10 -O3 -DNDEBUG -pipe -fno-stack-check"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--nospinner --with-bdeps=y"
FEATURES="assume-digests binpkg-logs ccache distlocks ebuild-locks fixlafiles fixpackages metadata-transfer news notitles protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
FFLAGS=""
GENTOO_MIRRORS="/usr/local/portage/distfiles/local /usr/local/portage/distfiles /usr/local/portage/distfiles/precious /usr/local/portage/distfiles/mnt http://tux.rainside.sk/gentoo/ http://cesium.di.uminho.pt/pub/gentoo/ http://ftp.twaren.net/Linux/Gentoo/ ftp://ftp.jaist.ac.jp/pub/Linux/Gentoo/ http://ftp.ncnu.edu.tw/Linux/Gentoo/ http://ftp.jaist.ac.jp/pub/Linux/Gentoo/ ftp://ftp.twaren.net/Linux/Gentoo/ http://ftp.lecl.net/pub/gentoo/ http://ftp.daum.net/gentoo/ ftp://tux.rainside.sk/gentoo/"
LANG="de_AT.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de_AT@boldquot de_AT@quot de_AT de_DE@boldquot de_DE@quot de_DE de@boldquot de@quot de en_US@boldquot en_US@quot en_US en@boldquot en@quot en"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_COMPRESS="lzma"
PORTAGE_COMPRESS_FLAGS="-9"
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"
PORTDIR_OVERLAY="/var/lib/layman/sunrise /var/lib/layman/mscgen /var/lib/layman/simplux /var/lib/layman/xworld /var/lib/layman/xworld_attic /var/lib/layman/xworld_experimental /var/lib/layman/xworld_hotfixes /var/lib/layman/xworld_serviced /var/lib/layman/xworld_thirdparty /var/lib/layman/gamerlay /var/lib/layman/pro-audio /var/lib/layman/kde4noconkit /var/lib/layman/crossdev-m68k /usr/local/portage/overlay /etc/portage/local_sets_overlay"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac aalib accessibility acpi agg alsa amd64 aspell audiofile bash-completion berkdb branding bzip2 cairo caps cddb cdr cleartype cli cracklib crypt css cups curl custom-cflags custom-cxxflags cxx dbus development device-mapper dri dts dv dvd dvdr dvdread ecc encode exif expat faac faad ffmpeg fftw firefox flac fontconfig foomaticdb freetype ftp fuse gd gdbm gif gimp glade glut gmp gpm gstreamer gtk gtk2 i18n iconv icu id3tag idea ieee1394 imagemagick imlib inotify iptc jack java6 javascript jbig jp2 jpeg jpeg2k kdehiddenvisibility kdexdeltas kpathsea ladspa lame lash lcms ldap libcaca libclamav libnotify libsamplerate lm_sensors logrotate lua lzma lzo mad matroska mikmod mmap mmx mmxext mng modules mp3 mp4 mpeg mudflap mule multilib musepack musicbrainz ncurses nls nodrm nptl nptlonly oav odbc offensive ofx ogg openal opengl openmp pam pango pch pcre pda pdf pic png ppds pppd qt qt3support qt4 quicktime quotas readline samba sasl screen sdl session sharedmem slang smartcard smp sndfile sox speex spell sqlite sqlite3 sse sse2 sse3 sse4a ssl startup-notification svg swig sysfs taglib tetex theora threads threadsafe tiff truetype unicode usb userlocales utf8 vcd vde vorbis wavpack webkit wxwindows x264 xcb xft xinetd xml xorg xosd xpm xrandr xscreensaver xsl xulrunner xv xvid xvmc zlib" ALSA_CARDS="emu10k1" 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="braindump flow karbon kexi kpresenter krita tables words" 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="evdev joystick keyboard mouse void" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de_AT@boldquot de_AT@quot de_AT de_DE@boldquot de_DE@quot de_DE de@boldquot de@quot de en_US@boldquot en_US@quot en_US en@boldquot en@quot en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="dummy ati v4l vesa vga" 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, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

net-misc/vde-2.3.1 was built with the following:
USE="(multilib) ssl -pcap"
Comment 4 Nico Baggus 2011-07-11 07:41:42 UTC
If a network script depends on something, shouldn't there be a line in /etc/conf.d/net along the lines of:

depend_{interface} () {
     need vde
}

where {interface} is replace with the relevant interface from net.{interface}

I agree with the line order change, vde_switch should indeed stop before rmmod tun.
Comment 5 NP-Hardass gentoo-dev 2017-09-20 22:36:28 UTC
modprobe -r is now done in post_stop, older versions have been removed.