Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pulseaudio: Cannot connect to system-wide pulseaudio after activating new NixOS system configuration #114399

Closed
queezle42 opened this issue Feb 25, 2021 · 7 comments

Comments

@queezle42
Copy link
Contributor

Describe the bug
When activating a new system configuration (without a reboot) update-users-groups.pl#L216 (triggered by users.users.pulse.createHome) will wipe permissions of /run/pulse, making it impossible to connect to pulseaudio until the permissions are fixed or the service is restarted.

Forcing 700-permissions for home directories is a reasonable secure default (especially for normal users), but should definitely be configurable. I think the best solution would therefore be to create a users.users.<name>.homePermissions-Option and configure it to 755 for the pulse-user.

To Reproduce
Steps to reproduce the behavior:

  1. Configure hardware.pulseaudio.systemWide = true
  2. Create the pulse-access-group (users.groups.pulse-access = {};), add a user to it (users.users.someone.extraGroups = ["pulse-access"])
  3. Users in the pulse-access-Group should be able to connect to pulseaudio (test by e.g. starting pulsemixer)
  4. Reconfigure your system using e.g. nixos-rebuild test
  5. Users are no longer able to connect to pulseaudio

Temporary fix

system.activationScripts.fix-pulse-permissions = ''
  chmod 755 /run/pulse
'';

Notify maintainers
nixos/modules/config/pulseaudio.nix has no meta section, please help?

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 5.11.0, NixOS, 21.05.20210217.6b1057b (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.4pre20201205_a5d85d0`
 - nixpkgs: `/nix/store/srvplqq673sqd9vyfhyc5w1p88y1gfm4-source`

My nixpkgs revision is actually 6b1057b452c55bb3b463f0d7055bc4ec3fd1f381

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
- hardware.pulseaudio.systemWide
- users.users.<name>.createHome
# a list of nixos modules affected by the problem
module:
- nixos/modules/config/pulseaudio.nix
- nixos/modules/config/update-users-groups.pl
@stale
Copy link

stale bot commented Aug 28, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 28, 2021
@queezle42

This comment was marked as off-topic.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 28, 2021
@stale

This comment was marked as off-topic.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 28, 2022
@WesleyAC
Copy link

Not stale. Also the homeMode option exists now so I think this should be easy?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 13, 2022
@WesleyAC
Copy link

indeed, users.users.pulse = { homeMode = "755"; }; seems to work.

@queezle42
Copy link
Contributor Author

@WesleyAC That looks like the correct fix and should be added to the Pulseaudio module. I have switched to Pipewire since I opened the issue, are you interested in creating the PR?

lgoette added a commit to lgoette/nixpkgs that referenced this issue Nov 28, 2023
When pulseaudio runs in systemWide mode, other processes need access to the home directory of the pulse user, to access the pulse daemon

Fixes NixOS#114399
@lgoette lgoette mentioned this issue Nov 28, 2023
13 tasks
@lgoette
Copy link
Contributor

lgoette commented Nov 28, 2023

Im so glad I found this thread. I was searching a long time for the reason why my services that use pulse try the nonSystemwide method when systemWide is active. I was at the point where I noticed it breaks on rebuilding and restarting the daemon fixes it. I never found the thing, the startscript of the daemon changes. This is exactly it! I just opened a pullrequest :)

lgoette added a commit to lgoette/nixpkgs that referenced this issue Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants