No sound when logged in as root

Post here if you are a new Porteus member and you're looking for some help.
Sam33443344
White ninja
White ninja
Posts: 6
Joined: 18 Nov 2023, 14:40
Distribution: Porteus 5

No sound when logged in as root

Post#1 by Sam33443344 » 22 Nov 2023, 05:27

I don't get any sound when I use the cheatcode login=root. When I login as guest everything is fine. Mute, volume up and down keys are not working. Please help me fix this.

Following are the results that I got from entering various commands

Code: Select all

root@porteus:~# aplay -l | grep card
card 0: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
card 1: Generic [HD-Audio Generic], device 0: ALC3227 Analog [ALC3227 Analog]

Code: Select all

root@porteus:~# lsmod | grep snd
snd_ctl_led            20480  0
snd_hda_codec_realtek   118784  1
snd_hda_codec_generic    61440  1 snd_hda_codec_realtek
snd_hda_codec_hdmi     53248  1
ledtrig_audio          12288  2 snd_ctl_led,snd_hda_codec_generic
snd_hda_intel          32768  0
snd_intel_dspcfg       24576  1 snd_hda_intel
snd_hda_codec         102400  4 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_realtek
snd_hda_core           53248  5 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek
snd_hwdep              12288  1 snd_hda_codec
snd_pcm                86016  4 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_core
snd_timer              28672  1 snd_pcm
led_class              12288  4 snd_hda_codec_generic,input_leds,hp_accel,rtl8xxxu

Code: Select all

root@porteus:~# alsactl init
alsa-lib parser.c:242:(error_node) UCM is not supported for this HDA model (HDA ATI HDMI at 0xf0b40000 irq 40)
alsa-lib main.c:1405:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -6
Found hardware: "HDA-Intel" "ATI R6xx HDMI" "HDA:1002aa01,00aa0100,00100500" "0x103c" "0x2170"
Hardware is initialized using a generic method
alsa-lib parser.c:242:(error_node) UCM is not supported for this HDA model (HD-Audio Generic at 0xf0b44000 irq 41)
alsa-lib main.c:1405:(snd_use_case_mgr_open) error: failed to import hw:1 use case configuration -6
Found hardware: "HDA-Intel" "Realtek ALC3227" "HDA:10ec0282,103c2170,00100003" "0x103c" "0x2170"
Hardware is initialized using a generic method

Code: Select all

root@porteus:~# alsamixer
ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused

cannot open mixer: Connection refused

Code: Select all

root@porteus:~# start-pulseaudio-x11
E: [pulseaudio] main.c: Daemon startup failed.
When I try to play an audio file in Audacious I get this
ALSA error: snd_pcm_open failed: Connection refused.

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

No sound when logged in as root

Post#2 by Rava » 26 Nov 2023, 06:49

Please post the output of this command:

Code: Select all

cat /etc/porteus/*
Which DE are you using? In my Xfce 4.16 based 5.01 Porteus (same with Porteus 5.0) I do not get any audio as user root. This is bugging me for many many months but I have not found a solution to the issue yet.
Cheers!
Yours Rava

donald
Full of knowledge
Full of knowledge
Posts: 2073
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

No sound when logged in as root

Post#3 by donald » 26 Nov 2023, 15:17

@Rava
In my Xfce 4.16 based 5.01 Porteus....I do not get any audio as user root.
???

Image

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

No sound when logged in as root

Post#4 by Rava » 26 Nov 2023, 15:28

^
Do you also get sound via ffplay or mp123 or mpv via the root terminal?

Code: Select all

root@rava:~# file test.webm 
test.webm: Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1, 128 kbps, 48 kHz, Stereo
root@rava:~# mpg123 test.webm
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
	version 1.29.3; written and copyright by Michael Hipp and others
	free software (LGPL) without any warranty but with best wishes


Terminal control enabled, press 'h' for listing of keys and functions.

Playing MPEG stream 1 of 1: test.webm ...

MPEG 1.0 L III vbr 48000 j-s

It looks like it is playing the sound file, but no sound is audible.

Do I have to somehow set the fallback sound device for root as well as I need to do for user guest?

If so, how do I do that? The sound xfce4-pulseaudio-plugin is only available for guest via the panel.

And the root terminal I started the above is now messed up. mpg123 would not react to any keys, so quitting mpg123 via "q" is not possible.
Killing it via

Code: Select all

killall mpg123
did result in this:

Code: Select all

MPEG 1.0 L III vbr 48000 j-s


mpg123: death by SIGTERM


As you can see, there is no bash prompt visible because there is none. I have no clue in what kind of undefined state that root terminal is in right now, but all I can think of is closing it and opening a new one.

Added in 9 minutes 54 seconds:
Closing that tab in xfce4-terminal results in this warning:
Image
I would love to know which program is still running. (Aside from bash)

Added in 3 minutes 52 seconds:
Trying the same via ffplay was not that catastrophic. I could not close the non-sound-playing window via the Close button, but at least I could kill the process via Ctrl+C and the bash came back:

Code: Select all

root@rava:~# ffplay -hide_banner test.webm 
Input #0, mp3, from 'test.webm':   0KB vq=    0KB sq=    0B f=0/0   
  Metadata:
    encoder         : Lavf58.76.100
  Duration: 01:03:39.46, start: 0.023021, bitrate: 128 kb/s
  Stream #0:0: Audio: mp3, 48000 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc58.13
^Croot@rava:~# ^C00 fd=   0 aq=   16KB vq=    0KB sq=    0B f=0/0    
root@rava:~# ^C
root@rava:~# ^C
root@rava:~# 
Added in 1 minute 45 seconds:
And mpv gives me a "The stream is suspended. Bailing out." message and I am not able to start playing the stream, it stays on pause. And it quits nice and clean via q.

Code: Select all

root@rava:~# mpv test.webm 
 (+) Audio --aid=1 (mp3 2ch 48000Hz)
[ao/pulse] The stream is suspended. Bailing out.
AO: [alsa] 48000Hz stereo 2ch float
A: -00:00:00 / 01:03:39 (0%) Cache: 3819s/135MB

Exiting... (Quit)
root@rava:~# 
still, no sound via root terminal. :crazy:
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

No sound when logged in as root

Post#5 by Rava » 26 Nov 2023, 15:51

Playing sound file via a terminal program as root (preferable mpg123 or mpv since I do not want any GUI to open when playing a short notification sound) was possible somewhere in the Porteus5.0 rc??? stage, but it stopped working and has not worked ever since.

Using su guest -c 'mpv test.webm' also fails:

Code: Select all

root@rava:~# mv test.webm /tmp/
root@rava:~# cd /tmp/
root@rava:/tmp# ls -l test.webm 
-rw-r--r-- 1 guest users 61111725 2022-09-14 01:22 test.webm
root@rava:/tmp# su guest -c 'mpv test.webm'
 (+) Audio --aid=1 (mp3 2ch 48000Hz)
ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused

[ao/alsa] Playback open error: Connection refused
[ao] Failed to initialize audio driver 'alsa'
Could not open/initialize audio device -> no sound.
Audio: no audio

Exiting... (Errors when loading file)
root@rava:/tmp# 
but the same file plays okay via a native guest terminal.

Code: Select all

guest@rava:~$ mpv /tmp/test.webm 
 (+) Audio --aid=1 (mp3 2ch 48000Hz)
AO: [pulse] 48000Hz stereo 2ch float
A: 00:00:04 / 01:03:39 (0%) Cache: 3814s/135MB

Exiting... (Quit)
guest@rava:~$ 
This time, a sound is audible.
Cheers!
Yours Rava

donald
Full of knowledge
Full of knowledge
Posts: 2073
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

No sound when logged in as root

Post#6 by donald » 26 Nov 2023, 16:29

playing audio in root terminal -- I mean xfce4-terminal or xterm..
ffplay work
mpg123 work
pulseaudio panel plugin work > open mixer > configuration > chose analog output
( It says unavailable but that's BS)
so yes, it works for me -- unless you are talking about a root tty.

EDIT
I am logged in as root - via cheat-code login=root or from guest logout/back in as root.
If you are guest and su to root in a terminal audio (pulseaudio) is not supposed to work
as far as I understand:
https://www.freedesktop.org/wiki/Softwa ... ystemWide/
https://www.freedesktop.org/wiki/Softwa ... ystemWide/

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

No sound when logged in as root

Post#7 by Rava » 26 Nov 2023, 20:02

donald wrote:
26 Nov 2023, 16:29
I am logged in as root - via cheat-code login=root or from guest logout/back in as root.
If you are guest and su to root in a terminal audio (pulseaudio) is not supposed to work
as far as I understand
Yes, I am indeed logged in as root via

Code: Select all

su -
You mean via cheat-code login=root so that the whole DE session is owned by root?

Nope, not doing that.

guest logout/back in as root
When I log out as guest then this tab is closed. How does that work?

Or did you mean, use su - and log out as root and use su - once more?

Code: Select all

guest@rava:~$ su -
Password: 
root@rava:~# 
logout
guest@rava:~$ su -
Password: 
root@rava:~# cd /tmp/
root@rava:/tmp# mpv test.webm 
 (+) Audio --aid=1 (mp3 2ch 48000Hz)
[ao/pulse] The stream is suspended. Bailing out.
AO: [alsa] 48000Hz stereo 2ch float
(Paused) A: -00:00:00 / 01:03:39 (0%) Cache: 3818s/135MB

Exiting... (Quit)
root@rava:/tmp# 
That is also not working.


https://www.freedesktop.org/wiki/Softwa ... ystemWide/ states
All users that need access to PulseAudio have to be in the pulse-access group, even root.
(highlighting by me)
I have to check if root has these privileges.
https://www.freedesktop.org/wiki/Softwa ... ystemWide/ not mentions "root"

Sam33443344
White ninja
White ninja
Posts: 6
Joined: 18 Nov 2023, 14:40
Distribution: Porteus 5

No sound when logged in as root

Post#8 by Sam33443344 » 27 Nov 2023, 03:12

Yes, I am using Xfce 4.16 based 5.01 Porteus 64-bit.

Code: Select all

root@porteus:-#  cat /etc/porteus/*
001-core.xzm:20230922
002-xorg.xzm:20231001
002-xtra.xzm:20230922
003-xfce.xzm:20230922

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

No sound when logged in as root

Post#9 by Rava » 28 Nov 2023, 02:05

Sam33443344 wrote:
27 Nov 2023, 03:12
using Xfce 4.16
thought so you using Xfce.
Rava wrote:
26 Nov 2023, 20:02
All users that need access to PulseAudio have to be in the pulse-access group, even root.
No pulse-access group in /etc/group but two hits for pulse:

Code: Select all

root@rava:~# grep pulse-access /etc/group 
root@rava:~# grep pulse /etc/group 
audio:x:17:pulse,guest
pulse:x:65:
root@rava:~# 
So, does one change the line

Code: Select all

 audio:x:17:pulse,guest
to

Code: Select all

audio:x:17:pulse,guest,root
put /etc/group into persistence and reboot?

Added in 13 hours 56 minutes 11 seconds:
I did not reboot but checked another thing: just played the same test audio file as seen above as guest as mpg, mpg123 and ffplay and checked its %CPU & %MEM via top:

Code: Select all

guest@rava:/$ echo "  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND"
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
guest@rava:/$ top -bn 1 |grep mpv
30016 guest     20   0 1104092  72004  43852 S   5.9   1.8   0:04.10 mpv
guest@rava:/$ top -bn 1 |grep mpg
30041 guest     20   0  347052   6912   5916 S   5.9   0.2   0:00.42 mpg123
guest@rava:/$ top -bn 1 |grep ffplay
30198 guest     20   0 1119088  72672  48252 S   6.2   1.8   0:01.07 ffplay
As you see, mpg123 wins when it comes to efficiency, but it cannot play as many formats as mpv or ffplay support.

I also made the window of ffplay smaller and switched it to waves instead of rdft display it showed by default.
The initial echo line is for easy reference.
Cheers!
Yours Rava

Sam33443344
White ninja
White ninja
Posts: 6
Joined: 18 Nov 2023, 14:40
Distribution: Porteus 5

No sound when logged in as root

Post#10 by Sam33443344 » 04 Dec 2023, 12:38

Sorry for such a late response.
I managed to fix the issue by removing the palemoon browser module from the base folder in the iso.
I figured out that before modifying the iso the sound was fine, but after adding some modules and making changes in the cfg file, the sound was gone.
I use ventoy to run porteus directly from the iso.
Last edited by Sam33443344 on 05 Dec 2023, 11:55, edited 1 time in total.

User avatar
Ed_P
Contributor
Contributor
Posts: 8374
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

No sound when logged in as root

Post#11 by Ed_P » 04 Dec 2023, 17:51

Thank you for the update Sam. :good:
Ed

Post Reply