On Thu, Oct 22, 2026 at 11:21:44PM +0200, Paolo Aglialoro wrote:
> Hello!
> 
> I'm trying to forward audio from an OpenBSD 8.0 VM running on a remote
> server (NO SOUNDCARD) to an Ubuntu laptop over an SSH tunnel leveraging
> sndiod.
> 
> 
> ON UBUNTU:
> Starting sndiod gives no .sndio/cookie both in user home and in root home;

The cookie is created by the client and stored on the client. To
create a cookie, just run any client, ex. sndioctl on one machine
(ex. the same as the server) and copy it to all other machines.

> I start it in debug mode and get just this (working, no apparent issue) and
> no more output:
> 
> # sndiod -dd -L localhost -m play
> 
> snd0.default: play=0:1 vol=32768 dup
> snd1.default: play=0:1 vol=32768 dup
> snd2.default: play=0:1 vol=32768 dup
> snd3.default: play=0:1 vol=32768 dup
> 
> SSH tunnel is established this way:
> $ ssh -R 11025:localhost:11025 -X [email protected]
> 
> 
> ON OPENBSD:
> 
> sndiod is stopped and disabled, as the app should send audio directly to
> localhost:11025 port, in fact in .profile I wrote:
> export AUDIODEVICE=snd@localhost/0
> 
> in fact:
> $ env | grep AUDIO
> AUDIODEVICE=snd@localhost/0
> 
> tunnel works:
> $ nc -zv 127.0.0.1 11025
> Connection to 127.0.0.1 11025 port [tcp/*] succeeded!
> 
> I remove ~/.sndio/cookie:
> $ rm -rf .sndio/cookie
> 
> BUT EVERYTHING I TRY FAILS:
> $ SNDIO_DEBUG=2 AUDIODEVICE=snd@localhost/0 mpg123 test.mp3
> High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
> version 1.33.7; written and copyright by Michael Hipp and others
> free software (LGPL) without any warranty but with best wishes
> _aucat_open: host=127.0.0.1 unit=0 opt=3
> _aucat_rmsg: eof
> aucat_init: mode refused

The sndiod server running on ubuntu may be too old, you could update
it as follows:

apt install libbsd-dev libasound2-dev
git clone https://sndio.org/git/sndio
cd sndio
./configure CFLAGS=-O2
make
sudo make install
ldconfig

and restart sndiod.

> [src/libout123/modules/sndio.c:open_sndio():133] error: Got nothing from
> sio_open().
> [src/libout123/libout123.c:check_output_module():1167] error: Module
> 'sndio' device open failed.
> [src/libout123/libout123.c:out123_open():485] error: Found no driver out of
> [sndio] working with device <default>.
> main: [src/mpg123.c:check_fatal_output():338] error: out123 error 3:
> failure loading driver module
> 
> ALSO, no output appears on the Ubuntu sndiod CLI side when the client
> connects, so sound stream doesn't even make it to ubuntu (which might
> explain the lack of .sndiod/cookie and of output on ubuntu CLI): problem
> looks like to be on openbsd VM side.
> 
> I tried too:
> -enabling sndiod on openbsd side
> -removed again ~/.sndio, then restarted sndiod on Ubuntu
> -tried 127.0.0.1 instead of localhost in AUDIODEVICE
> -tried devices /1, /2 and /3 in AUDIODEVICE
> 
> Any useful clues? Please don't tell me that this is because there is no
> soundcard on the server.... Thanks in advance!
> Paolo

Anyway, the approach is right; I use it all the time between an
OpenBSD server and Linux clients.

Few off-topic remarks:

- for VMs, you could save few CPU cycles by not encrypting the audio
  traffic, provided that no other system can access the (virtual)
  network traffic.
  
- I'd suggest using "snd@host/default" in place of "snd@host/0", this
  is what local clients do and is more flexible.

Reply via email to