When switching to a virtual terminal, e.g. using Ctrl+Alt+F2, audio from the desktop environment stops, e.g. music from Grooveshark or the VLC Media Player stops. Why is this? Is there any way to prevent it?

  • 3
    I am not 100% sure of what is happening in the background, therefore I won't post this as an answer...but have you tried actually to login to your user account after switching to the terminal? This is what brings the sound back for me (when you log in as the same user as in the gui at least). Because of that I would assume that it has something to do with the security settings, since in that virtual shell you are not logged in as the user account the sound is playing from. So you are not allowed to hear the output – Daniel W. Nov 8 '14 at 18:02
  • @Daniel Ah logging in with my user account helps. I usually (but not always) log in as root for convenience. Never noticed that before! Is that new in a recent Ubuntu version or has it always been like that? Because I can't remember it continuing to play after logging in, and I do sometimes log in with my user account. – Luc Nov 9 '14 at 0:05
  • As I said I don't really now the processes going on in the background but I guess it has to do something with permissions. So you could work around it by switching to virtual terminal, logging in with the same user as in the gui shell and then assuming root with sudo -i – Daniel W. Nov 9 '14 at 0:18
  • 1
    I'm curious about this too, although doesn't bother me personally (I don't particularly want to prevent this). – Hitechcomputergeek Feb 6 '16 at 21:24
  • 1
    This is part of the session management by systemd-logind. When you switch console, it removes your user ID from the access control list of the sound device files in /dev/snd/. This means the PulseAudio instance for your session loses access to the sound device. – osvein Apr 14 at 23:36

Not using Ubuntu, I'm using Fedora but pretty sure the same will work on Ubuntu.

cd /dev/snd
chmod o+rw *

But try first to add the user you log in as to the group audio.

I seem to remember that there are some files or processes that change group ID when you switch virtual consoles.



usermod -a -G audio youruser

From: https://www.reddit.com/r/linux/comments/1ckvhd/keeping_music_playing_across_multiple_terminal/

Or see: https://unix.stackexchange.com/questions/211885/switching-between-shells-stops-the-music-that-is-currently-playing/550547

  • Can you use too: sudo usermod -a -G audio $USER. The sudoprefix could be used if you got that message: usermod: Permission denied. usermod: não foi possível travar /etc/passwd; tente novamente mais tarde. – Wellington1993 Apr 19 at 21:20

I'm pretty sure of the situation here is normal. The sound is made by an application made into the output of your desktop. If you need a terminal and you still want to hear your music I suggest to use a Virtual Terminal like the application Terminal. And you may want to use it fullscreen, look for the view parameters of the application. Otherwise i'm not familliar to continue to send the audio flux from a session terminal to another one.

  • 1
    Yes I'm pretty sure the situation is normal too, I just wonder why this is behind the scenes. The process producing the audio is still running in the background, but suddenly it's no longer sent to the speakers. – Luc Nov 9 '14 at 0:05
  • Actually the sound is send to a certain tty (which is not the one your jumping into) You could be able to make different song played into different tty. This will run multiple process and do what you need to. Although I strongly suggest you to use a terminal emulator just like Terminal. – Enterdavertex Nov 10 '14 at 0:58
  • 1
    I can confirm that at least for me, logging in as me (I left root login disabled) on another tty brings sound back. Also, regarding terminal emulators - I usually use Terminal, but Ubuntu sometimes freezes up (because Ubuntu is buggy :P), and I usually switch to a tty if that happens. – Hitechcomputergeek Feb 6 '16 at 21:24

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.