0

I have such a malfunction: after coming out of sleep, the sound disappears on the PC (in chromium). It can be solved if you type the pulseaudio -k command in the terminal. But in order not to enter it every time, I made a script:

#!/bin/bash
pulseaudio -k

I did everything as in this answer, but it didn't work. I get the message in the log:

E: [pulseaudio] main.c: The daemon could not shut down: There is no such process

At the same time, if you enter it in the console after that: pulseaudio -k, the command is executed without error and the sound appears.

What am I doing wrong?

P.S.

User service:

[Unit]
Description=Run my_script_pulse
After=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
#After=sleep.target

[Service] #Type=oneshot #Type=forking ExecStart=/usr/local/bin/st_pulse #ExecStart=/home/paul/st_pulse.sh #User=paul #Environment=DISPLAY=:0 StandardOutput=file:/home/paul/log_file

[Install] WantedBy=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target #WantedBy=sleep.target

sapeg
  • 101
  • On systemctl --user restart pulseaudio.service, I get: Failed to connect to bus: There is no such file or directory – sapeg Jan 27 '24 at 15:34
  • Although I suspect it's because I haven't created a custom service. Then I'll try to do it later. – sapeg Jan 27 '24 at 15:43
  • I have created a custom service (see p.s.), but it does not start after waking up. And judging by this answer (https://unix.stackexchange.com/a/174837/514842), in principle, this method is not supported by the system. I mean, the user does not have access to system processes such as suspend.target. – sapeg Jan 30 '24 at 18:15
  • don-crissti No. – sapeg Jan 31 '24 at 04:00
  • Well, there's also this_one which is similar to what you have in your script... if that doesn't work either then I don't know what else to advise. Sorry. – don_crissti Jan 31 '24 at 10:36
  • don-crissti thanks for the reply. I'll try it later. But so far, all these user services don't even start when PC wake up from sleep. In principle, this is not particularly critical, because it is treated from the command line. In my free time, I try to play with different parameters. – sapeg Jan 31 '24 at 18:32

0 Answers0