Sound only works if I log in (on the desktop)

Asked by Don Geddis

Just installed a new 11.04 Ubuntu on a new box. I can log in on the desktop, and sound works fine. "aplay -L" and "aplay -l" show lots of options. "mpg123 -a "hw:0,0" <song>" works great.

But I'm trying to make a headless server, that continuously plays music upon reboot. I don't want to log in.

Unfortunately, if I don't log in at the desktop (but instead from outside, via ssh), then there seem to be no alsa devices. /proc/asound/ shows lots of hardware detected, but "aplay -L" show no ALSA devices (except "null").

Similarly, if I log in at the desktop, but then log out again, all the alsa devices get destroyed. Or, if I log in, but then switch to a different user, that second user has no access to any valid alsa devices either.

I'm trying to make a script that will start up on system boot, and will continuously play music, hopefully with some special user id (= not me). How can I get all the software alsa devices to be generated at boot time, rather than per-user at desktop login time?

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: alsa-base 1.0.24+dfsg-0ubuntu1
ProcVersionSignature: Ubuntu 2.6.38-8.42-generic 2.6.38.2
Uname: Linux 2.6.38-8-generic i686
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.23.
Architecture: i386
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC1: geddis 6475 F.... pulseaudio
 /dev/snd/controlC0: geddis 6475 F.... pulseaudio
Card0.Amixer.info:
 Card hw:0 'Intel'/'HDA Intel at 0xfe978000 irq 45'
   Mixer name : 'IDT 92HD81B1C5'
   Components : 'HDA:111d76d5,12974003,00100402'
   Controls : 14
   Simple ctrls : 9
Card1.Amixer.info:
 Card hw:1 'default'/'Generic USB Audio Device at usb-0000:00:1d.0-1, full speed'
   Mixer name : 'USB Mixer'
   Components : 'USB0d8c:000e'
   Controls : 7
   Simple ctrls : 3
Date: Tue Jun 21 14:18:56 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release i386 (20110427.1)
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=en_US:en
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/tcsh
SourcePackage: alsa-driver
Symptom: audio
Symptom_AudioUsers: pulse
Symptom_Card: Internal Audio - HDA Intel
Symptom_DevicesInUse: 6475 6475/dev/snd/controlC0: geddis F.... pulseaudio
Symptom_Jack: Green Headphone Out, Front
Symptom_Type: Sound works for some users but not for others
Title: [HDA-Intel - HDA Intel, playback] sound not working for all users
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 06/28/2010
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 080015
dmi.board.asset.tag: To Be Filled By O.E.M.
dmi.board.name: B10IE01
dmi.board.vendor: Shuttle
dmi.board.version: To be filled by O.E.M.
dmi.chassis.asset.tag: To Be Filled By O.E.M.
dmi.chassis.type: 3
dmi.chassis.vendor: Shuttle
dmi.chassis.version: To Be Filled By O.E.M.
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr080015:bd06/28/2010:svnStandard:pnXS35:pvrToBeFilledByO.E.M.:rvnShuttle:rnB10IE01:rvrTobefilledbyO.E.M.:cvnShuttle:ct3:cvrToBeFilledByO.E.M.:
dmi.product.name: XS35
dmi.product.version: To Be Filled By O.E.M.
dmi.sys.vendor: Standard

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu alsa-driver Edit question
Assignee:
No assignee Edit question
Solved by:
Don Geddis
Solved:
Last query:
Last reply:

This question was originally filed as bug #800416.

This question was reopened

Revision history for this message
Don Geddis (don-geddis) said :
#1
Revision history for this message
Luke Yelavich (themuso) said :
#2

You need to conigure pulseaudio to run system wide. This can be done in /etc/default/pulseaudio. That file also has other information that will be of interest to the configuration you are trying to achieve.

Revision history for this message
Don Geddis (don-geddis) said :
#3

Thanks Luke Yelavich, that solved my question.

Revision history for this message
Don Geddis (don-geddis) said :
#4

I take it back. My test wasn't doing what I thought.

I have (now) configured pulseaudio to run "system wide". Indeed, when I boot the machine, and ssh in from the outside, I see a pulseaudio daemon running.

However, there are still no alsa devices (from "aplay -L") or even cards (from "aplay -l"). Unless I log in from the desktop. (And they still go away when I log out from the desktop.)

There's clearly something that happens when X11 starts, which populates the alsa sound devices. Something more (apparently) than just starting the pulseaudio daemon. (And stopping X -- by logging out of the desktop -- gets rid of the alsa sound devices.)

Any other ideas? (Or anyone else have an idea?)

Revision history for this message
Don Geddis (don-geddis) said :
#5

I fixed my problem! Reading through the sound FAQ on the Ubuntu forums <http://ubuntuforums.org/showthread.php?t=205449>, somewhere in the middle I see "Adding the current user to the audio group". I check my /etc/group, and indeed find the line "audio:x:29:pulse". Just pulseaudio, not myself. I add ",geddis" to the end of that line, reboot the machine, log in from a shell (but NOT the console) ... and it all works now! ALSA devices properly populated, I can play music.

I have no idea why logging in X11 via the console overrides this problem, nor why my default setup of Ubuntu 11.04 mis-configured my /etc/group file for sound. Nor why nobody else seems to have ever had this problem.

But at least I finally have a solution. Add my own username to the "audio" group in /etc/group.