Repository navigation
Cannot remove vsnd module #1
Copy link
Copy link
Closed
Description
It seems that vsnd module cannot be removed if the system contains other sound devices.
Test result:
$ make check
make -C /lib/modules/5.15.0-92-generic/build M=/home/jio/c_code/vsnd modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-92-generic'
CC [M] /home/jio/c_code/vsnd/vsnd.o
MODPOST /home/jio/c_code/vsnd/Module.symvers
CC [M] /home/jio/c_code/vsnd/vsnd.mod.o
LD [M] /home/jio/c_code/vsnd/vsnd.ko
BTF [M] /home/jio/c_code/vsnd/vsnd.ko
Skipping BTF generation for /home/jio/c_code/vsnd/vsnd.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-92-generic'
curl -o CantinaBand3.wav https://www2.cs.uic.edu/~i101/SoundFiles/CantinaBand3.wav
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 129k 100 129k 0 0 60312 0 0:00:02 0:00:02 --:--:-- 60293
scripts/verify.sh
+ sudo modprobe snd_pcm
[sudo] password for jio:
+ sudo rmmod vsnd
rmmod: ERROR: Module vsnd is in use
+ rm -f /tmp/audio.pcm
+ mkfifo /tmp/audio.pcm
+ sudo insmod vsnd.ko out_fifo_name=/tmp/audio.pcm
insmod: ERROR: could not insert module vsnd.ko: File exists
+ sleep 1
+ tee out.pcm
+ aplay CantinaBand3.wav
Playing WAVE 'CantinaBand3.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
underrun!!! (at least 4013.908 ms long)
underrun!!! (at least 3997.829 ms long)
underrun!!! (at least 4000.495 ms long)
underrun!!! (at least 3994.409 ms long)
underrun!!! (at least 3997.966 ms long)
+ sudo rmmod vsnd
rmmod: ERROR: Module vsnd is in use
+ ffmpeg -f s16le -ar 22.05k -ac 1 -loglevel 8 -i out.pcm out.wav
[1]+ Done tee out.pcm < /tmp/audio.pcm > /dev/null
System environment:
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC269VB Analog [ALC269VB Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: vsnd [vsnd], device 0: vsnd PCM [vsnd PCM]
Subdevices: 1/1
Subdevice #0: subdevice #0
$ uname -a
Linux <my-compuer-user-name> 5.15.0-92-generic #102-Ubuntu SMP Wed Jan 10 09:33:48 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
jserv commentedon Feb 15, 2024
@Cuda-Chen, Can you confirm that
vsnd_unregister_all()properly iterates the registered sound devices?Cuda-Chen commentedon Feb 16, 2024
Hi @jserv ,
After upgrading my system to
5.15.0-94-generic, it gets worse: the kernel cannot loadvsndmodule, and I think there are some issues of the recently Ubuntu distro. I will solve thecannot load moduleissue first.FYI, here are the outputs after loading the
vsndmodule:What's more, here are the results in
dmesgwhile loadingvsndmodule:Cuda-Chen commentedon Feb 17, 2024
Hi @jserv ,
After purging and reinstalling the
linux-headers, it compiles without any errors (as I have not clean thelinux-headerson my computer for years).For Ubuntu, to let
vsndplay sound, you have to select thevsndfrom System Settings -> Sounds (the system describevsndasAnalog Output - Built-in Audio) or the test sound will be played by other sound devices.What's more, there is some interesting finding when using
lsmod | grep vsnd:You can see that
vsndis occupied by some unknown kernel modules. I think I should realize how Ubuntu manage the sound device first (maybe the System Setting occupiesvsndso we can'trmmod vsnd?).Cuda-Chen commentedon Mar 18, 2024
Hi @jserv ,
I would like to make some updates about my findings.
I found
vsndcannot be removed once it plays any sound.To remove
vsnd, I have to typepactl set-card-profile alsa_card.platform-vsnd.0 offand thevsndwill be able to be removed.What's more, it seems that the
dmesgproduces lagged output as follows (use this fork to re-produce):Also, I think to designate the sound-playing device when testing should be more convenient so that we don't need to switch the sound output device from system setting manually.
Cuda-Chen commentedon May 6, 2024
Close this as we mention that the contributors should temporarily disable downstream sound services such as PluseAudio and PipeWire in README.