Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't start Snapserver service #643

Closed
kriegfalke opened this issue Jun 17, 2020 · 8 comments
Closed

Can't start Snapserver service #643

kriegfalke opened this issue Jun 17, 2020 · 8 comments
Labels
next release fixed in develop branch and will be part of the next release

Comments

@kriegfalke
Copy link

Hello,
I configured the software are per mentionned in GitHub page. Everything goes well when compiling info in my config file:
pi@raspberrypi:~ $ snapserver
2020-06-17 14-11-35.559 [Info] (main) Adding stream: pipe:///tmp/snapfifo?name=Radio&sampleformat=48000:16:2&codec=flac
2020-06-17 14-11-35.559 [Notice] (init) Settings file: "/home/pi/.config/snapserver/server.json"
2020-06-17 14-11-35.572 [Info] (Avahi) Adding service 'Snapcast'
2020-06-17 14-11-35.580 [Info] (start) Creating TCP acceptor for address: 192.168.2.33, port: 1705
2020-06-17 14-11-35.580 [Info] (start) Creating HTTP acceptor for address: 0.0.0.0, port: 1780
2020-06-17 14-11-35.581 [Info] (PcmStream) PcmStream sampleFormat: 48000:16:2
2020-06-17 14-11-35.581 [Info] (PcmStream) metadata={
2020-06-17 14-11-35.581 [Info] (PcmStream) "STREAM": "Radio"
2020-06-17 14-11-35.581 [Info] (PcmStream) }
2020-06-17 14-11-35.581 [Info] (onMetaChanged) onMetaChanged (Radio)
2020-06-17 14-11-35.581 [Info] (PipeStream) PipeStream mode: create
2020-06-17 14-11-35.581 [Info] (start) Stream: {"fragment":"","host":"","path":"/tmp/snapfifo","query":{"chunk_ms":"20","codec":"flac","name":"Radio","sampleformat":"48000:16:2"},"raw":"pipe:////tmp/snapfifo?chunk_ms=20&codec=flac&name=Radio&sampleformat=48000:16:2","scheme":"pipe"}
2020-06-17 14-11-35.583 [Info] (start) Creating stream acceptor for address: 192.168.2.33, port: 1704
2020-06-17 14-11-35.583 [Info] (main) number of threads: 4, hw threads: 4
2020-06-17 14-11-36.431 [Info] (Avahi) Service 'Snapcast' successfully established.
Segmentation fault

But it doesn't start
input:
sudo service snapserver start

Here's the status

● snapserver.service - Snapcast server
Loaded: loaded (/lib/systemd/system/snapserver.service; enabled; vendor preset: enabled)
Active: failed (Result: signal) since Wed 2020-06-17 14:13:46 EDT; 19s ago
Docs: man:snapserver(1)
Process: 2558 ExecStart=/usr/bin/snapserver --logging.sink=system --server.datadir=${HOME} $SNAPSERVER_OPTS (code=killed,
Main PID: 2558 (code=killed, signal=ABRT)

Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Service RestartSec=100ms expired, scheduling restart.
Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Scheduled restart job, restart counter is at 5.
Jun 17 14:13:46 raspberrypi systemd[1]: Stopped Snapcast server.
Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Start request repeated too quickly.
Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Failed with result 'signal'.
Jun 17 14:13:46 raspberrypi systemd[1]: Failed to start Snapcast server.

Here's what's in my default folder:
START_SNAPSERVER=true
SNAPSERVER_USER="--user snapserver:snapserver"
SNAPSERVER_OPTS="-d -s pipe:///tmp/snapfifo?name=default"

And what is in my config file:
[stream]
bind_to_address = 192.168.2.33
port = 1704
stream = pipe:///tmp/snapfifo?name=Radio&sampleformat=48000:16:2&codec=flac
#stream = pipe:///tmp/snapfifo?name=Radio&mode=read

#[http]
#enabled = true
#bind_to_address = 0.0.0.0
#port = 1780
#doc_root = /snapcast/server/page #tried to add snapweb and it didn't work either - this is for another issue...

[tcp]
enabled = true
bind_to_address = 192.168.2.33
port = 1705

Can you help me?

Thanks

@badaix
Copy link
Owner

badaix commented Jun 17, 2020

what is logged into /var/log/syslog?
The SNAPSERVER_OPTS should be empty, also the SNAPSERVER_USER
Did you install it using sudo make installserver or using the debian package?
Also the last line doesn't look good:

2020-06-17 14-11-35.583 [Info] (start) Creating stream acceptor for address: 192.168.2.33, port: 1704
2020-06-17 14-11-35.583 [Info] (main) number of threads: 4, hw threads: 4
2020-06-17 14-11-36.431 [Info] (Avahi) Service 'Snapcast' successfully established.
Segmentation fault

@kriegfalke
Copy link
Author

Hello,
I did the install using sudo make installserver. For that, I needed to install boost manually with a version that was after 1.70.

Jun 17 14:12:43 raspberrypi PackageKit: daemon quit Jun 17 14:12:43 raspberrypi systemd[1]: packagekit.service: Main process exited, code=killed, status=15/TERM Jun 17 14:12:43 raspberrypi systemd[1]: packagekit.service: Succeeded. Jun 17 14:13:45 raspberrypi systemd[1]: Started Snapcast server. Jun 17 14:13:45 raspberrypi snapserver[2551]: Adding stream: pipe:///tmp/snapfifo?name=Radio&sampleformat=48000:16:2&codec=flac Jun 17 14:13:45 raspberrypi snapserver[2551]: Exception: failed to create settings directory: "/var/lib/snapserver/": 13 Jun 17 14:13:45 raspberrypi snapserver[2551]: terminate called after throwing an instance of 'SnapException' Jun 17 14:13:45 raspberrypi snapserver[2551]: what(): failed to create settings directory: "/var/lib/snapserver/.config/snapserver/": 13 Jun 17 14:13:45 raspberrypi systemd[1]: snapserver.service: Main process exited, code=killed, status=6/ABRT Jun 17 14:13:45 raspberrypi systemd[1]: snapserver.service: Failed with result 'signal'. Jun 17 14:13:45 raspberrypi systemd[1]: snapserver.service: Service RestartSec=100ms expired, scheduling restart. Jun 17 14:13:45 raspberrypi systemd[1]: snapserver.service: Scheduled restart job, restart counter is at 1. Jun 17 14:13:45 raspberrypi systemd[1]: Stopped Snapcast server. Jun 17 14:13:45 raspberrypi systemd[1]: Started Snapcast server. Jun 17 14:13:45 raspberrypi snapserver[2555]: Adding stream: pipe:///tmp/snapfifo?name=Radio&sampleformat=48000:16:2&codec=flac Jun 17 14:13:45 raspberrypi snapserver[2555]: Exception: failed to create settings directory: "/var/lib/snapserver/": 13 Jun 17 14:13:45 raspberrypi snapserver[2555]: terminate called after throwing an instance of 'SnapException' Jun 17 14:13:45 raspberrypi snapserver[2555]: what(): failed to create settings directory: "/var/lib/snapserver/.config/snapserver/": 13 Jun 17 14:13:45 raspberrypi systemd[1]: snapserver.service: Main process exited, code=killed, status=6/ABRT Jun 17 14:13:45 raspberrypi systemd[1]: snapserver.service: Failed with result 'signal'. Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Service RestartSec=100ms expired, scheduling restart. Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Scheduled restart job, restart counter is at 2. Jun 17 14:13:46 raspberrypi systemd[1]: Stopped Snapcast server. Jun 17 14:13:46 raspberrypi systemd[1]: Started Snapcast server. Jun 17 14:13:46 raspberrypi snapserver[2556]: Adding stream: pipe:///tmp/snapfifo?name=Radio&sampleformat=48000:16:2&codec=flac Jun 17 14:13:46 raspberrypi snapserver[2556]: Exception: failed to create settings directory: "/var/lib/snapserver/": 13 Jun 17 14:13:46 raspberrypi snapserver[2556]: terminate called after throwing an instance of 'SnapException' Jun 17 14:13:46 raspberrypi snapserver[2556]: what(): failed to create settings directory: "/var/lib/snapserver/.config/snapserver/": 13 Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Main process exited, code=killed, status=6/ABRT Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Failed with result 'signal'. Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Service RestartSec=100ms expired, scheduling restart. Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Scheduled restart job, restart counter is at 3. Jun 17 14:13:46 raspberrypi systemd[1]: Stopped Snapcast server. Jun 17 14:13:46 raspberrypi systemd[1]: Started Snapcast server. Jun 17 14:13:46 raspberrypi snapserver[2557]: Adding stream: pipe:///tmp/snapfifo?name=Radio&sampleformat=48000:16:2&codec=flac Jun 17 14:13:46 raspberrypi snapserver[2557]: Exception: failed to create settings directory: "/var/lib/snapserver/": 13 Jun 17 14:13:46 raspberrypi snapserver[2557]: terminate called after throwing an instance of 'SnapException' Jun 17 14:13:46 raspberrypi snapserver[2557]: what(): failed to create settings directory: "/var/lib/snapserver/.config/snapserver/": 13 Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Main process exited, code=killed, status=6/ABRT Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Failed with result 'signal'. Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Service RestartSec=100ms expired, scheduling restart. Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Scheduled restart job, restart counter is at 4. Jun 17 14:13:46 raspberrypi systemd[1]: Stopped Snapcast server. Jun 17 14:13:46 raspberrypi systemd[1]: Started Snapcast server. Jun 17 14:13:46 raspberrypi snapserver[2558]: Adding stream: pipe:///tmp/snapfifo?name=Radio&sampleformat=48000:16:2&codec=flac Jun 17 14:13:46 raspberrypi snapserver[2558]: Exception: failed to create settings directory: "/var/lib/snapserver/": 13 Jun 17 14:13:46 raspberrypi snapserver[2558]: terminate called after throwing an instance of 'SnapException' Jun 17 14:13:46 raspberrypi snapserver[2558]: what(): failed to create settings directory: "/var/lib/snapserver/.config/snapserver/": 13 Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Main process exited, code=killed, status=6/ABRT Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Failed with result 'signal'. Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Service RestartSec=100ms expired, scheduling restart. Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Scheduled restart job, restart counter is at 5. Jun 17 14:13:46 raspberrypi systemd[1]: Stopped Snapcast server. Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Start request repeated too quickly. Jun 17 14:13:46 raspberrypi systemd[1]: snapserver.service: Failed with result 'signal'. Jun 17 14:13:46 raspberrypi systemd[1]: Failed to start Snapcast server.

BTW snapclient fails to start also with the same error message... but this is for another issue I guess.

@kriegfalke
Copy link
Author

kriegfalke commented Jun 17, 2020

OK - I changed SNAPSERVER_OPTS and SNAPSERVER_USER back to default. The problem is still the same. Do you think this has to do with snapserver command? I tried sudo snapserver instead.
Here is the result:
2020-06-17 18-59-59.369 [Info] (main) Adding stream: pipe:///tmp/snapfifo?name=Radio&sampleformat=48000:16:2&codec=flac 2020-06-17 18-59-59.369 [Notice] (init) Settings file: "/root/.config/snapserver/server.json" 2020-06-17 18-59-59.379 [Info] (Avahi) Adding service 'Snapcast' 2020-06-17 18-59-59.387 [Info] (start) Creating TCP acceptor for address: 192.168.2.33, port: 1705 2020-06-17 18-59-59.388 [Info] (start) Creating HTTP acceptor for address: 0.0.0.0, port: 1780 malloc(): corrupted top size Aborted

The reason why we have "Segmentation fault" is because I am executing snapclient in another window while snapserver is in the current window. Snapserver gets stuck to "(Avahi) Service 'Snapcast' successfully established."

I created the files reported above and now the error showing is this:
Exception: failed to open file "/var/lib/snapserver/server.json", permission denied (error 13)

@badaix
Copy link
Owner

badaix commented Jun 18, 2020

Please use triple backtick to quote logs, your's with a single backtick are hard to read:
```
logs go here
```

Have you had an old installation (the SNAPSERVER_OPTS were looking like that, it shouldn't be described in the docs that way)? The systemd service will start snapserver with the user snapserver, and this user doesn't have permissions to access /var/lib/snapserver. Can you check who is owning the directory?
A chmod -R snapserver:snapserver /var/lib/snapserver should fix the problem.
Also an uninstall/install might fix it (if there was an old installation). If this was the first installation, then there is a problem with the install target in the makefile. Could happen, I've just tested the debian packages, and I'm missing a QA department ;).

No matter what, the server should not segfault or get stuck. I cannot reproduce this. Can you describe how to reproduce it, maybe with debug logging enabled (--logging.filter=debug)?

@kriegfalke
Copy link
Author

Hello again,
I reinstalled the package using the *.deb files and now both snapclient and snapserver are working!!!
Sorry for the backticks... I'm totally new at this.
For the other people like me that would go install snapcast using make install I would not recommend it.

@badaix
Copy link
Owner

badaix commented Jun 18, 2020

Ok, I will anyways check if the make install is broken.
BTW: for inline code, use one backtick and for code blocks use three backticks.

@klundry
Copy link

klundry commented Jul 22, 2020

I am experiencing this same problem. Fresh install of armbian (debian buster) and snapserver fails to start and gives me the same Failed to create settings directory messages. There is no /var/lib/snapserver directory.

Snapserver runs successfully when starting it manually as a user but not as a service.

@badaix badaix added the next release fixed in develop branch and will be part of the next release label Aug 18, 2020
@badaix badaix closed this as completed in 80ab0be Aug 26, 2020
@holytrousers
Copy link

holytrousers commented Oct 23, 2021

Please use triple backtick to quote logs, your's with a single backtick are hard to read: logs go here

Have you had an old installation (the SNAPSERVER_OPTS were looking like that, it shouldn't be described in the docs that way)? The systemd service will start snapserver with the user snapserver, and this user doesn't have permissions to access /var/lib/snapserver. Can you check who is owning the directory? A chmod -R snapserver:snapserver /var/lib/snapserver should fix the problem. Also an uninstall/install might fix it (if there was an old installation). If this was the first installation, then there is a problem with the install target in the makefile. Could happen, I've just tested the debian packages, and I'm missing a QA department ;).

No matter what, the server should not segfault or get stuck. I cannot reproduce this. Can you describe how to reproduce it, maybe with debug logging enabled (--logging.filter=debug)?

Hi badaix, i think you meant chown -R snapserver:snapserver /var/lib/snapserver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next release fixed in develop branch and will be part of the next release
Projects
None yet
Development

No branches or pull requests

4 participants