Getting Spotify to Work on Ubuntu-based Linux in 2021

This was a trick

One of the few online services for which I pay is Spotify. I enjoy the uninterrupted music, the podcasts, etc. And since I spend 95% of my time using Linux, I want it to work on Linux. I read a number of posts before I finally got the damned thing to work on various derivatives of Ubuntu Linux (Mint, Elementary OS, Zorin, Peppermint, etc).

Video would not play

The primary issue I had with Spotify, which I used to install from a .deb package, is that video podcasts failed to play the video streams. Basically, the whole thing was a little buggy.

The fix – some weirdness, but it works

I read numerous pages, on the web, which suggested numerous fixes. The following steps have worked every time, for me, since about November 2020. I’m not a serious “tech” person and I don’t know why all of this works – but it works.

  • Install Spotify, and some dependencies, from the following script:
    #!/bin/bash
    sudo apt-get install libatk-adaptor:i386 -y
    sudo apt-get install --reinstall overlay-scrollbar-gtk2
    echo "deb [trusted=yes] http://repository.spotify.com stable non-free" >> /etc/apt/sources.list
    sudo apt-get update
    sudo apt-get install spotify-client
    
    echo "-----------------------------------------------------"
    echo " First run is usually a problem.  Run the following  "
    echo " from a command line:                                "
    echo " while true; do spotify && exit; done                "
    echo "-----------------------------------------------------"
    echo ""
    exit
    
  • As indicated in the script, attempt to launch the program (as a user, not as root) from a command line with:
    while true; do spotify && exit; done 
  • In my experience, you may get a brown screen and the Spotify GUI may or may not display properly – if it does not display properly, don’t despair…… Just close the darned thing and continue with the following steps.
  • Before we do anything else, use your favorite text editor (nano, vim, gedit – whatever) and open the file /usr/share/applications/spotify.desktop and edit the line that starts with “Exec” to the following:
    Exec=spotify  %U --disable-gpu
  • Now, reboot your computer
  • Launch Spotify from it’s desktop shortcut, and, be patient – for whatever reason sometimes it launches very slowly the first time it’s run after this process. If it’s taking too long, kill the process and re-launch the app.
  • Sometimes videos, from podcasts, won’t play….the first time you try. Close the app and try again. If this dosen’t work, reboot – again. In my experience, while this makes no sense, videos will then start working and continue to work. As I’ve said, it’s all a mystery to me.
  • Bizarrely, in my experience, once it finally works it will work fine thereafter. Why? Ask some smart guy – I have no idea. But, again, once it starts working (based upon my experiences) it will continue to work fine. Videos will play, etc. If you still have problems, please leave a comment.

Leave a Reply