I have an Ubuntu machine that currently has no internet connection. I want to set it up so it makes a sound when internet comes back.

I'm not sure this machine has a PC speaker, but there is a speaker connected to the on-board sound card.

In the past I think I used cat /dev/urandom > /dev/audio for this, but this doesn't seem to work anymore.

None of these tools are currently installed: beep, aplay, padsp

None of these made any sound:

modprobe pcspkr
echo -e '\a' > /dev/tty1
echo -e '\a' > /dev/console

This failed with write error: File descriptor in bad state:

cat /dev/urandom > /dev/snd/pcmC0D0p
  • Is PulseAudio running? I don't know whether it's part of the default server installation. Oct 24, 2018 at 18:03
  • @Gilles No, it's not installed: Command 'pulseaudio' not found, but can be installed with: apt install pulseaudio
    – AndreKR
    Oct 24, 2018 at 18:47
  • cat /dev/urandom > /dev/snd/pcmC0D0p does not work. See this answer.
    – psqli
    Jul 12, 2019 at 23:26

1 Answer 1


Your echo command might failed because the bell might be disabled via /etc/inputrc or ~/.inputrc like something with either one of these :

set bell-style none
set bell-style visible

Or it could also be your terminal that have bell sound disabled.

You also need to check that there is no

setterm -blength 0

in any of you profile shell script like /etc/profile.d/*.sh or in your $HOME.

So you better try the beep command that really use the on-board-speaker and not echo command that goes through different layer (where it could be blocked) to finally get the beep sound.

Note, however that you might need to run beep with root privilege for it to work. aka sudo beep

Are you sure, you have an on-board pc-speaker ? We don't talk about the built-in speaker of your laptop. We talk about some small speaker found on motherboard (of tower pc for exmaple), that's used to signal boot error with beep sound. This does not exit a lot anymore, in laptop for example.

You can check if you have a true PC Speaker by looking at output of alsamixer or amixer, if you have alsa installed, and look for something like 'PC Speaker'

Your alternative is to use aplay and play a sound

cat /dev/urandom > /dev/snd/pcmC0D0c should work but it use your sound card, not the built-in-on-board-pc-speaker.

  • As I wrote, I am not sure there is a PC speaker, but there is a speaker connected to the sound card. As I wrote, I don't have beep. As I wrote, cat /dev/urandom > /dev/snd/pcmC0D0c did not work. Sorry, but your "answer" provides no information whatsoever.
    – AndreKR
    Oct 24, 2018 at 17:04
  • Then investigate why the last command does not work ? Why use urandom when aplay could tell you more why it does not work ? Does /dev/snd/pcmC0D0c even exist ?
    – solsTiCe
    Oct 25, 2018 at 17:11
  • From this answer it seems the error message is "normal". I don't have aplay either, as I also wrote in my question. Yes, /dev/snd/pcmC0D0p exists, that's why I tried it.
    – AndreKR
    Oct 25, 2018 at 20:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .