Solved No sound but audio devices seem to be detected

Hello all, I have recently installed FreeBSD for the first time in a long time on my new (to me) Thinkpad A485. Mostly everything was working with little configuration necessary. The big thing that isn't working is the audio.

I'm using Hyprland as a window manager, which is launched with the following script (I'm launching it from the console and not using a desktop manager; this was pulled from Hyprland's docs):

Code:
#!/bin/sh

cd ~

export _JAVA_AWT_WM_NONREPARENTING=1
export XCURSOR_SIZE=24

exec ck-launch-session dbus-launch Hyprland

Video, mouse, and keyboard all work as I'd expect, but no sound is coming out of the speakers. When I cat the output of /dev/sndstat, I get:

Code:
Installed devices:
pcm0: <ATI R6xx (HDMI)> (play)
pcm1: <ATI R6xx (HDMI)> (play)
pcm2: <ATI R6xx (HDMI)> (play)
pcm3: <Realtek ALC257 (Analog 2.0+HP/2.0)> (play/rec) default
pcm4: <Realtek ALC257 (Right Analog Mic)> (rec)
No devices installed from userspace.

Checking the relevant dmesg output (dmesg | grep pcm) results in:

Code:
pcm0: <ATI R6xx (HDMI)> at nid 3 on hdaa0
pcm1: <ATI R6xx (HDMI)> at nid 5 on hdaa0
pcm2: <ATI R6xx (HDMI)> at nid 7 on hdaa0
pcm3: <Realtek ALC257 (Analog 2.0+HP/2.0)> at nid 20,33 and 18 on hdaa1
pcm4: <Realtek ALC257 (Right Analog Mic)> at nid 25 on hdaa1

I'm assuming that pcm3 is the device I care about, since the others seem to be GPU audio outputs or the microphone. I added the following to my /etc/sysctl.conf per the instructions in the Audio on FreeBSD resource:

Code:
hw.snd.default_unit=3

I'm not 100% which sound driver would be used for my sound card and the Audio on FreeBSD resource seemed to indicate that adding the following to my bootloader would help, so I did it:

Code:
snd_driver_load="YES"

This resulted in the following sound drivers being loaded:

Code:
3    1 0xffffffff82707000     45c0 snd_driver.ko
 4    2 0xffffffff8270c000    1b6a0 snd_uaudio.ko
 5    2 0xffffffff82728000     72c0 snd_vibes.ko
 6    2 0xffffffff82730000     5c10 snd_via82c686.ko
 7    2 0xffffffff82736000     5cc0 snd_t4dwave.ko
 8    4 0xffffffff8273c000     3238 snd_spicds.ko
 9    2 0xffffffff82740000     7650 snd_solo.ko
10    2 0xffffffff82748000    12298 snd_neomagic.ko
11    2 0xffffffff8275b000     c048 snd_maestro3.ko
12    2 0xffffffff82768000     a268 snd_hdspe.ko
13    2 0xffffffff82773000     4808 snd_fm801.ko
14    2 0xffffffff82778000     8cf8 snd_envy24ht.ko
15    2 0xffffffff82781000     a078 snd_envy24.ko
16    2 0xffffffff8278c000     5ca8 snd_cs4281.ko
17    2 0xffffffff82792000     7c98 snd_atiixp.ko
18    2 0xffffffff8279a000     61d0 snd_als4000.ko

Despite these steps, I'm not able to play any audio (I tried the beep command, catting filenames to /dev/dsp, and playing videos in Firefox).

It's possible that I misunderstood some of the instructions, but I kinda ran out of things I know how to check or search for at this point so any help would be greatly appreciated.
 
You try snd_driver_load when you don't know what driver is used, it's not an actual driver, it just loads all available ones. Then you check which one got detected and only load that. In your case it's not necessary, it was already properly detected (see /dev/sndstat). It's snd_hda(4), same as your videocard sound chip. You don't even need to load it, it's already included with the GENERIC kernel. The 'problem' with snd_hda(4) however is that it's a very generic driver and there are a gazillion ways a manufacturer can connect the various outputs. You may have to muck around with the pin assignments in order to get it working for your specific system. You can find more information in the snd_hda(4) manual page.
 
Thanks for the explanation SirDice. I'm going through the man page now to see if I can make sense of it.

Makoto, thanks for the tip about the mixer; I did verify through the CLI mixer program, as well as the GTK mixer program to see if anything was accidentally muted, but it doesn't seem to be the case as far as I can tell.

I wonder if it would be possible to get some more detailed information about my sound from Ubuntu and apply that to the FreeBSD device hints...
 
You could try this: install pulseaudio and verify it it works. I had this problem in the past, and installing pulseaudio solved the problem.
 
Have you tested sound definitely works? No little switch or keyboard combination that completely mutes it? BIOS settings?

Boot from Linux Mint or something similar and check the sound is working (and at the same time you can also get the information about the sound setup as you suggested).

Not saying it is likely to be something as simple as this, but really worth eliminating the obvious!
 
So I decided I'd re-install FreeBSD because I wasn't that far into getting it set up yet, and I figured it'd be best to have a clean slate before proceeding with troubleshooting.

That said, the sound output was working when I tested it with Firefox. I've applied no configuration for sound yet, so I'm chalking it up to one of the packages I've installed. I've installed (and uninstalled) XFCE and Gnome, so maybe one of those (I'm guessing Gnome) messed up something and didn't uninstall cleanly or left some configuration that was causing issues.

Thanks for all your help, though!
 
Back
Top