Steve's blog
   


Steve About
Steve's blog,
The Words of the Sledge
steve@einval.com

Subscribe
Subscribe to the RSS feed.

Links

  • Home
  • Debian
  • PlanetDebian
  • Search PlanetDebian
  • Friends

  • Matthew Garrett
  • Jonathan McDowell
  • Jo McIntyre
  • Martin Michlmayr
  • Andrew Mobbs
  • Mike Pitt
  • Daniel Silverstone
  • Andy Simpkins
  • Neil Williams

  •        
    Friday, 12 November 2010

    Using pulseaudio in a chroot

    (Mainly for my own information, so I can find this again later!)

    I'm running Debian Squeeze on my Lenovo Thinkpad X200 laptop, using the amd64 version so that I can make the most of the 64-bit CPU. However, I also need a range of 32-bit apps too for now, typically proprietary rubbish like the Flash plug-in for Firefox^WIceweasel. So I set up a 32-bit chroot with a small Debian installation in there too. (Roll on multi-arch!) That's been working ok for a while, except that I couldn't get working audio in my browser. I didn't really pay much attention to that until recently: I wanted to watch some videos on YouTube and the sound mattered!

    After some digging, it became clear that Iceweasel inside the chroot just wasn't talking to the currently-running pulseaudio server outside the chroot. I had installed all the required libs in the chroot too, but still no joy. After some searching (thanks to the folks on the Archlinux wiki for this!) I've now been able to configure my chroot correctly. 2 bits needed:

    1. Configure alsa in the chroot to use pulse by default by creating/editing /etc/asound.conf:

    pcm.pulse {
        type pulse
    }
    ctl.pulse {
        type pulse
    }
    pcm.!default {
        type pulse
    }
    ctl.!default {
        type pulse
    }
    

    2. The dbus machine ID in the chroot needs to be the same as that of the main host, which it wasn't for me. That caused audio apps to report "connection refused" when I tested them. The machine ID is stored in /var/lib/dbus/machine-id. Either copy that file from the host system into the chroot, or add /var/lib/dbus as a bind-mount along with the usual suspects like /home and /tmp.

    Job done, I can watch movie trailers etc. with sound in my browser. Yay! :-)

    17:46 :: # :: /debian/misc :: 5 comments