Find the answer to your Linux question:
Results 1 to 4 of 4
Hi I've done a net base install of Debian Etch and added a few packages of preference (XORG, fluxbox, alsa, etc) and during the configuration process I ran alsaconf. Everything ...
  1. #1
    Just Joined! gogul2k's Avatar
    Join Date
    Nov 2007
    Posts
    32

    Opening files from NTFS partition appears to mess ALSA up

    Hi

    I've done a net base install of Debian Etch and added a few packages of preference (XORG, fluxbox, alsa, etc) and during the configuration process I ran alsaconf.

    Everything seemed to be fine. I could play music without issue.

    If I try to play a file from my NTFS (Windows) partition then I get a message saying it can't open audio.

    Tried running alsamixer from the terminal, I got this output
    Code:
    alsamixer: function snd_ctl_open failed for default: No such device
    .

    Here is the contents of my fstab file:
    Code:
    # /etc/fstab: static file system information.
    #
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    proc            /proc           proc    defaults        0       0
    /dev/hda2       /               ext3    defaults,errors=remount-ro 0       1
    /dev/hda3       none            swap    sw              0       0
    /dev/sda1	/mnt/pendrive	vfat	defaults	0	0
    /dev/hdc        /media/cdrom0   udf,iso9660 user,noauto     0       0
    /dev/hdd        /media/cdrom1   udf,iso9660 user,noauto     0       0
    /dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0
    /dev/hda1	/mnt/win_c	ntfs ro,umask=0000,user,gid=users 0 0
    And if it helps, this is the contents of my alsa file in the /etc/init.d/ directory
    Code:
    #!/bin/sh
    #
    # alsa-base control script
    #
    ### BEGIN INIT INFO
    # Provides:           alsa
    # Required-Start:    mountall
    # Required-Stop:     mountall
    # Should-Start:
    # Should-Stop:
    # Default-Start:     S
    # Default-Stop:      0 1 6
    # Short-Description: Script to unload and load ALSA modules
    # Description: Used to load and unload ALSA modules and
    #              restore and store mixer levels. There is no
    #              longer any need to run this script on bootup
    #              or shutdown. It remains in /etc/init.d/ because
    #              certain other other scripts expect to find it.
    ### END INIT INFO
    
    set -e
    
    # Exit if alsa-base package is not installed
    [ -f /lib/alsa/modprobe-post-install ] || exit 0
    
    MYNAME=/etc/init.d/alsa
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    
    # Default values of variables in /etc/default/alsa
    force_unload_modules_before_suspend=""
    
    [ -f /etc/default/alsa ] && . /etc/default/alsa
    
    # $* MESSAGE
    warn() { echo "${MYNAME}: Warning: $* " >&2 ; }
    
    #
    # Attempt to create /var/run/alsa if it is absent.
    # Return true if /var/run/alsa exists after this attempt,
    # otherwise false.
    #
    check_run_dir()
    { 
    	[ -d /var/run/alsa ] && return 0
    	# We have no business creating /var/run if it doesn't exist
    	if ! [ -d /var/run ] ; then
    		warn "Could not create /var/run/alsa/ because /var/run/ is not present."
    		return 1
    	fi
    	if ! mkdir --mode=755 /var/run/alsa ; then
    		warn "Failed to create /var/run/alsa/."
    		return 1
    	fi
    	[ -d /var/run/alsa ] && return 0
    	return 1
    }
    
    echo_procs_using_sound()
    {
    	echo $( \
    		lsof +D /dev -F rt \
    		| awk '/^p/ {pid=$1} /^t/ {type=$1} /^r0x(74|e)..$/ && type == "tCHR" {print pid}' \
    		| cut -c 2- \
    		| uniq \
    	)
    }
    
    # $* [PID]...
    echo_with_command_names()
    {
    	[ "$1" ] || return 0
    	echo $( \
    		ps --no-headers -o "&#37;p %c" "$@" \
    		| sed -e 's/\([0-9][0-9]*\) \(.*\)/\1(\2)/' \
    	)
    }
    
    kill_procs_using_sound()
    {
    	procs_using_sound="$(echo_procs_using_sound)"
    	if [ "$procs_using_sound" ] ; then
    		echo -n "Terminating processes:"
    		for attempt in 1 2 3 4 ; do
    			echo -n " ${procs_using_sound}"
    			kill $procs_using_sound || :
    			sleep 1
    			procs_using_sound="$(echo_procs_using_sound)"
    			[ "$procs_using_sound" ] || break
    		done
    		# Either no more procs using sound or attempts ran out
    		if [ "$procs_using_sound" ] ; then
    			echo -n " (with SIGKILL:) ${procs_using_sound}"
    			kill -9 $procs_using_sound || :
    			sleep 1
    		fi
    		procs_using_sound="$(echo_procs_using_sound)"
    		if [ "$procs_using_sound" ] ; then
    			echo " (failed: processes still using sound devices: $(echo_with_command_names $procs_using_sound))."
    			return 1
    		fi
    		echo "."
    	fi
    	return 0
    }
    
    # $* MODULE-NAME [MODULE-NAME]... | "all"
    unload_modules()
    {
    	procs_using_sound="$(echo_procs_using_sound)"
    	if [ "$procs_using_sound" ] ; then
    		warn "Processes using sound devices: $(echo_with_command_names $procs_using_sound)."
    	fi
    	if check_run_dir ; then
    		:> /var/run/alsa/modules-removed
    	else
    		warn "Not keeping list of removed modules because /var/run/alsa is absent.
    It will not be possible automatically to reload these modules."
    	fi
    	echo -n "Unloading ALSA sound driver modules:"
    	[ -d /proc/asound ] || { echo " (none loaded)." ; return 0 ; }
    	echo_snd_modules_loaded()
    	{
    		lsmod \
    		| sed -n -e 's/^\(snd[-_][^[:space:]]*\)[[:space:]].*/\1/p' \
    		| sed -e 's/_/-/g'
    	}
    	for FSMBS in $* ; do
    		MODULES_TO_REMOVE=""
    		SND_MODULES_LOADED="$(echo_snd_modules_loaded)"
    		case "$FSMBS" in
    		  all)
    			MODULES_TO_REMOVE="$SND_MODULES_LOADED"
    			;;
    		  snd_*|snd-*)
    			FSMBS="$(echo "$FSMBS" | sed -e 's/_/-/g')"
    			for M in $SND_MODULES_LOADED ; do
    				if [ "$FSMBS" = "$M" ] ; then
    					MODULES_TO_REMOVE="$FSMBS"
    					break
    				fi
    			done
    			;;
    		esac
    		[ "$MODULES_TO_REMOVE" ] || continue
    		if [ -d /var/run/alsa ] ; then
    			echo "$MODULES_TO_REMOVE" >> /var/run/alsa/modules-removed
    		fi
    		for M in $MODULES_TO_REMOVE ; do
    			echo -n " ${M}"
    			modprobe -r "$M" >/dev/null 2>&1 || :
    		done
    	done
    	if [ -f /var/run/alsa/modules-removed ] ; then
    		MODULES_STILL_LOADED="$(echo_snd_modules_loaded | grep -F -f /var/run/alsa/modules-removed)"
    		MODULES_STILL_LOADED="$(echo $MODULES_STILL_LOADED)"
    	else
    		MODULES_STILL_LOADED=""
    	fi
    	if [ "$MODULES_STILL_LOADED" ] ; then
    		echo " (failed: modules still loaded: ${MODULES_STILL_LOADED})."
    		return 1
    	else
    		echo "."
    		return 0
    	fi
    }
    
    # $* MODULE-NAME [MODULE-NAME]... | "all"
    force_unload_modules()
    {
    	kill_procs_using_sound || :
    	unload_modules "$@" || return 1
    	return 0
    }
    
    load_unloaded_modules()
    {
    	LUM_RETURNSTATUS=0
    	MODULES_TO_LOAD=""
    	[ -d /var/run/alsa ] || warn "Directory /var/run/alsa is absent."
    	echo -n "Loading ALSA sound driver modules:"
    	[ -f /var/run/alsa/modules-removed ] && MODULES_TO_LOAD="$(echo $(cat /var/run/alsa/modules-removed))"
    	[ "$MODULES_TO_LOAD" ] || { echo " (none to reload)." ; return $LUM_RETURNSTATUS ; }
    	echo -n " $MODULES_TO_LOAD"
    	for MDL in $MODULES_TO_LOAD ; do
    		modprobe $MDL || LUM_RETURNSTATUS=1
    	done
    	case "$LUM_RETURNSTATUS" in
    	  0) echo "." ;;
    	  *) echo " (failed)." ;;
    	esac
    	return $LUM_RETURNSTATUS
    }
    
    case "$1" in
      unload)
    	unload_modules all || exit $?
    	;;
      reload)
    	EXITSTATUS=0
    	unload_modules all || EXITSTATUS=1
    	load_unloaded_modules || EXITSTATUS=1
    	exit $EXITSTATUS
    	;;
      force-unload)
    	force_unload_modules all || exit $?
    	;;
      force-reload)
    	EXITSTATUS=0
    	force_unload_modules all || EXITSTATUS=1
    	load_unloaded_modules || EXITSTATUS=1
    	exit $EXITSTATUS
    	;;
      suspend)
    	case "$force_unload_modules_before_suspend" in
    	  ""|false) : ;;
    	  all|true) force_unload_modules all || exit $? ;;
    	  *) force_unload_modules $force_unload_modules_before_suspend || exit $? ;;
    	esac
    	;;
      resume)
    	case "$force_unload_modules_before_suspend" in
    	  ""|false) : ;;
    	  *) load_unloaded_modules || exit $? ;;
    	esac
    	;;
      *)
    	echo "Usage: $MYNAME {unload|reload|force-unload|force-reload|suspend|resume}" >&2
    	exit 3
    	;;
    esac
    I'm using a compaq deskpro, but I don't think it is a hardware issue since I have the same issue on my laptop (dell latitude c640 ... I think).

    My ... temporary solution I suppose would be to reinstall ALSA and not play any files from my Windows partition again in future.

    Is there a more convenient solution to this problem though? I'm wondering if it's just a "bug".

    Any suggestions please?

    Thanks

    P.S.

    Problem persisted after resetting my computer, running top I can't see anything that might be interfering with it and nothing has changed (that I know of) that could've altered it since it last worked.

    Edit2: Been running XMMS to play music.

  2. #2
    Just Joined! gogul2k's Avatar
    Join Date
    Nov 2007
    Posts
    32
    Any additional information I could provide to promote a response?

  3. #3
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    This is, indeed, strange--why would opening a file corrupt your ALSA setup.

    Can it be, that ALSA went down as soon as you have mounted that NTFS partition? Then I would call it an incompatibility of kernel modules and try a custom built of a current kernel.

  4. #4
    Just Joined! gogul2k's Avatar
    Join Date
    Nov 2007
    Posts
    32
    I have no idea why and your compatibility suggestion sounds like a logical one ... now I think about it, can't remember if I tried opening other files from the partition yet, that's something I'll have to try next week (about to leave town for a week so I can take a break).

    Would this issue have occurred as soon as I mounted the partition? Because I was able to play a radio stream using XMMS after I had mounted the partition and was doing various things like moving files around on the NTFS partition etc. Though the problem did start as soon as I tried playing a music file and has persisted since even after reinstalling alsa.

    I guess I would have the same issue if I do an install with the desktop environment etc rather then a customisation of a base install?

    Thank you for your input, it's given me something to think about and I will try your suggestion

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •