State of Pipewire support

Forum / NoMachine for Linux / State of Pipewire support

Tagged: 

Viewing 13 posts - 16 through 28 (of 28 total)
  • Author
    Posts
  • #43427
    Tromegan
    Participant

    @Bilbotine – thanks! That article is what we started with – I am connecting to a physical session, and I do have pipewire configured and working

    #43536
    kubaszym1
    Participant

    Hi,

    We recently added some changes to handle PipeWire better in physical sessions. They will be present in upcoming version. Although you should be able to hear audio in physical session with your NoMachine version and configuration. Here are some things to check:

    1. Check if you are able to use pw-cli. If you don’t have pw-cli for some reasons, NoMachine chooses to connect to pulseaudio, assuming that you don’t have pipewire installed. pw-cli should be installed by default, together with PipeWire.

    2. If NoMachine tries to connect to pulseaudio, it creates unix sockets in .nx/nxdevice/D-*/audio/. These sockets are called cli.socket and native.socket. In the upcoming version they don’t exist if you use PipeWire as your audio server, but I’m not sure how this works in the current release version . They are removed while disconnecting, so please connect to your server and go to the directory .nx/nxdevice/D-<display>-<session-ID>/audio.

    I hope this will help somehow. I would appreciate any information, maybe I will need to fix something in the part of our code that checks what audio server is used.

    Kuba

    #43543
    Tromegan
    Participant

    Hi @kubaszym1 – thanks a lot for your response – looking forward to the upcoming version.

    As for the current version – I have 8.4.2 on client and server – I also do have pw-cli under ‘/usr/bin/pw-cli’

    When it comes to sockets and their creation – the log says:

    2580686 2580686 2023-03-22 12:17:40 653.053 NXNODE   Starting audio service with session type ‘physicalAttachDesktop’.
    2580686 2580686 2023-03-22 12:17:40 653.091 NXNODE   Audio is enabled in configuration.
    2580686 2580686 2023-03-22 12:17:40 653.143 NXNODE   AUDIO returning 5:9:opus:fifo-/home/user/.nx/nxdevice/D-1002-70F1C3A3919CFF56CD4C4CE8603E2F64/audio/audio_in.fifo:1.
    2580686 2580686 2023-03-22 12:17:40 653.199 NXNODE   AUDIO returning 5:11:speex:fifo-/home/user/.nx/nxdevice/D-1002-70F1C3A3919CFF56CD4C4CE8603E2F64/audio/voice_out.fifo:1.
    2580686 2580686 2023-03-22 12:17:40 653.352 NXNODE   NXOptionsFile: Created options string ‘nx/nx,keyboard=evdev/en_US,cpus=6,threads=auto,priority=realtime,client=winnt,servercopysize=0,clientcopysize=0,audioin=5:9:opus:fifo-/home/user/.nx/nxdevice/D-1002-*****/audio/audio_in.fifo:1,voiceout=5:11:speex:fifo-/home/user/.nx/nxdevice/D-1002-*****/audio/voice_out.fifo:1,volume=0,devicesmartcard=1,deviceports=1,devicenetwork=1,legacykb=0,slave=1,cache=16M,images=64M,link=9,type=physical-desktop,clipboard=both,cleanup=0,accept=127.0.0.1,product=LS/None,shmem=1,backingstore=1,shpix=1,cookie=*****,id=ginaz-1002-*****,render=1,multipass=1,networkadaptive=0,encryption=1,proxy=8/8,monitor=9,rtremotehost=192.168.86.49,rtremoteport=4000,rtlocalport=4011,rtsession=25,rtkey=*****,rtiv=*****,rekey=32G,deblock=1,downsampling=0,mode=1,shadowmode=2,shadowuid=1000,shading=1,shadow=:1001:1002\n’.
    2580686 2580686 2023-03-22 12:17:40 653.436 NXNODE   NXOpen FD#10 – file /home/user/.nx/node/C-ginaz-1002-70F1C3A3919CFF56CD4C4CE8603E2F64/options with mode 1089 and permissions 384 from main::create_user_readable_only_file.
    2580686 2580686 2023-03-22 12:17:40 653.483 NXNODE   libnxh::NXFileMode(/home/user/.nx/node/C-ginaz-1002-70F1C3A3919CFF56CD4C4CE8603E2F64/options, 384)
    2580686 2580686 2023-03-22 12:17:40 653.527 NXNODE   libnxh::NXFileMode returns ‘0’.
    2580686 2580686 2023-03-22 12:17:40 653.562 NXNODE   file ‘/home/user/.nx/node/C-ginaz-1002-70F1C3A3919CFF56CD4C4CE8603E2F64/options’ opened for appending: FD [10]
    2580686 2580686 2023-03-22 12:17:40 653.639 NXNODE   written to file ‘/home/user/.nx/node/C-ginaz-1002-70F1C3A3919CFF56CD4C4CE8603E2F64/options’ bytes ‘nx/nx,keyboard=evdev/en_US,cpus=6,threads=auto,priority=realtime,client=winnt,servercopysize=0,clientcopysize=0,audioin=5:9:opus:fifo-/home/user/.nx/nxdevice/D-1002-*****/audio/audio_in.fifo:1,voiceout=5:11:speex:fifo-/home/user/.nx/nxdevice/D-1002-*****/audio/voice_out.fifo:1,volume=0,devicesmartcard=1,deviceports=1,devicenetwork=1,legacykb=0,slave=1,cache=16M,images=64M,link=9,type=physical-desktop,clipboard=both,cleanup=0,accept=127.0.0.1,product=LS/None,shmem=1,backingstore=1,shpix=1,cookie=******,id=ginaz-1002-*****,render=1,multipass=1,networkadaptive=0,encryption=1,proxy=8/8,monitor=9,rtremotehost=192.168.86.49,rtremoteport=4000,rtlocalport=4011,rtsession=25,rtkey=*****,rtiv=*****,rekey=32G,deblock=1,downsampling=0,mode=1,shadowmode=2,shadowuid=1000,shading=1,shadow=:1001:1002\n’

    and while it refers to creating those sockets – there is no audio under /home/user/.nx/D-1002-*/ – there is only cups, disk and printer.

    #44212
    Tromegan
    Participant

    Hi All!

    I have updated to 8.5.3 (both client Win11 and server Gentoo Linux) some new observations – it seems like this version does detect pipewire – as pw-loopback process is now created (it does require I configure AudioInterface to “pulseaudio” and doesn’t work with “alsa”):

    user     14523   11931  0 02:57 ?        00:00:00 /usr/bin/pw-loopback –playback-props=media.class=Audio/Source node.name=nx_remapped_out node.description=”Remapped nx_voice_out” tar

    I also see some new devices now in ‘pavucontrol’ – under “Output” – I see “NoMachine Output” and under “Input” I see “Monitor of NoMachine Output” and “Remapped nx_voice_out”. Also under recording I see “/usr/bin/pw-loopback” taking input from my default output device.

    With all this happening – where should I look for why sound is not audible on the client?

    Thanks!

    #44227
    kubaszym1
    Participant

    Hi,

    NoMachine Output and Remapped nx_voice_out are devices that we use for forwarding microphone. If it comes to audio forwarding, nothing significant changed in the latest update. I only added some error handling. We capture data from the default audio device and send it to server. These new devices and processes are only for microphone forwarding. You can check the logs under this path: ~/.nx/node/C-<display>-<session-ID> to see whether you have any warnings or errors related to audio.

    Best regards,

    Kuba

    #44245
    Tromegan
    Participant

    I guess this is the problem:

    Connection failure: Connection refused
    pa_context_connect() failed: Connection refused
    875407 875723 2023-05-15 10:27:47 954.177 AudioProxyCore: Cannot check whether PulseAudio or PipeWire is used.

    Where is it trying to connect? Is there a way to suggest where it should be connecting?

    user@host ~/.nx/node $ pactl info
    Server String: tcp:127.0.0.1:4713
    Library Protocol Version: 35
    Server Protocol Version: 35
    Is Local: no
    Client Index: 41438
    Tile Size: 65472
    User Name: user
    Host Name: host
    Server Name: PulseAudio (on PipeWire 0.3.67)
    Server Version: 15.0.0
    Default Sample Specification: float32le 2ch 48000Hz
    Default Channel Map: front-left,front-right
    Default Sink: alsa_output.pci-0000_00_1f.3.analog-stereo
    Default Source: alsa_input.pci-0000_00_1f.3.analog-stereo
    Cookie: 14e9:9f97

    And this is how my pipewire-pulse.conf is configured:

    pulse.properties = {
    server.address = [
    “unix:native”
    “unix:/tmp/pulse-socket”              # absolute paths may be used
    “tcp:127.0.0.1:4713”               # IPv4 on a single address
    ]
    vm.overrides = {
    pulse.min.quantum = 1024/48000      # 22ms
    }
    }

    Also in ~/.nx/nxserver.log I see that it seems to be calling pw-cli and seems to be getting something out of it:

    875407 875407 2023-05-15 10:27:46 837.915 NXNODE   Process ‘/usr/bin/pw-cli ls Node’ with pid ‘875672/875672’ finished with exit code 0 after 0,006 seconds.
    875407 875407 2023-05-15 10:27:46 837.951 NXNODE   nxDefaultExitCodeHandler: process with pid 875672 just died.
    875407 875407 2023-05-15 10:27:46 837.982 NXNODE   handleSIGCHLD checking child: 875428
    875407 875407 2023-05-15 10:27:46 838.022 NXNODE   Checking not child process ‘1363’.
    875407 875407 2023-05-15 10:27:46 838.081 NXNODE   NXRunCommand: nxwaitpid 875672 return 875672
    875407 875407 2023-05-15 10:27:46 838.114 NXNODE   NXRunCommand: process ‘875672’ exit status was ‘0’
    875407 875407 2023-05-15 10:27:46 838.150 NXNODE   NXRunCommand: process ‘875672’ stderr was ”
    875407 875407 2023-05-15 10:27:46 838.181 NXNODE   NXRunCommand: return: 0
    875407 875407 2023-05-15 10:27:46 838.269 NXNODE   PW_ExecuteCommandPwcli: /usr/bin/pw-cli ls Node: [0]: stdout[        id 28, type PipeWire:Interface:Node/3\n                 object.serial = “28”\n          factory.id = “10”\n                 priority.driver = “20000”\n             node.name = “Dummy-Driver”\n    id 29, type PipeWire:Interface:Node/3\n                 object.serial = “29”\n          factory.id = “10”\n                 priority.driver = “19000”\n             node.name = “Freewheel-Driver”\n        id 34, type PipeWire:Interface:Node/3\n                 object.serial = “35”\n          factory.id = “10”\n                 client.id = “32”\n              node.name = “Midi-Bridge”\n             media.class = “Midi/Bridge”\n   id 40, type PipeWire:Interface:Node/3\n                 object.serial = “41”\n          object.path = “alsa:pcm:0:front:0:playback”\n               factory.id = “18”\n             client.id = “32”\n              device.id = “39”\n              priority.session = “1009”\n             priority.driver = “1009”\n                  node.description = “Built-in Audio Analog Stereo”\n             node.name = “alsa_output.pci-0000_00_1f.3.analog-stereo”\n              node.nick = “ALC892 Analog”\n           media.class = “Audio/Sink”\n        id 41, type PipeWire:Interface:Node/3\n                 object.serial = “42”\n          object.path = “alsa:pcm:0:front:0:capture”\n            factory.id = “18”\n             client.id = “32”\n                  device.id = “39”\n              priority.session = “2009”\n             priority.driver = “2009”\n              node.description = “Built-in Audio Analog Stereo”\n             node.name = “alsa_input.pci-0000_00_1f.3.analog-stereo”\n           node.nick = “ALC892 Analog”\n           media.class = “Audio/Source”\n  id 70, type PipeWire:Interface:Node/3\n                 object.serial = “33106”\n                   factory.id = “7”\n              client.id = “54”\n              node.description = “/usr/bin/pw-loopback-646856″\n              node.name = “input./usr/bin/pw-loopback-646856″\n               media.class = “Stream/Input/Audio”\n        id 82, type PipeWire:Interface:Node/3\n                 object.serial = “33098”\n               factory.id = “18”\n             node.description = “NoMachine Output”\n                     node.name = “nx_voice_out”\n            media.class = “Audio/Sink”\n    id 89, type PipeWire:Interface:Node/3\n                 object.serial = “33105”\n               factory.id = “7”\n              client.id = “54”\n          node.description = “Remapped nx_voice_out”\n            node.name = “nx_remapped_out”\n                 media.class = “Audio/Source”\n  id 101, type PipeWire:Interface:Node/3\n                    object.serial = “41361”\n               factory.id = “18”\n             node.description = “NoMachine Output”\n                 node.name = “nx_voice_out”\n            media.class = “Audio/Sink”\n].
    875407 875407 2023-05-15 10:27:46 838.340 NXNODE   PW_GetDeviceId: command output:      id 28, type PipeWire:Interface:Node/3\n                 object.serial = “28”\n          factory.id = “10”\n             priority.driver = “20000”\n                 node.name = “Dummy-Driver”\n    id 29, type PipeWire:Interface:Node/3\n                 object.serial = “29”\n          factory.id = “10”\n             priority.driver = “19000”\n                 node.name = “Freewheel-Driver”\n        id 34, type PipeWire:Interface:Node/3\n                 object.serial = “35”\n          factory.id = “10”\n             client.id = “32”\n                  node.name = “Midi-Bridge”\n             media.class = “Midi/Bridge”\n   id 40, type PipeWire:Interface:Node/3\n                 object.serial = “41”\n          object.path = “alsa:pcm:0:front:0:playback”\n               factory.id = “18”\n             client.id = “32”\n              device.id = “39”\n              priority.session = “1009”\n             priority.driver = “1009”\n              node.description = “Built-in Audio Analog Stereo”\n                 node.name = “alsa_output.pci-0000_00_1f.3.analog-stereo”\n              node.nick = “ALC892 Analog”\n           media.class = “Audio/Sink”\n    id 41, type PipeWire:Interface:Node/3\n             object.serial = “42”\n          object.path = “alsa:pcm:0:front:0:capture”\n            factory.id = “18”\n             client.id = “32”\n              device.id = “39”\n                  priority.session = “2009”\n             priority.driver = “2009”\n              node.description = “Built-in Audio Analog Stereo”\n             node.name = “alsa_input.pci-0000_00_1f.3.analog-stereo”\n                   node.nick = “ALC892 Analog”\n           media.class = “Audio/Source”\n  id 70, type PipeWire:Interface:Node/3\n                 object.serial = “33106”\n               factory.id = “7”\n                  client.id = “54”\n              node.description = “/usr/bin/pw-loopback-646856″\n              node.name = “input./usr/bin/pw-loopback-646856″\n               media.class = “Stream/Input/Audio”\n    id 82, type PipeWire:Interface:Node/3\n             object.serial = “33098”\n               factory.id = “18”\n             node.description = “NoMachine Output”\n                 node.name = “nx_voice_out”\n                media.class = “Audio/Sink”\n    id 89, type PipeWire:Interface:Node/3\n                 object.serial = “33105”\n               factory.id = “7”\n              client.id = “54”\n              node.description = “Remapped nx_voice_out”\n                node.name = “nx_remapped_out”\n                 media.class = “Audio/Source”\n  id 101, type PipeWire:Interface:Node/3\n                object.serial = “41361”\n                   factory.id = “18”\n             node.description = “NoMachine Output”\n                 node.name = “nx_voice_out”\n            media.class = “Audio/Sink”

     

    #44277
    kubaszym1
    Participant

    Hi,

    I’m not sure how well our support for pipewire will work when server address is set to “tcp:…”. What happens when you change it to “unix:native”? Everything else in your configuration seems fine. I only wonder about this:

    Connection failure: Connection refused
    pa_context_connect() failed: Connection refused
    875407 875723 2023-05-15 10:27:47 954.177 AudioProxyCore: Cannot check whether PulseAudio or PipeWire is used.

    In AudioProxyCore we call “pactl info” in order to determine whether pulseaudio or pipewire is used. It seems that the command failed when called from NoMachine. The message “pa_context_connect() failed: Connection refused” indicates that something went wrong while connecting to the internal pulseaudio context (pactl is a pulseaudio command and pipewire is partly compatible with pulseaudio). In example, it can happen if try to run some pipewire/pulseaudio command when logged as root. Another option is that pipewire server wasn’t started in a proper way but it’s unlikely since everything works fine from the command line.

    The nxserver process creates some virtual devices that can be used to forward microphone. That’s what you can see in nxserver.log.

    Regards,

    Kuba

    #44296
    Tromegan
    Participant

    Ok, thanks, so I got this to work – though in what seems to be a rather ugly way.

    It seems like the issue I am having is due to the fact that I run per-user pipewire, while NoMachine seems to expect system-wide PipeWire.

    What I had to do to make things work:

    1) I modified my pipewire-pulse.conf to spawn a socket under /var/run/pulse/native

    pulse.properties = {
    # the addresses this server listens on
    server.address = [
    “unix:native”
    “unix:/var/run/pulse/native”
    “unix:/tmp/pulse-socket”              # absolute paths may be used

    2) I created a sym link from /var/run/pipewire/pipewire-0 to /var/run/user/{uid}/pipewire/pipewire-0

    With these done – I got pipewire to be properly recognized and I got sound on the client side – is there any way to do this in a more clear fashion? Especially the symlink part looks like a hack 😉

    #44421
    kubaszym1
    Participant

    Hi,

    I think setting server.address to “unix:native” should be enough, then server string is simply “/run/user/<uid>/pulse/native”. Doesn’t it work for you?

    NoMachine doesn’t require “system-wide” PipeWire. I don’t think if that would be possible, pipewire server generally runs per-user. NoMachine also creates pipewire client for the specific user when logging to the remote desktop.

    Best regards,

    Kuba

    #44428
    Tromegan
    Participant

    Hi unfortunately from what I have observed just having “unix:native” doesn’t work – is there any possibility to enable debug log to print what path is NoMachine trying to use while communicating with PipeWire?

    #44456
    kubaszym1
    Participant

    Hi,

    NoMachine connects to the default PipeWire server that is currently running. The default path of pipewire-pulse socket should be /run/user/<uid>/pulse/native. Maybe your issue is somehow specific to your Linux distribution. Can you see what happens if you just change “unix:native” to “unix:/run/user/<uid>/pulse/native”?

    Best regards,

    Kuba

    #44473
    Tromegan
    Participant

    Not sure if this is distribution specific, but here is what I observed. If I run “pw-dump” in a terminal of a user with an active pipewire session – this is what I see in STRACE:

    for user:

    socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 12
    connect(12, {sa_family=AF_UNIX, sun_path=”/run/user/1000/pipewire-0″}, 28) = 0

    for root (same box same time):

    socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 12
    connect(12, {sa_family=AF_UNIX, sun_path=”/run/pipewire/pipewire-0″}, 27) = -1 ENOENT (No such file or directory)

    This is not dependent on environment variables, so something else is telling pw-dump which socket to use – since creating a sym-link solves the problem it seems like NoMachine is for some reason trying to use pipewire socket path as if it is run for a user who doesn’t have an active session..

    #45556
    Britgirl
    Keymaster

    A Trouble Report has been opened for this issue which will be fixed in line with development priorities. This has not been reproduced on any of our official supported distros. Please use the following link to monitor its status.

    https://www.nomachine.com/TR09U11006

    The workaround for Gentoo users:

    The workaround is to change the default pipewire configuration:
    1) In /usr/share/pipewire/pipewire-pulse.conf change:

    pulse.properties = {
    # the addresses this server listens on
    server.address = [
    //“unix:native” # -> this path is used by default
    “unix:/var/run/pulse/native” # -> this path should be used for workaround

    2) Create a symlink  /var/run/pipewire/pipewire-0 to /var/run/user/{uid}/pipewire/pipewire-0

Viewing 13 posts - 16 through 28 (of 28 total)

This topic was marked as solved, you can't post.