How to Play A Login Sound in Ubuntu 20.04/21.10, Debian 11, Fedora 35

This tutorial shows how to play a sound at login to indicate system is ready in Ubuntu, Debian, Fedora & other Linux with GNOME Desktop.

Like Windows, Ubuntu Linux has disabled the login sound event for years. Though, there are a few Linux distributions (e.g., Linux Mint) that still preserve this feature out-of-the-box. For those would like to re-enable in GNOME, this tutorial will show you how!

1. Prepare the audio file:

Ubuntu by default has the ‘desktop-login.oga‘ and ‘system-ready.oga‘ sound file under ‘/usr/share/sounds/Yaru/stereo’ directory. User may press Ctrl+Alt+T on keyboard to open terminal, and then run command to listen to it:

canberra-gtk-play --id="system-ready"
NOTE this command works when you use default Sound theme in Gnome Tweaks. And make sure no rule in '~/.config/gtk-3.0/settings.ini' or '/etc/gtk-3.0/settings.ini' that disabled system sounds.

Other Linux (e.g., Debian and Fedora) may grab a short sound from the web and try the command below to listen to it:

canberra-gtk-play --file="PATH-TO-SOUND-FILE"

or:

paplay /PATH/TO/SOUND/FILE
TIP: Drag & drop file into terminal will insert FILE PATH automatically.
Debian 11 has to run sudo apt install gnome-session-canberra command to get 'canberra-gtk-play' to work.

2. Play Login Sound for Ubuntu:

Ubuntu has ‘Startup Applications‘ (gnome-session-properties) utility allows to easily run the command above to play sound at login. Firstly, search for and open it from ‘Activities’ overview:

Next, click ‘Add‘ button and type following in the input boxes:

  • Name: Login Sound
  • Command: canberra-gtk-play --id="system-ready"
  • Comment: optional

Make sure you have tried out the command and it plays the sound properly from terminal. And finally save it.

Run command automatically at login to play a sound

2. Play Login Sound for Debian/Fedora:

Unlike Ubuntu, other Linux does not has the handy graphical tool to run a custom command on startup. Instead, user may create a rule (.desktop) file under “.config/autostart” directory.

Firstly, search for and open ‘terminal’ from ‘Activities’ overview screen.

Next, create the .config/autostart folder in case it does not exit:

mkdir ~/.config/autostart

Finally, use gedit text editor to generate and edit a ‘login-sound.desktop‘ file:

gedit ~/.config/autostart/login-sound.desktop

When file opens, insert following lines (do change the FILE PATH in ‘Exec’ line):

[Desktop Entry]
Encoding=UTF-8
Exec=canberra-gtk-play --file='/home/merilyn/Downloads/system-ready.oga'
Name=Login Sound
Comment=Play a sound at login
Terminal=false
OnlyShowIn=GNOME
Type=Application
StartupNotify=false
X-GNOME-Autostart-enabled=true

After saving the file. Login sound should play at next boot. That’s all. Enjoy!

Merilyn Ne
Hi, I'm Merilyn Ne, a computer geek working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.