You are not logged in.

#1 2013-10-23 10:06:03

Raimundo
Member
Registered: 2013-10-21
Posts: 14

Pulseaudio and systemd --user: DBus scope issues?

Hi,

I have a multi-seat setup, so I need user-wide pulseaudio and whatnot. I'm trying to setup my boot through systemd --user.
Testing audio working apps are firefox, mpv, and mpd. The problem is:

- If I start pulseaudio and mpd manually everything is fine (no use of systemd)
- If I start pulseaudio through systemd no application has sound.
- If I start pulseaudio and mpd through systemd only mpd has sound.

raimundoyamtech~$ cat .config/systemd/user/pulseaudio.service 
[Unit]
Description=PulseAudio Sound System
After=sound.target
[Service]
ExecStart=/usr/bin/pulseaudio
[Install]
WantedBy=multi-user.target

raimundoyamtech~$ cat .config/systemd/user/mpd.service 
[Unit]
Description=Music Player Daemon
After=network.target sound.target
[Service]
ExecStart=/usr/bin/mpd %h/.config/mpd/mpd.conf --no-daemon
ExecStop=/usr/bin/mpd %h/.config/mpd/mpd.conf --kill
Restart=always
[Install]
WantedBy=multi-user.target

If I add BusName=org.pulseaudio.Server to the pulseaudio.service nothing changes.
Using pulseaudio's autospawn=yes leads to what seems to be same behaviour: mpd by systemd starts pulseaudio and is the only app with sound.
./config/pulse/client.conf only contains default-sink. Everything else is default.
Using alsa alone is not an option because of firefox.

Any thoughts?

EDIT:

raimundoyamtech~$ systemctl --version
systemd 208
+PAM -LIBWRAP -AUDIT -SELINUX -IMA -SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ
raimundoyamtech~$ pulseaudio --version
pulseaudio 4.0

Last edited by Raimundo (2013-10-23 10:08:13)

Offline

#2 2013-10-29 13:13:22

Raimundo
Member
Registered: 2013-10-21
Posts: 14

Re: Pulseaudio and systemd --user: DBus scope issues?

Bump!

Why is it that only 10% of my posts get an answear?
Is this such a specific issue that no one ever encountered it?
What If I change the question to:
    How do I start a user-instance of Pulseaudio (don't care if it's through systemd) that actually works and communicates with other apps? (EDIT: At system boot or user login! .profile isn't suitable because I use tmux)

Last edited by Raimundo (2013-10-29 13:16:03)

Offline

#3 2013-10-29 13:25:49

jrussell
Member
From: Cape Town, South Africa
Registered: 2012-08-16
Posts: 510

Re: Pulseaudio and systemd --user: DBus scope issues?

As far as I know, pulse starts up from a .desktop file somewhere in /etc/xdg or .conf/autostart, Im not sure how the autostarting works with .desktop files but just thought I'd mention it.

Edit: I dont think the first pulseaudio.service file there is per user, I think that would start pulse globally as root, and I dont think it can do that.

Last edited by jrussell (2013-10-29 13:27:39)


bitcoin: 1G62YGRFkMDwhGr5T5YGovfsxLx44eZo7U

Offline

#4 2013-10-29 14:43:14

Raimundo
Member
Registered: 2013-10-21
Posts: 14

Re: Pulseaudio and systemd --user: DBus scope issues?

Yes, but I don't want it to start when I start X, I want it to start at system boot so .desktop files won't do AFAIK.
On my system pulse didn't start. It just had the autospawn=yes on by default, but as I explained that doesn't work well for me.

Also with this pulseaudio.service the pulseaudio instances appear, and each has their correct user and configurations, so I assume that part at least is correct.

Still, I apreciate the answear smile and I might take a better look at xdg and even the autospawn. Maybe I can start mpd some other way which in turn starts pulseaudio automagically.

EDIT: xdg starts with DE.. I don't even use a DE, might as well start things with .xinitrc.

Last edited by Raimundo (2013-10-29 14:45:15)

Offline

#5 2013-10-29 15:18:00

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: Pulseaudio and systemd --user: DBus scope issues?

Raimundo wrote:

Bump!

Why is it that only 10% of my posts get an answear?
Is this such a specific issue that no one ever encountered it?

Please do not bump.   I understand the frustration; really, I do.  But, these are very active forums with some very good technical people lurking about.  I guarantee your post had been read.  I read it.  I did not have an answer, as I have never seen that behavior afore.   I am certain that was true for many other regulars.

In the future, you can bring focus to a thread by providing more information..  Tell us what you have tried, what you have read since the last post, etc.  At least it gives the impression that you are working the problem rather than merely waiting for a response. 

I've a hunch the issue is your not having an active session.    What is the output of loginctl show-session 1   (I assume your session number is 1.  You can see the active sessions with loginctl list-sessions )
Verify the session trying to make sound is active (according to loginctl).


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#6 2013-10-29 15:58:30

Raimundo
Member
Registered: 2013-10-21
Posts: 14

Re: Pulseaudio and systemd --user: DBus scope issues?

ewaller wrote:

Please do not bump.   I understand the frustration; really, I do.  But, these are very active forums with some very good technical people lurking about.  I guarantee your post had been read.  I read it.  I did not have an answer, as I have never seen that behavior afore.   I am certain that was true for many other regulars.

In the future, you can bring focus to a thread by providing more information..  Tell us what you have tried, what you have read since the last post, etc.  At least it gives the impression that you are working the problem rather than merely waiting for a response.

I don't know almost anything about systemd, especially because it changes so rapidly and documention is so scarce and outdated that either I read the whole documentantion for my version in hopes of finding my problem (something for which I do not have time) or post a topic.
I posted everything I touched regarding systemd since the installation of my system, that's all the relevant information I know I can give, so at this point I had no more info to give.
Actually posting a topic is really my last resort, it usually means that I have already tried everything I knew and I'm hopeless already.

raimundoyamtech~$ loginctl list-sessions
   SESSION        UID USER             SEAT            
         2       1002 carla            seat0           
         1       1000 raimundo         seat0           

2 sessions listed.
raimundoyamtech~$ loginctl show-session 1
Id=1
Timestamp=Tue 2013-10-29 12:33:47 WET
TimestampMonotonic=6670234
VTNr=1
TTY=tty1
Remote=no
Service=login
Scope=session-1.scope
Leader=1456
Audit=1
Type=tty
Class=user
Active=no             <----- Is this what you are talking about?
State=online
IdleHint=yes
IdleSinceHint=1383050072367636
IdleSinceHintMonotonic=0
Name=raimundo
raimundoyamtech~$ loginctl show-session 2
Id=2
Timestamp=Tue 2013-10-29 12:33:47 WET
TimestampMonotonic=6667439
VTNr=2
TTY=tty2
Remote=no
Service=login
Scope=session-2.scope
Leader=1453
Audit=2
Type=tty
Class=user
Active=no             <----- Is this what you are talking about?
State=online
IdleHint=yes
IdleSinceHint=1383050025387636
IdleSinceHintMonotonic=0
Name=carla
raimundoyamtech~$ loginctl show-session 3
Failed to issue method call: No such file or directory

What is an active session? Oo Never heard of it
I could start things. Pulseaudio started, so did mpd. I also have a /usr/lib/systemd/systemd --user process started for each user. I assumed this would be it since this

raimundoyamtech~$ systemctl --user
Failed to issue method call: Process /bin/false exited with status 1

always happens and I've read that systemctl --user is no longer required.
[EDIT]
Fixed it. Don't remember where I read that it wasn't required, just that it was in the same place I found someone else complaining about getting this error.
For anyone else encountering this: sed -i s/system-auth/system-login/g /etc/pam.d/systemd-user
and systemctl --user will work. Insults fly out to the one who wrote it wasn't required!
Still am not able to get an active session though
[/EDIT]
Why would there be a need for anything else? tongue I'm gonna check on that. Thanks!

See, the bump worked ^^ but ok I'll try to refrain from doing that next time. Sorry.

Last edited by Raimundo (2013-10-29 16:27:55)

Offline

#7 2013-10-29 16:27:47

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: Pulseaudio and systemd --user: DBus scope issues?

Raimundo wrote:

....systemd, especially because it changes so rapidly and documention is so scarce and outdated that either I read the whole documentantion for my version in hopes of finding my problem (something for which I do not have time) or post a topic.

I respectfully disagree, but anyway....

Active=no             <----- Is this what you are talking about?
Active=no             <----- Is this what you are talking about?

What is an active session? Oo Never heard of it

Yes, that is what I am talking about,  The idea is that there can be multiple sessions logged in at once.  Whichever session is active is the one that will have permission to use the sound system.
How do you log in to your system?

See, the bump worked ^^ but ok I'll try to refrain from doing that next time. Sorry.

tongue
The trick is, don't say 'bump'.  It really does not help.  If nothing else, assume that people have looked at the thread, and ask the forums what additional information might be useful.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#8 2013-10-29 16:50:40

Raimundo
Member
Registered: 2013-10-21
Posts: 14

Re: Pulseaudio and systemd --user: DBus scope issues?

ewaller wrote:

Yes, that is what I am talking about,  The idea is that there can be multiple sessions logged in at once.  Whichever session is active is the one that will have permission to use the sound system.
How do you log in to your system?

There are 2 flaws in that design (IMHO):
  I have 2 sound cards. And I want each associated with a seat (the notion of seat in systemd is bad because it requires multiple graphics cards according to http://www.freedesktop.org/wiki/Softwar … multiseat/ so I can't use it).
  The other case is I want to give a user access to the sound card regardless or not if he's there.

I login like this (removed the comments):

[Unit]
Description=Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
After=systemd-user-sessions.service plymouth-quit-wait.service
Before=getty.target
IgnoreOnIsolate=yes
ConditionPathExists=/dev/tty0

[Service]
ExecStart=-/sbin/agetty --noclear -a raimundo %I 38400 linux
Type=simple
Restart=always
RestartSec=0
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process
IgnoreSIGPIPE=no
Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=
KillSignal=SIGHUP

[Install]
WantedBy=getty.target

It was the recomended way for autologin at the time. Did it change?
I then usually run xinit (I may boot computer remotely and use it, so no xinit) and graphical stuff is in .xinitrc. I do it this way because at one point in time I messed up my xorg.conf and  rendered my computer useless because I could not use my keyboard not even to switch VTs. sshd was not setup. Had to boot from a pen. Don't want to risk it again.

I'm still not being able to get an active session.
https://wiki.archlinux.org/index.php/Systemd/User says "user-session@.service from user-session-units is obsolete now." but does not mention a replacement and (almost) everything after that is based on user-session@.service. Also it depends on xorg-launch-helper, which is not wanted.

Offline

#9 2013-10-29 16:58:49

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: Pulseaudio and systemd --user: DBus scope issues?

I do not recognize that file.  Which file is that?
What if you were to use startx rather than xinit ?

You had not mentioned multiple sound cards.  I've not tried it hmm


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#10 2013-10-29 17:19:53

Raimundo
Member
Registered: 2013-10-21
Posts: 14

Re: Pulseaudio and systemd --user: DBus scope issues?

ewaller wrote:

I do not recognize that file.  Which file is that?

sorry.. forgot that line.. It's /etc/systemd/system/autologin@.service but I don't think it's a default. But I'm pretty sure it was on the archwiki.

ewaller wrote:

What if you were to use startx rather than xinit ?

Why should there be a difference? I want audio before X11. If I needed it later then I would use .xinitrc, which is much simpler then playing around with systemd.
And I can get audio before X11 if I do it manually or if all the programs that want to use pulseaudio are called from systemd. I have no trouble accessing any soundcard through any method whatsoever. I'm just saying because you mentioned the sessions thing.

ewaller wrote:

You had not mentioned multiple sound cards.  I've not tried it hmm

I still don't get what systemd has to do with sound cards. I don't even want systemd! It's just that every recent application seems to depend on it -.- I even had to install systemd on a system that had no boot method or device handling or X11 (or pretty much anything xD I'm talking about chroot in android) so you can get an idea of just how much apps got dependant on systemd! I also don't see the point of things like polkit and rtkit, but that's probably just me.

EDIT: But seriously, can anyone point me to the right direction on getting an active systemd session? https://wiki.archlinux.org/index.php/Systemd/User isn't being very helpful to me. nor respective [3], [4] and [5]

Last edited by Raimundo (2013-10-29 17:48:26)

Offline

#11 2013-10-31 12:02:17

Raimundo
Member
Registered: 2013-10-21
Posts: 14

Re: Pulseaudio and systemd --user: DBus scope issues?

Found this in "Uses" at http://www.freedesktop.org/wiki/Softwar … multiseat/

If you are writing user-level software interfacing directly with kernel drivers (like PulseAudio), consider ignoring seat information completely, and make available to the user all devices he/she can access. A device that a user cannot access is a device that is not assigned to any of the seats he is currently active on.

Indeed I don't have any active seats. Apparently on my system the only way for a session to be active is if I'm currently viewing it's tty. Since X is on tty5 and I login at tty1 and tty2 I never have any sessions active! Now, what can I do? Mind you that I need to have X on a different tty than the login, also I need to have 2 sessions active at the same time. At this point it might be relevant to add more info on my system, this seems to be deeper than I thought:

1 - I login through the method previously mentioned, one user at tty1 and another at tty2. The goal I had in mind was to start everything users had to start tight at boot time. The why will become clearer later.
2 - At tty1 I run xinit. X starts on tty5, runs .xinitrc on screen 0, which in turn runs the .xinitrc of the other user as the other user on screen 1. Through xinput2 and a custom dwm I now have 2 seats active simultaneously though only 1 X. Has a couple of bugs on some programs like assuming Virtual Core devices are actually doing anything, but works for the purposes of this discussion (I think).
3 - I only have 1 graphics card! Hence I can only have 1 X instance running.
4 - As I understood, a seat is supposed to run an X server independent of the one other seats run, so systemd's multiseat is probably useless to me.

I could try and say that both sessions are active if I'm on tty5 but then on tty1 and tty2 they'd be inactive. My goal is to have both sessions active regardless of the tty I'm currently viewing and here's why:
   If audio is dependent on having an active session, since I have to sound cards and one is attached to wireless headphones I can have that user listening to music (the tty2 user) while viewing tty5 OR tty1! (And yes this situation has happened)

Is there a way to detach pulseaudio started through systemd from a session so it can be accessed normally?
Since D-Bus is part of systemd how come when I start pulseaudio from tty1 manually it runs ok? Shouldn't D-Bus detect which user it's from and automatically associate to it's session just to have a consistent behaviour?
There's too much black boxes in here for me. systemd devs seem (to me) to have way too much control on what I can do and how I can do it.

Offline

Board footer

Powered by FluxBB