-
-
Notifications
You must be signed in to change notification settings - Fork 569
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
Daemon returned 2 as return value. #2
Comments
Thanks for your kind words. The problem is that buildroot places shairport-sync in /usr/bin/shairport, but the init script file /etc/init.d/shairport (also at https://github.com/mikebrady/shairport-sync/blob/2.0/scripts/shairport), line 20 says to use the program /usr/local/bin/shairport, so basically, the init file is looking in the wrong place! Editing that line to say /usr/bin/$NAME would fix that. Another related issue is that the init script expects the directory /usr/var/run/ to be in existence – you might have to add a line to create it. |
I found that simply creating /usr/var/run solved the error 2 Naturally you could also fix this at source by changing /usr/var/run/shairport.pid to /var/run/shairport.pid |
@mikebrady : I did not use the provided init script file, but run "shairport -d" from console. |
Shairport should leave a message in the logfile. Can you see if it's there? Also – just backing up a bit – does shairport -v work (i.e. verbose mode, and not daemon mode)? Also, thanks for your suggestions. At present, I'm focused more on trying to get overall functionality right; I'll certainly look at your suggestions later. |
Another possibility is to run shairport in supervisor mode, e.g. |
@joerg-krause, I'm wondering if I can close the issue as solved? |
Sorry, I did not had the time to make any further tests. Non daemon mode worked and there is only root on my embedded system. I guess that zoomzoomluke is right with his suggestion to create /usr/var/run. |
Okay, if it's okay with you I'll close this issue. Version 2.1 is out, which doesn't change this behaviour, but you might be interested anyway: https://github.com/mikebrady/shairport-sync/blob/2.1/README.md. |
I'm still having this "Daemon returned 2 as return value" error. I think libdaemon tries to start at /usr/var/run/ which does not exists (but /var/run do). I changed the init script file:
I also tried to configure with
but it does not help. |
Hi there. A couple of things:
|
|
Thanks. The result from |
I'm using buildroot to build my custom linux system. |
Thanks. I might give it a try. Are you building for an x86 32-bit? |
Building for arm926t. The package shairport-sync is not upstream yet. I am still testing...but I can send you an patch, if necessary. |
I think I might have found it. For some reason, Here is a sample startup script for shairport-sync incorporating this idea. The file is at
This works on my |
You are right! The default behaviour of libdaemon is to run in /usr/var/run. This can be overrriden by setting localstatedir to autotools configure. OpenWrt sets this to /var globally, but buildroot doesn't. Running in /usr/var/run is not a good idea, since it may be mounted read-only on some systems. There are two possibilities to solve this issue for buildroot:
|
Problem solved. Can be closed now :-) |
Thanks for your explanation of its significance. It does appear as if libdaemon can be explicitly told how to calculate where to put the PID file (e.g. see Avahi), but I'll have to add a little code to shairport-sync to do it. I'll give it a try in the next little while. |
I updated Shairport Sync to take a new Update -- actually, it's not quite ready. Doesn't work right on a debian system :( |
To clarify the above, Shairport Sync now takes a new |
First, many thanks for the work. But let me explain: I submitted a patch to buildroot which will set About localstatedir
What's all this about? Allmost all linux distributions follow the FHS for their filesystem hierarchy. And some deviate from the standard in some areas. For example most distros, eg. Debian, use the How about buildroot? Buildroot follows the FHS (and also uses the symlinks to That's why the user can override the default setting of Summarized The package libdaemon should be build with That's why I think it's not necessary to change |
Thanks again for the posts – very interesting. I agree that it should not be necessary for shairport-sync to change the The update made and then withdrawn yesterday (2.1.4) did attempt to use Using Of course, I could be wrong – the above reflects my understanding, and I'm no Autotools expert. Comments welcome! |
I don't think that Debian uses If you do not set
Buildroot and Debian set To be pedantic, you cannot override the localstatedir for libdaemon as it is defined at compile time. But you can, and this is what you are doing, change the location of the pid file. Furthermore the bug in Buildroot not setting What I would suggest is to change the |
I'm glad to hear the bug in Buildroot is fixed – TBH, I though it might take longer. Following your suggestion, almost, I will rename the directive to |
Many thanks! I have another remark, but I will open a new issue. So this can be closed now, I think. |
Thanks. I'll roll that directive mod into an update. Closing the issue! |
Fix ClientIP info in metadata [development branch; attempt #2] Many thanks!
atexit(3) handler immediately before main() exits seems redundant. On OpenBSD 7.4-current, failure to listen on the RTSP socket triggers ``` $ nc -4l 5000 & $ nc -6l 5000 & $ shairport-sync -c/dev/null warning: could not establish a service on port 5000 -- program terminating. Is another instance of Shairport Sync running on this device? Segmentation fault (core dumped) ``` ``` Program terminated with signal SIGSEGV, Segmentation fault. #0 pthread_cancel (thread=0x6207604e640) at /usr/src/lib/librthread/rthread.c:433 433 if (tib->tib_canceled == 0 && tid != 0 && [Current thread is 1 (process 290061)] #0 pthread_cancel (thread=0x6207604e640) at /usr/src/lib/librthread/rthread.c:433 mikebrady#1 0x0000061e5377df14 in exit_rtsp_listener () mikebrady#2 0x000006212fdb4140 in _libc___cxa_finalize (dso=0x0) at /usr/src/lib/libc/stdlib/atexit.c:177 mikebrady#3 0x000006212fde9c45 in _libc_exit (status=0) at /usr/src/lib/libc/stdlib/exit.c:54 mikebrady#4 0x0000061e5377ba88 in _start () ``` Fix this by omitting the explicit pthread_cancel(3), at which point exit_rtsp_listener() becomes redundant, so remove it entirely.
Process teardown stops all threads, thus calling pthread_cancel(3) in an atexit(3) handler immediately before main() exits seems redundant. On OpenBSD 7.4-current, failure to listen on the RTSP socket triggers ``` $ nc -4l 5000 & $ nc -6l 5000 & $ shairport-sync -c/dev/null warning: could not establish a service on port 5000 -- program terminating. Is another instance of Shairport Sync running on this device? Segmentation fault (core dumped) ``` ``` Program terminated with signal SIGSEGV, Segmentation fault. #0 pthread_cancel (thread=0x6207604e640) at /usr/src/lib/librthread/rthread.c:433 433 if (tib->tib_canceled == 0 && tid != 0 && [Current thread is 1 (process 290061)] #0 pthread_cancel (thread=0x6207604e640) at /usr/src/lib/librthread/rthread.c:433 mikebrady#1 0x0000061e5377df14 in exit_rtsp_listener () mikebrady#2 0x000006212fdb4140 in _libc___cxa_finalize (dso=0x0) at /usr/src/lib/libc/stdlib/atexit.c:177 mikebrady#3 0x000006212fde9c45 in _libc_exit (status=0) at /usr/src/lib/libc/stdlib/exit.c:54 mikebrady#4 0x0000061e5377ba88 in _start () ``` Fix this by omitting the explicit pthread_cancel(3), at which point exit_rtsp_listener() becomes redundant, so remove it entirely.
Hi Mike,
thanks for the fantastic rework on shairport. I suscessfully cross-compiled shairport-sync as a package within buildroot. But trying to start shairport as a daemon fails with:
Daemon returned 2 as return value.
I previous used shairport from abrasive, which ran fine as a daemon. Any suggestions?
The text was updated successfully, but these errors were encountered: