Fixing PulseAudio for CIFS Home Directories

PulseAudio is an open source sound server shipped as default by many Linux distributions, including RHEL and its derivatives.

PulseAudio can run in two modes – standalone daemon or a session-driven agent. The second is preferred (as it supports sound for multiple simultaneously logged users) and is the way it is run on RHEL. The session is spawned by the desktop manager (GUI).

When started as a session agent, PulseAudio creates a temporary directory .pulse inside the home directory of the current user. It insists that this directory has UNIX permissions of 0700.A typical CIFS mount on RHEL (Linux workstation as a domain member in Active Directory environment) with roaming profile mounted as home directory will result in 0770 permissions, breaking PulseAudio. In fact, it is not the permission which will break it, but the fact that they cannot be changed as CIFS does not support file permissions. Using the CIFS UNIX extensions (on by default in modern CIFS implementations for Linux) makes the dir_mode mount option unusable, but disabling these extensions breaks many other things, so it is also not an option.

One way to restore PulseAudio is to make it work when the home directory is mounted with 0770 permissions. Because the restriction is hard-coded, it requires recompiling.

  1. Fetch the source RPM file and install it locally: http://vault.centos.org/6.4/os/Source/SPackages/pulseaudio-0.9.21-14.el6_3.src.rpm
  2. Get the source tarball from the SOURCES directory and extract it somewhere.
  3. Go to the pulseaudio-0.9.21/src/pulsecore directory and edit the core-util.c file.
  4. In the pa_make_secure_dir() function (line 240) remove the check (st.st_mode & 0777) != m) from the IF statement.
  5. Save the file, restore the tarball and return it to the SOURCES directory.
  6. Rebuild with rpmbuild -bb using the original spec file. Don’t forget to bump the build number inside it beforehand!

If you happen to run a multilib environment, you’ll need to rebuild the i686 package too; the easiest way is to use mock and point it to the epel-6-i686 configuration (use the ‘-r’ command-line option).

This entry was posted in Нули и единици. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.