Hi. The "rmmod --wait $1" statement in /etc/init.d/alsasound hangs for me when shutting down my laptop. Yes, I don't know why, but removing the "--wait" argument allows normal system shutdown, with no apparent ill effects. Note my change in the bash function below, in /etc/init.d/alsasound: unload_modules_recursive() { local revdeps="$(lsmod | sed -n -e "s/,/ /g" -e "s/^$1 *[0-9]* *[0-9]* \(.*\)/\1/p")" for module in ${revdeps} ; do unload_modules_recursive "${module}" done vebegin "Unloading: $1" #rmmod --wait "$1" rmmod "$1" veend $? } Reproducible: Always Steps to Reproduce: 1. Leave init script alone 2. reboot -hi 3. Stare slack-jawed at half-shutdown system Actual Results: System hangs. When init scripts are run in parallel, I can ctrl-C past the issue, when sequential, I cannot - ctrl-C has no effect. Expected Results: Clean system shutdown. I think the script should handle better any alsa modules which do not properly unload. However, for reference, here's my loaded alsa modules, and I'm running tuxonice-sources-2.6.29, with media-sound/alsa-utils-1.0.17: fuji ~ # lsmod | grep snd snd_pcm_oss 38304 0 snd_mixer_oss 14244 1 snd_pcm_oss snd_seq_dummy 2440 0 snd_seq_oss 29952 0 snd_seq_midi_event 5732 1 snd_seq_oss snd_seq 44112 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event snd_seq_device 6256 3 snd_seq_dummy,snd_seq_oss,snd_seq snd_intel8x0m 13392 0 snd_ac97_codec 101700 1 snd_intel8x0m ac97_bus 1348 1 snd_ac97_codec snd_hda_codec_si3054 4260 1 snd_hda_codec_realtek 188936 1 snd_hda_intel 24136 0 snd_hda_codec 54468 3 snd_hda_codec_si3054,snd_hda_codec_realtek,snd_h da_intel snd_hwdep 6792 1 snd_hda_codec snd_pcm 65228 6 snd_pcm_oss,snd_intel8x0m,snd_ac97_codec,snd_hda _codec_si3054,snd_hda_intel,snd_hda_codec snd_timer 18248 2 snd_seq,snd_pcm snd 50564 15 snd_pcm_oss,snd_mixer_oss,snd_seq_dummy,snd_seq _oss,snd_seq,snd_seq_device,snd_intel8x0m,snd_ac97_codec,snd_hda_codec_si3054,sn d_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer soundcore 5600 1 snd snd_page_alloc 7948 3 snd_intel8x0m,snd_hda_intel,snd_pcm fuji ~ # emerge --info: fuji ~ # emerge --info * Overlay eclass overrides eclass from PORTDIR: * * '/usr/portage/local/layman/vmware/eclass/vmware.eclass' * * It is best to avoid overriding eclasses from PORTDIR because it will * trigger invalidation of cached ebuild metadata that is distributed with * the portage tree. If you must override eclasses from PORTDIR then you * are advised to add FEATURES="metadata-transfer" to /etc/make.conf and to * run `emerge --regen` after each time that you run `emerge --sync`. Set * PORTAGE_ECLASS_WARNING_ENABLE="0" in /etc/make.conf if you would like to * disable this warning. Portage 2.1.6.11 (default/linux/x86/2008.0/desktop, gcc-4.3.2, glibc-2.8_p20080602-r1, 2.6.29-tuxonice i686) ================================================================= System uname: Linux-2.6.29-tuxonice-i686-Intel-R-_Pentium-R-_M_processor_1.20GHz-with-glibc2.0 Timestamp of tree: Fri, 01 May 2009 18:30:15 +0000 distcc 3.0 i686-pc-linux-gnu [enabled] ccache version 2.4 [disabled] app-shells/bash: 3.2_p39 dev-java/java-config: 1.3.7-r1, 2.1.7 dev-lang/python: 2.5.4-r2 dev-python/pycrypto: 2.0.1-r8 dev-util/ccache: 2.4-r7 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.4_p6, 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.0-r4 sys-devel/libtool: 1.5.26 virtual/os-headers: 2.6.27-r2 ACCEPT_KEYWORDS="x86" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=pentium-m -O2 -pipe -ggdb" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/lib/fax /usr/share/config /var/lib/hsqldb /var/spool/fax/etc" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /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=pentium-m -O2 -pipe -ggdb" DISTDIR="/usr/portage/distfiles" FEATURES="distcc distlocks fixpackages parallel-fetch protect-owned sandbox sfperms splitdebug strict unmerge-orphans userfetch" GENTOO_MIRRORS="http://gentoo.llarian.net/ http://mirror.usu.edu/mirrors/gentoo/ http://gentoo.mirrors.easynews.com/linux/gentoo/" LDFLAGS="-Wl,-O1" LINGUAS="en" MAKEOPTS="-j5" 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="/home/jesse/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/portage/local/layman/berkano /usr/portage/local/layman/java-overlay /usr/portage/local/layman/wschlich-testing /usr/portage/local/layman/voip /usr/portage/local/layman/liquidx /usr/portage/local/layman/jokey /usr/portage/local/layman/sunrise /usr/portage/local/layman/vmware /usr/local/portage" SYNC="rsync://192.168.1.55/gentoo-portage" USE="X a52 aac aalib abiword accessibility acpi additions adns aften alsa amr ao apache2 aspell autoipd avahi avi background bash-completion berkdb bluetooth bolddiag boost branding browserplugin bzip2 cairo calendar cdio cdparanoia cdr cgi chardet cli colordiff console consolekit cpudetection crypt cups curl cxx dbus device-mapper dga dia dirac divx dmi dri dv dvd dvdr dvdread eds encode escreen ethereal exif extrafilters fam fame fastcgi faxonly fbcon fbcondecor fbsplash festival ffmpeg firefox flac font-server fontconfig foomaticdb fortran freetype frontendonly garmin gd gdbm gecko gif gimp gimpprint gmedia gnutls gpm gps grammar graphviz gs gstreamer gtk gtk2 gtkhtml gutenprint h323 hal hardenedphp hash httpd iconv id3tag ieee1394 ilbc imagemagick imap imlib inkjar irda java jbig jikes jit john joystick jp2 jpeg jpeg2k json kate kerberos kqemu ladspa lame laptop lash lcms ldap libass libgcrypt libgda libnotify libsamplerate libv4l2 live logrotate loop-aes lua lzo lzw-tiff mad madwifi maildir matroska mbrola mcal mdb mdnsresponder-compat mhash midi mikmod mime mjpeg mmap mmx mmxext mng modplug motif mozbranding mozdevelop mozilla mozsvg mp2 mp3 mp4 mp4live mpeg mpeg2 mplayer mpm-worker mysql mysqli mythtv ncurses net network nls nocd nptl nptlonly nsplugin ntfs odbc offensive ogg oggvorbis old-daemons opengl openstreetmap oss ots pam pam_timestamp pcap pcf pcmcia pcre pda pdf perl php plotutils plugin pmu png pnp policykit posix postgres postproc postscript ppds prediction pvr python qemu-fast qt3 qt3support quicktime readline realmedia reflection reiserfs rtc rtsp ruby samba schroedinger scripting sdl session shout simplexml skins skype slang slit slp sndfile snmp soap sockets socks5 softmmu soundtouch speex spell sqlite sqlite3 sse sse2 ssl status stream suidcheck svg sysfs templates test-programs theora thesaurus threads threadsafe tidy tiff tk tokenizer toolbar truetype truetype-fonts twolame type1-fonts udev unicode usb utils v4l v4l2 vamp vcd video vidix vim vim-pager vim-syntax vim-with-x vlm vorbis wavpack webdav-neon wifi win32codecs wmf wmp wordperfect wxwindows x264 x86 xchattext xcomposite xext xforms xfs xine xinerama xml xml2 xmlrpc xorg xosd xplanet xscreensaver xulrunner xv xvid xvmc yahoo yv12 zip zlib zrtp zvbi" 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 auth_digest authn_anon authn_dbd 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 dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse synaptics joystick evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" USERLAND="GNU" VIDEO_CARDS="vga vesa i810 intel fbdev" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS fuji ~ #
Disable module unloading completely, as it's done in ~ alsa. There's also a comment that it was a bad idea in the first place.
Re Comment #1: I see this in /etc/conf.d/alsasound: # UNLOAD_ON_STOP: # Do you want to unload sound modules when alsasound stops? # no - Do not unload modules # yes - Unload modules UNLOAD_ON_STOP="yes" Where is this comment you write about? I understand that you can disable module unloading this way, but shouldn't the script not just hang the shutdown if there is a failure?
Created attachment 190236 [details, diff] /etc/init.d/alsasound.diff Hello there! One of users from our community suggested sorting modules by "used by" column before unloading (http://www.gentoo.ru/node/14584#comment-101670). You can try patch based on this suggestion. Just apply it against /etc/init.d/alsasound.
*** This bug has been marked as a duplicate of bug 253535 ***