librespot-org / librespot-golang

Go port of librespot, the Open Source Spotify client library
MIT License
169 stars 40 forks source link

Installation on v-server without audio #20

Closed rafaelmaeuer closed 5 years ago

rafaelmaeuer commented 5 years ago

I tried to install it on ubuntu server. First installed all required dependencies, but when I start main.go a bunch of ALSA errors are displayed: cannot find card '0'. Obviously there is no sound card on a v-server so how to get over this problem? I read a lot about snd-dummy - a dummy sound card only to get the process running, but couldn't get it running so far.

rafaelmaeuer commented 5 years ago

If anyone else should face the same problem, I will share my solution:

  1. You might need to add snd-dummy to /etc/modules and add your user in /etc/groups on line audio:x:29:, restart machine afterwards (solution found here).

  2. Install this package (solution found here)

     sudo apt install linux-generic

    to make snd-dummy available.

  3. Load the module with

     sudo modprobe snd-dummy

    and check for correct configuration with

     lsmod | grep snd

    which should output something like

     snd_dummy              20483  0 
     snd_pcm               102099  1 snd_dummy
     snd_page_alloc         18710  1 snd_pcm
     snd_seq_midi           13324  0 
     snd_seq_midi_event     14899  1 snd_seq_midi
     snd_rawmidi            30144  1 snd_seq_midi
     snd_seq                61560  2 snd_seq_midi_event,snd_seq_midi
     snd_seq_device         14497  3 snd_seq,snd_rawmidi,snd_seq_midi
     snd_timer              29482  2 snd_pcm,snd_seq
     snd                    69238  7
     snd_dummy,snd_timer,snd_pcm,snd_seq,snd_rawmidi,snd_seq_device,snd_seq_midi
     soundcore              12680  1 snd

This should fix ALSA lib error cannot find card '0'.

If you are still facing a lot of Unknown PCM cards.xxx errors

  1. Edit /usr/share/alsa/alsa.conf and set all related pcm.xxx cards.pcm.xxx entries to pcm.xxx cards.pcm.default (solution found here).

Now librespot should start without any error.