9

How can I install the Sonos controller on Ubuntu and access the music library ?

5
  • This is something you should ask the software vendor. Apr 19, 2016 at 14:45
  • The software vendor does not support a linux version of its software and is not planning to do so. Apr 19, 2016 at 18:15
  • This question should definitely be closed then. Apr 19, 2016 at 18:43
  • 2
    I asked the question and answered it myself so I can post a tutorial on how to install it anyway, with a few workarounds. If it is not the proper way to do it please tel me and I would be glad to improve my Q&A. Apr 19, 2016 at 20:54
  • 5
    why do people have so much interest in getting others questions closed? Apr 26, 2016 at 14:57

7 Answers 7

6

Here is a tutorial to install Sonos on ubuntu using Wine, PlayonLinux and Samba (for the music library).

Install the Sonos Controller

The first thing to do is to install Wine and PlayonLinux so your computer can use Windows software. Open a terminal (ctrl+alt+t) and copy/paste the following line by line.

sudo apt-get install wine
sudo apt-get install playonlinux

Then download the latest version of the Sonos Controller for Windows.

Start PlayonLinux and click on "install a program". A new window opens. Select "Install a non listed program" (at the bottom). If it is the first time you use PlayonLinux you may not have this option. Then close the window and re-open it.

Select "install in a new virtual drive". Name the drive however you want (but "sonos" seems a logical choice). Untick the boxes that may be ticked and choose "32-bit installation". Browse to the sonos controller you downloaded and click "next".

The installer starts. Install the software (leave everything as it is) but DO NOT run the application after setup. At the end of the installation PlayonLinux proposes you to create shortcuts. Create one for the sonos.exe file. You now have a Sonos launcher on your desktop. You can change its icon to a Sonos icon and drag it to the launcher.

Sonos is now listed in PlayonLinux. Right click on it and select "configure wine". In "application" make sure "Windows XP" is selected.

In PlayonLinux select "Sonos" and click on "configure" (on the right side of the window). A window opens. Go to "install components", look for "dotnet40" and install it.

Start the application. Click "next" and then choose "don't configure windows firewall". Your Sonos controller is now installed and ready to work.

Make the Sonos Controller fullscreen

If double clicking on the menu bar of the Sonos controller works for you, skip this part of the tutorial.

If double clicking on the menu bar freezes your controller follow these steps to make your controller fullscreen.

Make sure Sonos is not working. Open PlayonLinux, right click on Sonos and select "configure wine". Go to the "graphics" tab and select "emulate a virtual desktop". Increase the resolution to 1000x800. Close Wine.

Start Sonos. The application will start in a virtual desktop. It is ugly but we will get rid of it. Double click on the menu bar to make Sonos fullscreen in the virtual desktop. Close Sonos.

Go back to PlayonLinux, right click, "configure wine". Untick "emulate a virtual desktop". Close Wine and PlayonLinux. Start Sonos. It should be fullscreen.

If your controller is still not fullscreen, repeat the operation but increase the resolution of the virtual desktop to its maximum (similar to your own resolution).

Access the music library

To access your music library is a bit more complicated but still doable. To do so we will use Samba and create a network share.

The first thing to do is to install Samba.

sudo apt-get update
sudo apt-get install samba

Create a username and a password for Samba (they can be different or similar to your usual username and password). In the following line replace username by the username of your choice.

sudo smbpasswd -a username

You will then be asked to create a password.

For the following I suppose the folder you wish to share and to set as your music library is your music folder (/home/username/Music). If not change as needed.

Edit the samba configuration file

sudo gedit /etc/samba/smb.conf

Once the file is open add at the very end

[Folder Name]
path = /home/username/Music
valid users = username
read only = n

Name the folder whatever you want. Change the path to set it with your username. The username in "valid users" should be the username you set earlier for samba. Save the changes and close gedit.

You now need to restart samba

sudo service smbd restart

Your music folder is ready to be shared.

Start Sonos. Click on "manage" and open "music library settings". Click "add" and choose "on a networked device such as a network attached storage (NAS) drive".

Write the path this way:

//computer's name/folder name

So if my computer is called "Poulpe" and I named my folder "Music" in the samba configuration file, my network will be:

//Poulpe/Music

Sonos asks you a username and a password. Give the one you set at the beggining in samba.

You Sonos is now working, fullscreen, and you can access your music library.

Thanks

It would have been impossible for me to use Sonos on my computer, and to write this tutorial, without this article on Michael's blog, this tutorial on help.ubuntu and a few posts on the sonos support forum from a guy named Keith.

English in not my mother tongue. If there is mistakes or if something could be better explained please tell me, I'd be thankful.

2
  • 1
    Hello Le3eVolfoni and thanks for your post! I tried this but with the latest windows client (6.3) and I cannot make it work on my Ubuntu :( Does it work for you with this version?
    – arthur
    Jul 28, 2016 at 8:16
  • not working with version 7.3 Jul 29, 2017 at 6:05
3

Native applications to control Sonos devices have existed for a few years.

See mine at: https://launchpad.net/~jlbarriere68/+archive/ubuntu/noson-app

The source is hosted at https://github.com/janbar/noson-app .

screenshots: https://uappexplorer.com/app/noson.janbar

1

If you use Spotify - the Spotify native Linux client can now control your Sonos system. One of the best features they've ever added IMO..

You can find out how install the Spotify client on Ubuntu here:

2
  • You probably need a premium subscription to use this feature, right?
    – chilliq
    Feb 19, 2017 at 15:56
  • Now not needed.
    – ipeacocks
    Mar 21, 2020 at 12:50
0

I use a free java client utility, so this should do the job. Janos

I got the newest controller not working with wine and also not with play on linux. But I can do most operations with that utility ; )

0

For some time i use this browser based controller now.

simple but works

sudo apt install nodejs-legacy

just extract the contents of sonos-browser.tar.gz to /home/yourusername/bin/.

run the sonos.sh (or just the command in there)

run the sonos.html inside the sonos folder (bookmark it)

it gives access to favorites and controls (i did my initial setup via android sonos controller)

P.S. you might need to change IP to your SonoS IP, but i guess it should work without any changes too.

0

For programmers I found it really comfortable to use http://python-soco.com with ipython , example:

import soco
s=soco.SoCo('1.2.3.4')
s.clear_queue()
with open('playlist.m3u', 'r') as f:
  for l in f:
   s.add_uri_to_queue('http://192.168.1.5:8080/MusicShared/'+l.rstrip('\n'))
s.play _from_queue(0)

longer example from https://gist.github.com/gwpl/92ab540016bf43359654d5b0f013b1ec :

#!/usr/bin/env python3
import sys
import soco

# Take ip from `socos list` or soco.discover()
ip='192.168.1.106'
print('Playing on Speaker with ip='+ip)
s=soco.SoCo(ip)
print(' get_speaker_info()='+str(s.get_speaker_info()))

s.clear_queue()
for m3u_filename in sys.argv[2:]:
    print('Adding m3u...'+m3u_filename)
    with open(m3u_filename, 'r') as m3u_filehandler:
        for line in m3u_filehandler:
            filename = line.rstrip('\n')
            print('..."'+filename+'"')
            s.add_uri_to_queue('http://192.168.1.99:8080/MusicShared/'+filename)
s.play_from_queue(0)

(btw. my thread about this : https://twitter.com/GWierzowiecki/status/991453357234585601 )

0

I made a quick and dirty Sonos driver for Linux Pulseaudio, written in Python, that uses VLC to stream to Sonos speakers.

The driver is available at https://github.com/antonylesuisse/sonos

Installation:

sudo apt-get install alsa-utils ffmpeg pulseaudio-utils vlc
pip3 install soco
wget -O sonos https://raw.githubusercontent.com/antonylesuisse/sonos/master/sonos
chmod +x sonos

Usage:

./sonos

Type Ctrl-C to stop streaming to sonos.

1
  • 1
    Thanks for sharing this! Including installation instructions in the post might be good.
    – Zanna
    Mar 27, 2021 at 15:07

You must log in to answer this question.

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