Port 5.0 x86-64 (XFCE 4.12): no sound from root terminal

Please reproduce your error on a second machine before posting, and check the error by running without saved changes or extra modules (See FAQ No. 13, "How to report a bug"). For unstable Porteus versions (alpha, beta, rc) please use the relevant thread in our "Development" section.
User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Port 5.0 x86-64 (XFCE 4.12): no sound from root terminal

Post#1 by Rava » 04 Oct 2022, 15:11

I am still unable to run notification sounds (or any sounds) as root. Some scripts need to be run as root and I like them having notification sounds. Sadly, using su guest -c 'soundplaying-program' also fails. See details below.

My system:

Code: Select all

root@porteus:/# cat /etc/porteus/*
001-core.xzm:20220723
002-xorg.xzm:20220723
002-xtra.xzm:20220630
003-xfce4.xzm:20220428
initrd.xz:20201102
As usual, the XFCE 4.12 module reports its version wrong, it is 003-xfce-4.12-20220725 and not 20220428


I tried mpg123 - ffplay - mpv.

The soundfile:

Code: Select all

root@porteus:/# file /usr/local/share/notification_-15dB.mp3
/usr/local/share/notification_-15dB.mp3: MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, Monaural

root@porteus:/# ffprobe /usr/local/share/notification_-15dB.mp3
Input #0, mp3, from '/usr/local/share/notification_-15dB.mp3':
  Duration: 00:00:00.16, start: 0.025057, bitrate: 149 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, mono, fltp, 128 kb/s
    Metadata:
      encoder         : LAME3.100
    Side data:
      replaygain: track gain - 12.100000, track peak - unknown, album gain - unknown, album peak - unknown, 
The attempts as root
Started as root the termNo sound, nothing pops up in Volume Control Playback Tab.inal output looks like it works, but no sound is coming and the Volume Control Playback Tab not shows any application opening during playback (as is the case when started from a native guest terminal)

ffplay:

Code: Select all

root@porteus:/# ffplay -hide_banner /usr/local/share/notification_-15dB.mp3
Input #0, mp3, from '/usr/local/share/notification_-15dB.mp3':0/0   
  Duration: 00:00:00.16, start: 0.025057, bitrate: 149 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, mono, fltp, 128 kb/s
    Metadata:
      encoder         : LAME3.100
    Side data:
      replaygain: track gain - 12.100000, track peak - unknown, album gain - unknown, album peak - unknown, 
   0.06 M-A: -0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   
No sound, nothing pops up in Volume Control Playback Tab.

mpv:

Code: Select all

root@porteus:/# mpv /usr/local/share/notification_-15dB.mp3
 (+) Audio --aid=1 (mp3 1ch 44100Hz)
AO: [pulse] 44100Hz mono 1ch float

Exiting... (End of file)
No sound, nothing pops up in Volume Control Playback Tab.

and mpg123:

Code: Select all

root@porteus:/# mpg123 /usr/local/share/notification_-15dB.mp3
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

Directory: /usr/local/share/

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

Playing MPEG stream 1 of 1: notification_-15dB.mp3 ...

MPEG 1.0 L III cbr128 44100 mono

[0:00] Decoding of notification_-15dB.mp3 finished.
No sound, nothing pops up in Volume Control Playback Tab.

Attemps as su guest -c 'soundplaying-program'
Running it as

Code: Select all

su guest -c 'soundplaying-program'
all fail with errors:

ffplay:

Code: Select all

root@porteus:/# su guest -c 'ffplay -hide_banner /usr/local/share/notification_-15dB.mp3'
Input #0, mp3, from '/usr/local/share/notification_-15dB.mp3':0/0   
  Duration: 00:00:00.16, start: 0.025057, bitrate: 149 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, mono, fltp, 128 kb/s
    Metadata:
      encoder         : LAME3.100
    Side data:
      replaygain: track gain - 12.100000, track peak - unknown, album gain - unknown, album peak - unknown, 
ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused

SDL_OpenAudio (1 channels, 44100 Hz): ALSA: Couldn't open audio device: Connection refused
No more combinations to try, audio open failed
Failed to open file '/usr/local/share/notification_-15dB.mp3' or configure filtergraph
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   
mpv:

Code: Select all

root@porteus:/# su guest -c 'mpv /usr/local/share/notification_-15dB.mp3'
 (+) Audio --aid=1 (mp3 1ch 44100Hz)
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)
and mpg123:

Code: Select all

root@porteus:/# su guest -c 'mpg123 /usr/local/share/notification_-15dB.mp3'
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
[src/libout123/modules/pulse.c:open_pulse():170] error: No PulseAudio running. I will not accidentally trigger starting one.
[src/libout123/libout123.c:check_output_module():982] error: Module 'pulse' device open failed.
[src/libout123/libout123.c:out123_open():482] error: Found no driver out of [pulse] working with device <default>.
main: [src/mpg123.c:check_fatal_output():331] error: out123 error 3: failure loading driver module
________________________________

For comparison, this is how it looks like when done via a guest terminal:

Code: Select all

guest@porteus:/$ ffplay -hide_banner /usr/local/share/notification_-15dB.mp3
Input #0, mp3, from '/usr/local/share/notification_-15dB.mp3':0/0   
  Duration: 00:00:00.16, start: 0.025057, bitrate: 149 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, mono, fltp, 128 kb/s
    Metadata:
      encoder         : LAME3.100
    Side data:
      replaygain: track gain - 12.100000, track peak - unknown, album gain - unknown, album peak - unknown, 
   0.09 M-A: -0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   
Sound plays fine.

Code: Select all

guest@porteus:/$ mpv /usr/local/share/notification_-15dB.mp3
 (+) Audio --aid=1 (mp3 1ch 44100Hz)
AO: [pulse] 44100Hz mono 1ch float

Exiting... (End of file)
Sound plays fine.

Code: Select all

guest@porteus:/$ mpg123 /usr/local/share/notification_-15dB.mp3
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

Directory: /usr/local/share/

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

Playing MPEG stream 1 of 1: notification_-15dB.mp3 ...

MPEG 1.0 L III cbr128 44100 mono

[0:00] Decoding of notification_-15dB.mp3 finished.
Sound plays fine.

In all three instances - ffplay, mpv and mpg123 the program pops up in Volume Control Playback Tab for a very short time (because it's a very short sound file - as reported by ffprobe: "Duration: 00:00:00.16") - when I get my maths right that is 160 milliseconds.

For now I will setup a different boot for using the standard 003-xfce module that is XFCE 4.16 and see if that makes a difference.

Added in 8 minutes 52 seconds:
Any tips on why I cannot play sounds from a root terminal and how to fix that are greatly appreciated! :)
Cheers!
Yours Rava

beny
Full of knowledge
Full of knowledge
Posts: 2086
Joined: 02 Jan 2011, 11:33
Location: italy

Port 5.0 x86-64 (XFCE 4.12): no sound from root terminal

Post#2 by beny » 04 Oct 2022, 16:41

Code: Select all

  root@porteus:/home/guest#  mpv '/usr/local/share/Josh Turner - Country State Of Mind (2020) Mp3 320kbps [PMEDIA] ⭐️/07. Forever And Ever, Amen.mp3' 
 (+) Video --vid=1 [P] 'PMEDIA' (mjpeg 500x500 1.000fps)
     Video --vid=2 [P] 'cover.jpg' (mjpeg 1400x1400 1.000fps) (external)
 (+) Audio --aid=1 (mp3 2ch 44100Hz)
File tags:
 Artist: Josh Turner, Randy Travis
 Album: Country State Of Mind
 Album_Artist: Josh Turner
 Date: 2020-21-08
 Title: Forever And Ever, Amen
 Track: 7
 Uploader: PMEDIA
Displaying cover art. Use --no-audio-display to prevent this.
VO: [gpu] 500x500 yuv420p
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by uid 1000! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by uid 1000! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
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
V: 00:00:00 / 00:03:47 (0%) Cache: 0.0s
                                 
seem a problem of permission you can't use a software that have a different uid with guest account no problem play is ok

beny
Full of knowledge
Full of knowledge
Posts: 2086
Joined: 02 Jan 2011, 11:33
Location: italy

Port 5.0 x86-64 (XFCE 4.12): no sound from root terminal

Post#3 by beny » 04 Oct 2022, 16:48

Code: Select all

      root@porteus:~# mpv '/usr/local/share/Josh Turner - Country State Of Mind (2020) Mp3 320kbps [PMEDIA] ⭐️/01. I'\''m No Stranger To The Rain.mp3' 
 (+) Video --vid=1 [P] 'PMEDIA' (mjpeg 500x500 1.000fps)
     Video --vid=2 [P] 'cover.jpg' (mjpeg 1400x1400 1.000fps) (external)
 (+) Audio --aid=1 (mp3 2ch 44100Hz)
File tags:
 Artist: Josh Turner
 Album: Country State Of Mind
 Album_Artist: Josh Turner
 Date: 2020-21-08
 Title: I'm No Stranger To The Rain
 Track: 1
 Uploader: PMEDIA
Displaying cover art. Use --no-audio-display to prevent this.
VO: [gpu] 500x500 yuv420p
AO: [pulse] 44100Hz stereo 2ch float
AV: 00:00:38 / 00:03:52 (17%) Cache: 193s/11MB

Exiting... (Quit)
root@porteus:~# 



                            
but with a root account you can play song, at system don't like the su root or su guest account

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

Port 5.0 x86-64 (XFCE 4.12): no sound from root terminal

Post#4 by donald » 05 Oct 2022, 18:06

It does - surprisingly - work in 3.2.2
Image

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

Port 5.0 x86-64 (XFCE 4.12): no sound from root terminal

Post#5 by Rava » 05 Oct 2022, 22:58

@beny
What DE did you use?
And I presume your system is Port 5.0 x86-64?

@donald:
I presume your 3.2.2 DE is XFCE 4.12?
When it's XFCE 4.12 then it is either some files missing in my XFCE 4.12, or some setup being messed up, or the connection root-wise playing sounds between XFCE and Port 3.2.2 and XFCE and Port 5.0 is slightly different for my combination to fail.

@both
The issue is, going only by what the terminal output says is less helpful in these instances. Like with my case, using

Code: Select all

su guest -c 'mpg123 /sound.mp3'
gives error messages.
While as root

Code: Select all

mpg123 /sound.mp3
looks like it worked by the terminal output itself, while it produced no sound, nothing pops up in Volume Control Playback Tab - so all 3 programs I tried (ffplay, mpg123, mpv) fail without the terminal giving me a hint why.
Cheers!
Yours Rava

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

Port 5.0 x86-64 (XFCE 4.12): no sound from root terminal

Post#6 by Rava » 13 Oct 2022, 16:42

Now I tried this configuration:

Code: Select all

guest@porteus:~$ cat /etc/porteus/*
001-core.xzm:20221006
002-xorg.xzm:20221006
002-xtra.xzm:20220630
003-xfce.xzm:20220925
initrd.xz:20201102
aka the official most recent XFCE 4.16 module.

At first the sound in the root terminal worked… but only prior the 1st suspend, after that it's the same than with XFCE 4.12.
I would have to start Port 5.0 with XFCE 4.12 if there also sound works in root terminal until suspend.
(I now changed my setup to have in the future bootups the 20220928 initrd)

I have no clue how suspend can interfere with that, but unfortunately that's what's going on.
Cheers!
Yours Rava

beny
Full of knowledge
Full of knowledge
Posts: 2086
Joined: 02 Jan 2011, 11:33
Location: italy

Port 5.0 x86-64 (XFCE 4.12): no sound from root terminal

Post#7 by beny » 13 Oct 2022, 18:43

take a look at pulseaudio maybe do not restart from the suspend and terminal or gui sound server do not work.. task manager or htop when wake up from suspend

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

Port 5.0 x86-64 (XFCE 4.12): no sound from root terminal

Post#8 by Rava » 14 Oct 2022, 01:44

beny wrote:
13 Oct 2022, 18:43
take a look at pulseaudio maybe do not restart from the suspend and terminal or gui sound server do not work.. task manager or htop when wake up from suspend
I look into that, but need to restart first to have the situation prior any suspend.

But
beny wrote:
13 Oct 2022, 18:43
pulseaudio maybe do not restart from the suspend and terminal or gui sound server do not work
how can that be the reason when sound works fine for all GUI programs and for anything a native guest does in a terminal, but nothing root does (nor su guest done by root)
Only portions of pulseaudio or the sound server must be malfunctioning… and catching that vague "only portions" part could be tricky.

It could very well be that the issue is because of the switch from ???? (forgotten the package name) to loginctl - since I recall the issue going back a longer while, back into 5.0rc??? development times.

I try looking for hit results searching the issue on the web… but unfortunately it is quite vague what I can search - it could be a rare issue with my sound hardware config and loginctl, I presume when others of Port 5.0 users have no issue it most probably must be because of my local system.

Sadly, my other x86-64 PC is currently broken, seems I managed to damage its GPU / graphics card during either transport or it standing here more unused than used, because it either gives a very distorted image via PC monitor, or its graphics output fails completely.
And since all my hardware is dated it could pose a serious issue in getting a replacement graphics card since its internal bus is most probably not the most recent architecture. Due to the matter of its issue I cannot even look up info in its BIOS since all output is affected.

One other attempt would be starting test-wise a different DE than my usual XFCE 4.12 or 4.16… but which one to choose?
beny, what would you suggest is the best test platform in my case?
gnome sure not since that is experimental in itself.
KDE5 brings too much own stuff with it in my book to be less helpful in figuring out the issue, because when with KDE5 it turns out after suspend it still works for user root in the console… how can I relate that into fixing my XFCE issue?

Mate?
Cinnamon?

Openbox? LX?? These all have the advantage that they are similar slim as XFCE is. Maybe I should choose one of these.
Cheers!
Yours Rava

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

Port 5.0 x86-64 (XFCE 4.12): no sound from root terminal

Post#9 by Rava » 15 Oct 2022, 03:25

My system:

Code: Select all

root@porteus:~# cat /etc/porteus/00*
001-core.xzm:20221006
002-xorg.xzm:20221006
002-xtra.xzm:20220630
003-xfce.xzm:20220925
(001-core.xzm + 002-xorg.xzm + 003-xfce.xzm are actually from the /20220924/ update [- while 002-xtra.xzm is md5sum 2f05a290830cdd657609082800a2b9eb and thus the original like in the ISOs.)]

beep2 - aside from storing the path of the sound file in a variable so that tweaking that is made more easily, is basically just this:

Code: Select all

#!/bin/sh
soundfile=/usr/local/share/notification_-15dB.mp3
if [ -f "$soundfile" ]; then
    mpg123 "$soundfile" >/dev/null 2>&1
else
    echo "Soundfile $soundfile not found!"
fi
I realized that the time it takes for guest and for root differs greatly to execute beep2.
Like always, guest@porteus succeeds in playing the sound when root@porteus does not

as guest:

Code: Select all

guest@porteus:/$ time beep2

real	0m0.198s
user	0m0.028s
sys	0m0.024s
as root:
fails after the first suspend with the sound (Port 5.0 with newest updates and "officially" newest XFCE 4.16, as seen via cat /etc/porteus/00* above)

Code: Select all

root@porteus:/# time beep2

real	0m2.260s
user	0m0.028s
sys	0m0.027s
0.198s vs 2.260s is quite the difference.
other attempts have been similar:
0.193s vs 2.263s …
0.183s vs 2.311s …
0.193s vs 2.263s … and so on and so forth…
Last edited by Rava on 15 Oct 2022, 03:28, edited 1 time in total.
Reason: typo :wall:
Cheers!
Yours Rava

Post Reply