4

I'm using debian 9 with gnome.
When i use the root the volume control doesn' t work and doesn' t have the megaphone symbol (that is also missing in the gnome panel). I can move the bar but doesn` t affect the volume.

enter image description here

In Settings/Sound there aren' t any output/input devices.
There aren't any system sounds like when you keep deleting in the terminal or when you using fn + the volume controls that aren' t working.
Fn keys are working for the others functions but not for the audio.
Except for the system sounds the audio is working and i can set the volume using alsa-mixer (that isn' t practical).

If i use a normal user everything is fine: the volume control (in the gnome panel) works and has the megaphone symbol, system sounds are working, fn keys for the audio are working and in Settings/Sound there are the output/input devices.

How can i have fix the audio for the root?

Don' t tell me that is dangerous and why i want log in as root.
I really wish to do so.
From the comments i can see that dirkt states:

Pulseaudio by default only works with a logged-in user, by design

Any idea to how fix pulseaudio?

4
  • 4
    Why are you using desktop/audio as root?
    – sebasth
    Commented Oct 7, 2018 at 11:04
  • 2
    Pulseaudio by default only works with a logged-in user, by design. Don't use a desktop as root, it's bad practice. Use sudo as normal user for system administration.
    – dirkt
    Commented Oct 7, 2018 at 11:22
  • @dirkt i want to use root, there is a solution for pulseaudio?
    – Scorpion
    Commented Oct 7, 2018 at 12:07
  • The part about how user aliases/renames root is not relevant. The duplicate similarly asks about audio not working for root desktop. For allowing regular users access /root you can post another question.
    – sebasth
    Commented Oct 7, 2018 at 13:49

1 Answer 1

5

Too bad that you didn' t know that all those problems are caused by pulseaudio.
If you run in a terminal pulseaudio you will see something like this:

W: [pulseaudio] main.c: This program is not intended to be run as root (unless --system is specified).

If you run pulseaudio --system won' t work (at least on my system), I don' t know if there is any proper solution.
But there is a very simple and perfect workaround use only pulseaudio:

  1. Copy this folder /home/normal-user/.config/pulse into your home (/root/.config) from another "normal" user.

  2. In /root/.config/autostart (if the folder doesn't exist create it) make a file with this content:

    [Desktop Entry]
    Type=Application
    Terminal=false
    OnlyShowIn=GNOME;KDE
    Exec=pulseaudio
    Name=pulseaudio
    Comment=Volume/audio controls
    
  3. And name it pulseaudio.desktop (the important thing is the .desktop).
    Double click and you are ok (trust and launch).

    Now every time that you log in (as root) your sound will be fine.

Other GUIs:

It also works for KDE plasma.
If your GUI uses pulseaudio you can add it to the entry OnlyShowIn=.
Or remove that line to always start pulseaudio (on every GUI).

5
  • Doesn't seem to work for me. Should this work if I log into the desktop as a regular user, then su to root and start an audio application from the terminal?
    – Time4Tea
    Commented Mar 22, 2020 at 19:28
  • @Time4Tea This works also on debian 10 gnome, when you login as root. On gnome by default you can' t, I modified the gnome config to allow root to login. If you login as regular user do you need to run audio applications as root?
    – Scorpion
    Commented Mar 28, 2020 at 16:21
  • I never tried it.
    – Scorpion
    Commented Mar 28, 2020 at 16:26
  • I would like to sandbox Skype and Steam with firejail, which requires root privileges to set up the sandbox. I am finding that sound is not working for firejailed applications with pulseaudio.
    – Time4Tea
    Commented Mar 28, 2020 at 20:38
  • unix.stackexchange.com/questions/574308/…
    – Time4Tea
    Commented Mar 28, 2020 at 20:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .