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

API call restartserver on macOS stops server but not starts #911

Closed
andreid1303 opened this issue Sep 27, 2023 · 21 comments
Closed

API call restartserver on macOS stops server but not starts #911

andreid1303 opened this issue Sep 27, 2023 · 21 comments

Comments

@andreid1303
Copy link

I am running LMS last beta 8.4.0 - 1695355776 on macOS Ventura and restart server action from web UI only stops the server but not starts.
I suppose this action is API restartserver call and I can't investigate the problem but found that restart-server.sh script in /Library/PreferencePanes/Squeezebox.prefPane/Contents/server/Bin/darwin/ folder works well if executed in ../../../

@michaelherger
Copy link
Member

If you checked the activity monitor, is LMS (perl, or slimserver.pl) gone?

@andreid1303
Copy link
Author

andreid1303 commented Sep 30, 2023

Yes, these two processes are gone on restart:

/Library/PreferencePanes/Squeezebox.prefPane/Contents/perl/bin/perl /Library/PreferencePanes/Squeezebox.prefPane/Contents/server/gdresized.pl 
/Library/PreferencePanes/Squeezebox.prefPane/Contents/perl/bin/perl ./slimserver.pl

Is there way to fix it?

@michaelherger
Copy link
Member

Hmm... seems to be working for me. Verified with both 8.3.1 and the latest 8.4.0:

  • installed a plugin
  • clicked "restart now"
  • verified plugin is installed
  • uninstalled again
  • clicked "restart now" again
  • verified its uninstalled

What system information do you see on Settings/Information?

@andreid1303
Copy link
Author

Actually I use Material Skin which has restart menu. When I switch to default skin, after installed a plugin only warning to restart, no "restart now" prompt.

Logitech Media Server Version: 8.4.0 - 1695355776 @ Fri Sep 22 06:21:22 CEST 2023
Hostname: mac-mini
Server IP Address: 172.22.0.23
Server HTTP Port Number: 9000
Operating system: macOS 13.5.2 - EN - utf8
Platform Architecture: x86_64
Perl Version: 5.34.0 - darwin-thread-multi-2level
Audio::Scan: 1.06
IO::Socket::SSL: 2.072
Database Version: DBD::SQLite 1.58 (sqlite 3.22.0)
Total Players Recognized: 8

Cache Folder
/Users/andrey/Library/Caches/Squeezebox
Preferences Folder
/Users/andrey/Library/Application Support/Squeezebox
Plugin Folders
/Users/andrey/Library/Caches/Squeezebox/InstalledPlugins/Plugins, /Users/andrey/Library/Application Support/Squeezebox/Plugins, /Library/Application Support/Squeezebox/Plugins, /Library/PreferencePanes/Squeezebox.prefPane/Contents/server/Plugins
Helper Applications Folder
/Library/PreferencePanes/Squeezebox.prefPane/Contents/server/Bin/darwin, /Library/PreferencePanes/Squeezebox.prefPane/Contents/server/Bin, /usr/local/bin, /usr/local/sbin, /bin, /usr/bin, /Users/andrey/Library/Caches/Squeezebox/InstalledPlugins/Plugins/DSDPlayer/Bin/darwin, /Users/andrey/Library/Caches/Squeezebox/InstalledPlugins/Plugins/DSDPlayer/Bin, /Users/andrey/Library/Caches/Squeezebox/InstalledPlugins/Plugins/RaopBridge/Bin, /Users/andrey/Library/Caches/Squeezebox/InstalledPlugins/Plugins/ShairTunes2W/Bin, /Users/andrey/Library/Caches/Squeezebox/InstalledPlugins/Plugins/Spotty/Bin/darwin-thread-multi-2level, /Users/andrey/Library/Caches/Squeezebox/InstalledPlugins/Plugins/Spotty/Bin, /Users/andrey/Library/Caches/Squeezebox/InstalledPlugins/Plugins/SqueezeDSP/Bin

@michaelherger
Copy link
Member

Oh, that's interesting! Are you running LMS as a system service which is started before you sign-in? Looking into related code I found this comment here:

https://github.com/Logitech/slimserver/blob/public/8.4/Slim/Utils/OS/OSX.pm#L445-L448

@andreid1303
Copy link
Author

Yes exactly, I am running LMS as system service /Library/LaunchDaemons/Squeezebox.plist under my admin user name!
So this is a limitation.

I don't want GUI auto login as admin to launch LMS.
Is there other approach to auto start on boot?
Is it possible to run LMS on macOS as user without admin rights?

@michaelherger
Copy link
Member

TBH I thought that running LMS this way on Mac had been broken a long time ago... Did you configure this yourself?

The standard installation nowadays would run LMS in the user's context. But that also means you'd have to sign that user in automatically.

I think the big overall issue is that the Mac integration would need a lot of work to be brought up to speed. The pref pane is still built on an OSX 10.5! And it's partially broken, as is this restart stuff. I don't even remember why we couldn't restart it in this configuration.

@andreid1303
Copy link
Author

andreid1303 commented Oct 1, 2023

Yes, I manually did copy Squeezelite.service to /Library/LaunchDaemonds/ added UserName key with my user name under which I installed LMS and loaded witch sudo launchctl load -w.

No issues actually on macOS 13.5.2 accept this one, but I still can restart LMS with ssh script as mentioned before without reloading service as sudo.
I do not use LMS pref pane at all since all settings are available in web interface.

@michaelherger
Copy link
Member

You seem to be technical. Would you be able to edit the above linked file in your installation to always return 1; in sub canRestartServer?

@andreid1303
Copy link
Author

Patching canRestartServer to always return 1 doesn't work. I have reloaded system service after patch, same behaviour: stops but not starts.

@mherger
Copy link
Contributor

mherger commented Oct 2, 2023

IMHO there are two issues:

You mentioned you were able to run restart-server.sh successfully. Would you have to give your password to do so?

@andreid1303
Copy link
Author

To restart LMS server in OSX via terminal:
cd /Library/PreferencePanes/Squeezebox.prefPane/Contents/server; Bin/darwin/restart-server.sh

@andreid1303
Copy link
Author

or better as a shell script:

#!/bin/sh
cd /Library/PreferencePanes/Squeezebox.prefPane/Contents/server
Bin/darwin/restart-server.sh

@michaelherger
Copy link
Member

And no sudo or root access required?

@andreid1303
Copy link
Author

andreid1303 commented Oct 2, 2023

Correct, no sudo or root access is required.

@andreid1303
Copy link
Author

andreid1303 commented Oct 2, 2023

edited

@andreid1303
Copy link
Author

Sorry, restarting from Material Skin is working since I edited sub canRestartServer to always return 1.
Web page just did not refreshed automatically.

@andreid1303
Copy link
Author

andreid1303 commented Oct 2, 2023

Here is my /Library/LaunchDaemons/Squeezebox.plist :

<plist version="1.0">
	<dict>
		<key>Label</key>
		<string>Squeezebox</string>
		<key>RunAtLoad</key>
		<true />
		<key>ProgramArguments</key>
		<array>
			
			<string>/Library/PreferencePanes/Squeezebox.prefPane/Contents/server/slimserver.pl</string>
		</array>
		<key>WorkingDirectory</key>
		<string>/Library/PreferencePanes/Squeezebox.prefPane/Contents/server</string>
		<key>StandardOutPath</key>
		<string>/Users/andrey/Library/Logs/Squeezebox/server.log</string>
		<key>StandardErrorPath</key>
		<string>/Users/andrey/Library/Logs/Squeezebox/server.log</string>
		<key>UserName</key>
		<string>andrey</string>
		</dict>
</plist>

@andreid1303
Copy link
Author

Also working in Default Skin now. I have rebooted for any case.

@michaelherger
Copy link
Member

So you're confirming that we could always restart? In that case I can simplify that canRestartServer.

@andreid1303
Copy link
Author

Yes, I confirm that. Thank you.

@mherger mherger closed this as completed in 80de631 Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants