# alsa sound as root, but no sound as user [solved/pulseaudio]

## danielcb

Hi,

a few days ago my audio setup stopped working. There was no kernel-update and no other significant software-update (a regular world update, but i do that every few days..).

The problem:

I have no sound / no access to my soundcard as a user. Everything works fine as root (alsamixer works,  dd if=/dev/urandom | aplay works). The user is (and was before) in the audio group.

I couldn't find any error messages or log entries. alsamixer and aplay just hang without any output forever.

I'm on a ~amd64 system.

```

% uname -r

3.3.0-gentoo

```

The permissions in /dev/snd/ seem correct:

```

# ls -l /dev/snd 

total 0

drwxr-xr-x  2 root root       80 Apr  1 19:15 by-path

crw-rw----+ 1 root audio 116,  7 Apr  1 19:15 controlC0

crw-rw----+ 1 root audio 116, 10 Apr  1 19:15 controlC1

crw-rw----+ 1 root audio 116,  6 Apr  1 19:15 hwC0D0

crw-rw----+ 1 root audio 116,  9 Apr  1 19:15 hwC1D0

crw-rw----+ 1 root audio 116,  5 Apr  1 19:15 pcmC0D0c

crw-rw----+ 1 root audio 116,  4 Apr  1 19:15 pcmC0D0p

crw-rw----+ 1 root audio 116,  3 Apr  1 19:15 pcmC0D1c

crw-rw----+ 1 root audio 116,  2 Apr  1 19:15 pcmC0D1p

crw-rw----+ 1 root audio 116,  8 Apr  1 19:15 pcmC1D3p

crw-rw----+ 1 root audio 116,  1 Apr  1 19:15 seq

crw-rw----+ 1 root audio 116, 33 Apr  1 19:15 timer

```

lspci output: (but since everything is fine as root, i don't think it's a hardware/driver/kernel problem)

```

# lspci -v |grep Audio

00:1b.0 Audio device: Intel Corporation 82801JI (ICH10 Family) HD Audio Controller

01:00.1 Audio device: Advanced Micro Devices [AMD] nee ATI Caicos HDMI Audio [Radeon HD 6400 Series]

```

/proc/asound/

```

# ls -l /proc/asound      

total 0

lrwxrwxrwx 1 root root 5 Apr  1 19:24 Generic -> card1

lrwxrwxrwx 1 root root 5 Apr  1 19:24 Intel -> card0

dr-xr-xr-x 6 root root 0 Apr  1 19:24 card0

dr-xr-xr-x 3 root root 0 Apr  1 19:24 card1

-r--r--r-- 1 root root 0 Apr  1 19:24 cards

-r--r--r-- 1 root root 0 Apr  1 19:24 devices

-r--r--r-- 1 root root 0 Apr  1 19:24 hwdep

dr-xr-xr-x 2 root root 0 Apr  1 19:24 oss

-r--r--r-- 1 root root 0 Apr  1 19:24 pcm

dr-xr-xr-x 2 root root 0 Apr  1 19:24 seq

-r--r--r-- 1 root root 0 Apr  1 19:24 timers

-r--r--r-- 1 root root 0 Apr  1 19:24 version

```

and as mentioned, i'm in audio:

```

# id daniel 

uid=1000(daniel) gid=100(users) groups=100(users),5(tty),7(lp),10(wheel),14(uucp),18(audio),19(cdrom),27(video),85(usb),250(portage),16(cron),998(kvm),35(games)

```

Since I didn't know what else to do, I removed every part of alsa (emerge -C alsa-utils alsa-....), rebooted, and emerged it again. I thought that might fix any possible problems with permissions, but it didn't change anything.

Please let me know, if you need something else. I'm really desperate here.. ;)Last edited by danielcb on Mon Apr 02, 2012 11:41 am; edited 1 time in total

----------

## gorkypl

I know close to nothing about ALSA, but that '+' in the /dev/snd files indicates some ACL permissions. Maybe something is wrong with this?

----------

## Hu

What is the output of strace aplay < /dev/zero?

----------

## danielcb

just a snippet of the strace output: if you need more, just say so:

```

lstat("/tmp/pulse-CcctT9RwKSB1", 0x7fff7425ad00) = -1 ENOENT (No such file or directory)

umask(077)                              = 022

mkdir("/tmp/pulse-XYYOl1rns6a5", 0700)  = 0

umask(022)                              = 077

symlink("/tmp/pulse-XYYOl1rns6a5", "/home/daniel/.pulse/7857b022f90934276623d44f0000234b-runtime.tmp") = -1 EEXIST (File exists)

rmdir("/tmp/pulse-XYYOl1rns6a5")        = 0

nanosleep({0, 10000000}, NULL)          = 0

readlink("/home/daniel/.pulse/7857b022f90934276623d44f0000234b-runtime", "/tmp/pulse-CcctT9RwKSB1"..., 99) = 23

lstat("/tmp/pulse-CcctT9RwKSB1", 0x7fff7425ad00) = -1 ENOENT (No such file or directory)

umask(077)                              = 022

mkdir("/tmp/pulse-e3P2dTqhV7w6", 0700)  = 0

umask(022)                              = 077

symlink("/tmp/pulse-e3P2dTqhV7w6", "/home/daniel/.pulse/7857b022f90934276623d44f0000234b-runtime.tmp") = -1 EEXIST (File exists)

rmdir("/tmp/pulse-e3P2dTqhV7w6")        = 0

nanosleep({0, 10000000}, NULL)          = 0

readlink("/home/daniel/.pulse/7857b022f90934276623d44f0000234b-runtime", "/tmp/pulse-CcctT9RwKSB1"..., 99) = 23

lstat("/tmp/pulse-CcctT9RwKSB1", 0x7fff7425ad00) = -1 ENOENT (No such file or directory)

umask(077)                              = 022

mkdir("/tmp/pulse-QfKqnw29kONv", 0700)  = 0

umask(022)                              = 077

```

----------

## danielcb

and about ACL: I noticed that too and checked my useflags (acl is set), checked consolekit (is running and added to runlevel default) and checked the permissions with getfacl:

```

/dev % getfacl mixer 

# file: mixer

# owner: root

# group: audio

user::rw-

user:daniel:rw-

group::rw-

mask::rw-

other::---

```

/dev/dsp, ..., and everthing in /dev/snd/ looks the same.

----------

## danielcb

After reading a little bit about pulseaudio (http://wiki.gentoo.org/wiki/PulseAudio), I found this part:

 *Quote:*   

> 
> 
> If you forget to specify this when using the ALSA sink/source modules, you may not notice any problems until you restart PulseAudio (e.g. by logging out and back in or rebooting). You will be left with (obviously) no audio and a slowed down desktop environment and hanging applications until you resolve the loop, restart alsasound and kill all running pulseaudio processes.
> 
> 

 

and because I have no idea what else I could do, I followed that guide:

1. removed every member from audio (mine, and pulse)

2. set load-module module-alsa-sink device=hw:0,0 in /etc/pulse/default.pa

3. /etc/asound.conf wasn't there

4. pulseaudio, acl, etc. were set before

5. consolekit was set on runlevel default before

6. kernel settings (Tmpfs POSIX ACL and Virtual memory...) were set before

still nothing.

----------

## danielcb

and just in case:

emerge --info

```

% emerge --info

Portage 2.1.10.54 (default/linux/amd64/10.0, gcc-4.5.3, glibc-2.14.1-r2, 3.3.0-gentoo x86_64)

=================================================================

System uname: Linux-3.3.0-gentoo-x86_64-Intel-R-_Core-TM-2_Duo_CPU_E8400_@_3.00GHz-with-gentoo-2.1

Timestamp of tree: Mon, 02 Apr 2012 08:00:01 +0000

distcc 3.1 x86_64-pc-linux-gnu [disabled]

app-shells/bash:          4.2_p24

dev-java/java-config:     2.1.11-r3

dev-lang/python:          2.7.2-r3, 3.2.2-r1

dev-util/cmake:           2.8.7-r5

dev-util/pkgconfig:       0.26

sys-apps/baselayout:      2.1

sys-apps/openrc:          0.9.9.3

sys-apps/sandbox:         2.5

sys-devel/autoconf:       2.13, 2.68

sys-devel/automake:       1.11.3

sys-devel/binutils:       2.22-r1

sys-devel/gcc:            4.5.3-r2

sys-devel/gcc-config:     1.6

sys-devel/libtool:        2.4.2

sys-devel/make:           3.82-r3

sys-kernel/linux-headers: 3.3 (virtual/os-headers)

sys-libs/glibc:           2.14.1-r2

Repositories: gentoo

ACCEPT_KEYWORDS="amd64 ~amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-O2 -pipe -march=nocona"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /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="-O2 -pipe -march=nocona"

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS=""

GENTOO_MIRRORS="ftp://de-mirror.org/gentoo/ http://de-mirror.org/gentoo/ rsync://de-mirror.org/gentoo/ ftp://ftp.halifax.rwth-aachen.de/gentoo/ http://ftp.halifax.rwth-aachen.de/gentoo/ rsync://ftp.halifax.rwth-aachen.de/gentoo/ ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo http://ftp.uni-erlangen.de/pub/mirrors/gentoo"

LANG="en_US.UTF-8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="en de"

MAKEOPTS="-j3"

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=""

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="256-color X aac acl acpi afterimage alsa amd64 apm bash-completion berkdb bzip2 cleartype cli corefonts cracklib crypt cups cxx dbus dmx dri ffmpeg flac fortran gdbm gif git gnutls gpg gpm gtk gzip hal hardened iconv imap ipv6 iso14755 jabber javascript jpeg jpg latex lm_sensors mbox mmx modules mp3 mudflap multilib ncurses nls nptl nptlonly nsplugin ogg opengl openmp pam pcre perl png pppd pulseaudio python qemu readline samba sdl session smime smtp sse sse2 ssl subversion sysfs tcpd tls truetype type1 unicode vde vim-syntax xcb xft xml xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci 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="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en de" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="radeon" 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, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

----------

## gorkypl

Ah, you use PulseAudio... Do you really need it?

----------

## danielcb

actually no, I don't need it (I think). I didn't install it on purpose, but since it was there (pulled in by some other app I guess), I tried to configure it according to this guide. I thought the ACLs on /dev/snd (which my cause my problem) are there because of pulseaudio.

----------

## gorkypl

I suspect that your problem is somehow related to PA, because all other things look OK to me. Also it is probably possible to solve it while leaving PA installed, but if you do not explicitly need it (e.g. to indepentently control volume from different sources) I suggest to check what is pulling it and - if possible - to unmerge pulseaudio.

This piece of software has never been considered a masterpiece, rather the opposite.

As a completely margin note, I think that using acl on a home box is quite an overload  :Wink: 

----------

## danielcb

KVM and mpd/ncmpc are pulling in pulseaudio. And it worked before. 

Just for testing I'll set -pulseaudio in /etc/make.conf, do an emerge --newuse --deep --update @world and remove everything that sounds like pulseaudio ;)

brb.

----------

## gorkypl

 *danielcb wrote:*   

> KVM and mpd/ncmpc are pulling in pulseaudio. And it worked before. 

 

mpd with ncmpcpp works just fine without PA, I am happily using it now  :Wink: 

----------

## danielcb

solved!

I really don't know which packet pulled it in... pulseaudio was the problem and is definitely going into my package.mask.

Thanks for your help!

----------

## gorkypl

I am glad it works  :Smile:  And PA is definitely worth masking  :Wink: 

----------

