December 25, 2007

Linux audio strikes back

Fedora 7’s new Firewire stuff might not be totally together: when I plugged in my DV cam, I couldn’t read the device except (I guess?) as root. (Kino also kept crashing, and I ended up just using dvgrab.)

Apparent side-effect of running sudo kino: some shared memory used by dmix became owned by root and mod 0600. Thus when you run something like, say, aplay (ALSA configured to use dmix by default), you get “unable to create IPC semaphore” (among some other lines).

My fix:

  1. grep ipc_key /etc/alsa/*. In my case, I see something like /etc/alsa/alsa.conf:defaults.pcm.ipc_key 5678293 (that’s 0x56a4d5).
  2. ipcs -a and look for the IPC key in hex. I had both 0x56a4d5 and 0x56a4d6. I… hope 0x56a4d6 belonged to ALSA because…
  3. First I made sure that the nattach column said 0 for any dmix-related segments/semaphores, then
  4. I used ipcrm -M 0x56a4d5 (and then ipcrm -M 0x56a4d6) to delete those shared memory segments, and ipcrm -S 0x56a4d5 to delete the semaphores (“Semaphore Arrays” is the heading; maybe simply saying “semaphores” is poor form on my part).

Then audio worked.

I am more and more looking forward to Fedora 8 and PulseAudio.

Comments (5)

  1. April 24, 2008
    harmless said...

    I’ve run into “unable to create IPC semaphore” with the same symptom of being able to use it only as root. On a whim I changed my ipc_key, restarted alsa and tada! everything was happy. I suppose there was some kind of bizarre collision? *shrug* … at any rate, I figure I’d put my 2 cents some place as a help to anyone who googles onto this in search of a solution.

  2. July 26, 2009
    Simon Acosta said...

    Hi! I know that this post is kinda old, but while trying to play NWN1 I encounter this error on console:

    ALSA lib pcm_dmix.c:975:(snd_pcm_dmix_open) unable to create IPC semaphore
    Segmentation fault

    And even more, I have been getting problems in Ubuntu Jaunty since forever, sound problems. So, I would like to know if what you did could work for me as well or only in Fedora.


  3. July 27, 2009
    darkness said...

    I think it should work on Ubuntu as well.


  4. August 8, 2009
    diggers said...

    I found that I had a rogue firefox running which had devoured 86% of available ram. Seems my player, audacious, was trying to get a chunk larger than what was left and failing with these IPC problems. mplayer, which I think just buffers a tiny amounnt, worked just fine. Kill -9 process, problem resolved.

  5. June 5, 2010
    chazbot said...

    Enable System V IPC in kernel under General Setup.