2

Ubuntu 14.04. I have PulseAudio running as daemon, and configured to do streaming. In /etc/pulse/default.pa I have added the following, to accept TCP connections:

load-module module-native-protocol-tcp auth-ip-acl=192.168.1.0/24 auth-anonymous=1

Guacamole's VNC support obtains audio through a connection to the PulseAudio server. See relevant article on Guacamole Audio support (via PulseAudio). I can get sound to stream from one VNC desktop, but not more than one, despite enabling for multiple VNC connections (these are different connections) in /etc/guacamole/user-mapping.xml. For example:

<!-- First user -->
<authorize username="user1" password="abcd">
    <connection name="vnc">
        <protocol>vnc</protocol>
        <param name="hostname">localhost</param>
        <param name="port">5903</param>
        <param name="password">abcd</param>
        <param name="enable-audio">true</param>
        <param name="audio-servername">localhost</param>
    </connection>
</authorize>

<!-- Second user -->
<authorize username="user2" password="abcd">
    <!-- First authorized connection -->
    <connection name="vnc">
        <protocol>vnc</protocol>
        <param name="hostname">localhost</param>
        <param name="port">5904</param>
        <param name="password">abcd</param>
        <param name="enable-audio">true</param>
        <param name="audio-servername">localhost</param>
    </connection>
</authorize>

PulseAudio is accepting connections on port 4713.

$ netstat -ln | grep 4713
tcp        0      0 0.0.0.0:4713            0.0.0.0:*               LISTEN
tcp6       0      0 :::4713                 :::*                    LISTEN

Does PulseAudio handle multiple Guacamole VNC users?

Since Guacamole logs to /var/log/syslog, I've isolated the logs for two instances of connections. These are the logs.

First connection is a user called guacamole_guest, and it has no sound.

Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Protocol "vnc" selected
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Connection ID is "$299e5678-59de-4dbd-9408-ad256785f732"
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: VNC server supports protocol version 3.8 (viewer 3.8)
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: We have 2 security types to read
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: 0) Received security type 2
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Selecting security type 2 (0/2 in the list)
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: 1) Received security type 16
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Selected Security Scheme 2
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: VNC authentication succeeded
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Desktop name "guacamole_guest's X desktop (lubuntu-ThinkCentre-M58p:3)"
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Connected to VNC server, using protocol version 3.8
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: VNC server default format:
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]:   32 bits per pixel.
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]:   Least significant byte first in each pixel.
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]:   TRUE colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Audio will be encoded as audio/ogg
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Starting audio stream
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Connecting to PulseAudio...
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Starting client
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Authorizing PulseAudio connection...
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Sending client name...
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: PulseAudio now ready
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Will use default sink: "auto_null"
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Starting streaming from "Dummy Output"
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: PulseAudio stream being created...
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: PulseAudio stream now ready
Oct 23 02:31:33 lubuntu-ThinkCentre-M58p guacd[18848]: Client disconnected
Oct 23 02:31:33 lubuntu-ThinkCentre-M58p guacd[18848]: Audio stream finished
Oct 23 02:31:33 lubuntu-ThinkCentre-M58p kernel: [1207939.582306] guacd[18848]: segfault at 67452305 ip b6b7ce15 sp bfd99cc0 error 4 in libguac-client-vnc.so.0.0.0[b6b73000+e000]

Second user is called lubuntu. It has sound.

Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Protocol "vnc" selected
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Connection ID is "$6344d2fb-c5fe-4073-82d7-88dea358b8f6"
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: VNC server supports protocol version 3.8 (viewer 3.8)
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: We have 2 security types to read
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: 0) Received security type 2
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Selecting security type 2 (0/2 in the list)
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: 1) Received security type 16
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Selected Security Scheme 2
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: VNC authentication succeeded
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Desktop name "lubuntu's X desktop (lubuntu-ThinkCentre-M58p:2)"
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Connected to VNC server, using protocol version 3.8
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: VNC server default format:
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]:   32 bits per pixel.
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]:   Least significant byte first in each pixel.
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]:   TRUE colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Audio will be encoded as audio/ogg
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Starting audio stream
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Connecting to PulseAudio...
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Authorizing PulseAudio connection...
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Sending client name...
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Starting client
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: PulseAudio now ready
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Will use default sink: "auto_null"
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Starting streaming from "Dummy Output"
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: PulseAudio stream being created...
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: PulseAudio stream now ready
Oct 23 02:31:43 lubuntu-ThinkCentre-M58p guacd[18871]: Client disconnected
Oct 23 02:31:43 lubuntu-ThinkCentre-M58p guacd[18871]: Audio stream finished
Oct 23 02:31:43 lubuntu-ThinkCentre-M58p kernel: [1207949.566374] guacd[18871]: segfault at 67452305 ip b6b7ce15 sp bfd99cc0 error 4 in libguac-client-vnc.so.0.0.0[b6b73000+e000]

On the surface they look the same. Not sure where to proceed. The segfaults don't look good, but they happen in both cases.

Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
sunapi386
  • 1,167
  • 14
  • 18

1 Answers1

1

Does PulseAudio handle multiple Guacamole VNC users?

PulseAudio will not be aware of Guacamole's VNC connections. Guacamole will combine the audio stream from PulseAudio with the graphical stream from VNC, but the VNC and PulseAudio connections are otherwise completely independent.

Guacamole can handle PulseAudio streams for different users/connections, but those streams will have to come from different hosts. This is because Guacamole will perform the following when connecting to PulseAudio on behalf of a VNC connection:

  1. Establish a TCP connection to the PulseAudio server described by audio-servername.
  2. Create a monitor source around the default sink and streams the received audio packets.

Since the PulseAudio server at localhost will be the same PulseAudio server in both of your connections, and there is only one default sink, you will hear the audio from the same sink in both cases.

First connection is a user called guacamole_guest, and it has no sound. ... Second user is called lubuntu. It has sound.

While interesting, the fact that you hear audio in only one of your connections likely has more to do with how the audio is being routed within PulseAudio. I'm sure there is a reason, but figuring that reason out will not lead to a solution to your problem. The two PulseAudio connections associated with your two VNC connections are guaranteed to be identical in your case.

If you wish to host multiple users' desktops on the same hardware, I would recommend instead housing each user's desktop within a virtual machine, using something like VirtualBox or KVM. This will provide you with better isolation between users, as well as a unique network address for their corresponding PulseAudio servers.

The segfaults don't look good, but they happen in both cases.

Indeed, guacd definitely should not be segfaulting. If you can reproduce the segfault reliably, the best thing to do would be to produce a bug report for the project. In the case of a segfault, the instructions for doing this are somewhat involved, but are necessary to determine where and how the segfault is occurring:

  1. Ensure guacd is dead (so we can start it again under a debugger).

    $ killall guacd
    guacd: no process found
    $ 
    
  2. Load guacd under gdb, preloading the plugin for the failing protocol.

    $ LD_PRELOAD=/usr/local/lib/libguac-client-vnc.so gdb /usr/local/sbin/guacd
    GNU gdb (GDB) 7.4.1-debian
    Copyright (C) 2012 Free Software Foundation, Inc.
    ...
    (gdb)
    
  3. Tell gdb to follow the next child process (guacd creates a new child process to isolate and handle each new connection).

    (gdb) set follow-fork-mode child
    (gdb)
    
  4. Run guacd within gdb, using -L debug to enable debug level logging within guacd.

    (gdb) run -L debug
    Starting program: /usr/local/sbin/guacd 
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    guacd[29589]: INFO:     Guacamole proxy daemon (guacd) version 0.9.8 started
    guacd[29589]: DEBUG:    Unable to bind socket to host ::1, port 4822: Address family not supported by protocol
    guacd[29589]: DEBUG:    Successfully bound socket to host 127.0.0.1, port 4822
    guacd[29589]: INFO:     Listening on host 127.0.0.1, port 4822
    ...
    
  5. Reproduce the problem. Once it happens, you'll be taken back to a gdb prompt. Get a backtrace from gdb:

    (gdb) bt
    
  6. Send the resulting backtrace along with a description of how to reproduce the problem within a new issue in the JIRA of the Guacamole project.

Mike Jumper
  • 410
  • 3
  • 8