How to set default pcm device?

Ashley Chase erisianash at
Sun Feb 4 03:43:34 UTC 2018

Typing this on my phone. Sorry if the formatting  isn't right.

On February 3, 2018 12:44:30 PM PST, Christian Weisgerber <naddy at> wrote:
>After boot, my /dev/sndstat looks like this:
>Installed devices:
>pcm0: <ATI R6xx (HDMI)> (play)
>pcm1: <Realtek ALC280 (Analog 2.0+HP/2.0)> (play/rec) default
>pcm2: <Realtek ALC280 (Rear Analog)> (play/rec)
>pcm3: <USB audio> (play)
>No devices installed from userspace.
>However, I would like the USB audio device, pcm3, to be the default
>sound unit.  How do I set this persistently across reboots?
>The traditional solution was to set hw.snd.default_unit=3 in
>/boot/loader.conf.  That worked for FreeBSD 10.x, but with 11.x the
>USB devices are attached very late and the boot loader setting
>(which I still have) is effectively ignored.  Loading the uaudio
>module early with snd_uaudio_load=YES doesn't change this.  Setting
>hw.snd.default_unit in /etc/sysctl.conf is unlikely to work either;
>certainly it's a race.

hw.snd.default_unit is actually a sysctl and should go in /etc/sysctl.conf

You night also consider setting hw.snd.default_auto=2 to automatically select the most recently attached device.

This is documented in the sound(4) man page.

>Do I need to define a devd(8) action for when uaudio attaches or
>is there a better way?

Ashley Chase

More information about the freebsd-questions mailing list