Give Ubuntu a startup beep using the PC Speaker.

Want conformation when your computer’s booted? Find out how and always know when it’s on.

What happened to startup sounds? Both Ubuntu and Windows used to have one, but they seem to have gone out of fashion, and I don’t see why. They’re quite a useful indicator as to what your computer is doing especially when you can’t see it. Macs are the only computers that have kept their startup sound but it isn’t the most useful as it happens the second you press the power button, not when the system has actually booted.

In this tutorial, I’ll show you how to get a startup beep through the PC Speaker on Ubuntu, which is useful for all computers, but especially useful for servers that have no proper speaker and no monitor attached.

Install Beep

$ sudo apt update
$ sudo apt install beep

Configure Beep and Ubuntu

You’ll want to get the machine to produce a rising tone on startup and a descending tone on shutdown. Follow these instructions to create a short script to handle this behaviour.

$ sudo nano /etc/init.d/beep

To make things easier, the script below is configured to do exactly what you’ll need, so just copy the following into the /etc/init.d/beep file.

#! /bin/sh -e
### BEGIN INIT INFO
# Provides:          beep
# Required-Start:    $syslog
# Required-Stop:     $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: beep
# Description:
#
### END INIT INFO

# Carry out specific functions (start, stop, restart etc)
case "$1" in
  start)
    beep -l 75 -f 500 -n -l 75 -f 1000 -n -l 75 -f 2000 -n -l 75 -f 3000
    ;;
  stop)
    beep -l 75 -f 3000 -n -l 75 -f 2000 -n -l 75 -f 1000 -n -l 75 -f 500
    ;;
  *)
    echo "Usage: /etc/init.d/beep {start|stop}"
    exit 1
    ;;
esac

exit 0

In order to make Ubuntu sound the startup sound on startup and shutdown, you’ll need to run the following in your terminal.

$ sudo chmod a+x /etc/init.d/beep
$ sudo update-rc.d beep defaults 01

Now, on Ubuntu, there is a blacklist for the PC Speaker that is enabled by default, so we’ll need to run these commands in order to remove that.

$ sudo modprobe pcspkr

This will temporarily allow the PC Speaker to work, but we’ll want to make this permanent. So, open the following file in your favourite editor.

$ sudo nano /etc/modprobe.d/blacklist.conf

You’ll get the following screen:

You now need to comment out the PC Speaker, so find it and comment it out with a #

To start with, it’ll look like this.
It should look like this when you’re done.

Now, save that file and exit your editor.

That’s it! Your PC will now produce startup and shutdown tones when you start it or shut it down.

Disabling the startup sound

If, for whatever reason, you’d like to disable the startup sound, just run the following command.

$ sudo update-rc.d beep remove

One thought on “Give Ubuntu a startup beep using the PC Speaker.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>