21

I've got a lab for high school students, and I'd like to disable audio altogether on the lab computers.

Any suggestions? I've been looking at alsa force-unload, but that only kills processes that are currently using the sound card. When I reload the browser and hit YouTube, sound comes back.

Basically, I want to unload sound from the kernel ...but easier than that.

  • Don't if it would work but would think if you disable/delete or blacklisted the audio/sound drivers in kernel. Would need to be root to disable/enable. Easiest way would be to set sound to mute in settings, but anybody can do/undo that. I am not good enough to explain how. – crip659 Sep 24 at 22:21
  • 1
    Maybe put blacklist snd in a file /etc/modprobe.d/blacklist-snd.conf? AFAIK all the snd modules depend on it (and it depends on soundcore -- see modinfo snd, so perhaps that's the one to blacklist) and I think it's responsible for loading up the sound cards, so in theory without it you shouldn't have any sound possible (unless someone has sudo on modprobe). {Argh, you beat me too it!} – pbhj Sep 24 at 23:12
  • 18
    Cut the speaker wire :) KISS – EODCraft Staff Sep 25 at 6:58
  • 1
    Is it possible to disable soundcards in UEFI? My PC allows that. – user3518753 Sep 26 at 9:54
  • 2
    @EODCraftStaff or plug in a dummy headphone plug. – rackandboneman Sep 27 at 9:15
33

All right, so blacklisting the sound related modules worked. Thanks to this post:

http://www.pc-freak.net/blog/disabling-sound-kernel-modules-debian-ubuntu-gnu-linux-servers/

The details of the fix:

edit /etc/modprobe.d/snd-blacklist.conf and add these entries (from a Dell standalone pc with 18.04)

blacklist soundcore
blacklist snd
blacklist snd_pcm
blacklist snd_hda_codec_hdmi
blacklist snd_hda_codec_realtek
blacklist snd_hda_codec_generic
blacklist snd_hda_intel
blacklist snd_hda_codec
blacklist snd_hda_core
blacklist snd_hwdep
blacklist snd_timer
16

A hardware solution: insert a mini-jack connector in the sound output port, but only a connector, without any wire or speaker on it. This has worked for me since the 80's to silence the Mac's otherwise beautiful power-on ding.

  • 2
    As a more permanent (and gross solution), put hot glue in the jack. I don't know what OP's use-case is but if the problem is kids plugging their own things in (for whatever reason) then this answer won't be enough. – Captain Man Sep 25 at 14:37
  • 5
    @CaptainMan Hot glue alone won't make the computer route audio to the jack. But you could glue in a jack. – Reinstate Monica Sep 25 at 15:28
  • @Solomonoff's Secret good point. I wasn't thinking about built-in speakers. – Captain Man Sep 25 at 15:46
  • 1
    I used to use this trick in the OP's situation (a lab of computers in a high school class). Of course, I was a student in the class, and was booting up a MacPlus so I could play Risk in drafting class. – Joe Sep 25 at 16:25
3

A simple solution would be removing the alsa drivers, i.e.:

sudo apt-get remove --purge alsa
  • 1
    That could easily be reversed accidentally by some later installation command, right? – leftaroundabout Sep 26 at 10:23
  • I guess everything can be reversed later. This is just a quick solution for OP's problem, not a "cripple my sound forever" kind of answer. – Pedro Lobito Sep 27 at 5:02
  • Sure, but my point is this will quite likely be reversed inadvertently, namely when installing some package which happens to depend on alsa. – leftaroundabout Sep 27 at 8:34
2

This seems to work. Edit the file /etc/pulse/client.conf

Change the line:

; autospawn = yes

to

autospawn = no

And

; daemon-binary = /usr/bin/pulseaudio

to

daemon-binary = /usr/bin/pulseaudio

Reboot.

  • 4
    Every user could override the settings in /etc/pulse/cliet.conf with his/her own settings in ~/.config/pulse/client.conf, please take a look at man pulse-client.conf. – mook765 Sep 24 at 22:38
  • 1
    So after this change, audio is still playing -- there are just no audio controls any more so volume is 100% . Thanks for the suggestion though. I think alsa just took over when pulse went away. – ether_joe Sep 24 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.