Open superbam opened 1 year ago
This is happening for me as well on an Intel Mac running 13.0.1. All seems good if I run
systemctl load /Library/LaunchDaemons/meshagent.plist
after boot.
In my case systemctl doesn't exist but I was able to do the same thing with launchctl.
On an M1 system the command was: sudo launchctl load /Library/LaunchDaemons/meshagent_osx64_LaunchDaemon.plist On an Intel system the command was: sudo launchctl load /Library/LaunchDaemons/meshagent.plist
Confirmed that it brings the service back to life. Unfortunately it doesn't help it survive a reboot.
Suggestions?
+1 for me too on M1 system and Ventura 13.2
+1 here.
I may have found a solution to this. If you run:
sudo nano /Library/LaunchDaemons/meshagent.plist
And modify the file to match this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.mesh.meshagent</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/mesh_services/meshagent/meshagent</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<dict>
<key>Crashed</key>
<true/>
</dict>
</dict>
</plist>
Exit and save the file and then restart the computer and the Mesh Agent should load.
@superbam Perfect - worked for me! Thanks!
@superbam this also fixed my issue. my meshagent was named different meshagent_osx64... as long as i made the changes it boots perfectly. Thx
This works. But I am getting blank screen on the Login page. I needed to login to make the screen available. Do anyone know why?
This works. But I am getting blank screen on the Login page. I needed to login to make the screen available. Do anyone know why?
Hi @AymanAnsari
i guess the mac screen is black in reality too? So the mac is "sleeping". You have to wake up before login in desktop.
Just login in Terminal first. To wake up the mac type for example
caffeinate -u -t 2
Then log out from terminal and log in to the Desktop. ;-)
No. it is not black in reality. As from other remote agent I can see the screen and connect. But only on Mesh it is showing this issue.
This works. But I am getting blank screen on the Login page. I needed to login to make the screen available. Do anyone know why?
I have this same symptom and i have spent time looking at the plist files running processes etc I have discovered that a funny symptom is that you have to manually log into the MacOS as a user - after that you can connect with meshagent, do everything normally (after adding the right permssions for Screen Recording and Accessibility)
Im not sure how everything works but one thing I noticed is that It has to have 2 processes running - the standard one that is under "LaunchDaemons" and the kvm one that is under "LaunchAgents". I also had to do the mentioned naming fix. It seems that both having the same label makes agent not start.
I got some good inspiration from another similar remote desktop related project - it describes how it is setup. Its experimental and doesnt work for me at all, but I got some some ideas from there https://github.com/team-unstablers/ulalaca
Basically before login there should be something running as "meshagent -kvm1" but after successful login locally or with mac vnc remote management it is terminated and becomes meshagent -kvm0 running as user1 for example
If the user logs out, it becomes meshagent -kvm1 again. I think there might be some permission issues or naming issues.
user1 3635 66.4 0.5 409197664 86080 ?? R 10:26AM 0:28.96 meshagent -kvm0
root 300 0.0 0.1 409351600 22640 ?? Ss 10:19AM 0:01.95 /usr/local/mesh_services/meshagent/meshagent --no-embedded="1" --installedByUser=NaN
root 4263 0.0 0.5 409038272 78656 ?? Ss 10:28AM 0:01.82 /usr/local/mesh_services/meshagent/meshagent -kvm1
root 300 0.0 0.1 409351600 23568 ?? Ss 10:19AM 0:02.07 /usr/local/mesh_services/meshagent/meshagent --no-embedded="1" --installedByUser=NaN
just an update for people. ive found the issue,
macos requires unique names inside the plist files across LaunchDaemons
AND LaunchAgents
so a simple fix is to change the Label 'meshagent' (or your app name) inside 'LaunchAgents/meshagent.plist' to 'meshagent-launchagent' (or `yourappname-launchagent')
and restart ur mac
'LaunchDaemons' loads the application at startup,
where as 'LaunchAgents' loads the kvm side of things for meshagent when a user logs in
from launchd.info
Theoretically it is possible for an agent to have the same label as a daemon, as daemons are loaded by the root launchd whereas agents are loaded by a user launchd, but it is not recommended.
EDIT: the issue/fix was actually here just didnt spot it! https://github.com/Ylianst/MeshAgent/issues/161
Plz can people try the pkg in 1.1.22 which has bug fixes now
I know its quite an old bug but I havent had time to even comment here. Well there are 2 seperate problems here... One is the bug thats easy to fix and the other one is harder.
I made a simple agent helper script, that incoroprotes some of the suggestions and renames some stuff in the plist file.
maybe someone will find it useful too.
xattr -r -d com.apple.quarantine meshagent
chmod +x ./meshagent
sudo ./meshagent -install
sudo -i #had to be root, to change that plist file... and check later - maybe someone can suggest better solution here?
sed -i -e "s#>meshagent#>meshagent-launchagent#g" /Library/LaunchAgents/meshagent.plist
cat /Library/LaunchAgents/meshagent.plist | grep ">meshagent"
After all these - and enabling "automatic login" the mesh agent autostarts after reboot and works on latest mac OS 14.6.1 I have linux background and from what I can see, the mesh should try to "bind" somehow to the login manager somehow like the VNC agent (built in remote desktop thats is on port 5900) is doing. In linux its gdm, lightdm etc...
@veixus thank you for the helper script, this has already been fixed in the source code, we just need to do new agent builds! (im hoping to try build a few over the next week or 2 for people to try for me!)
also yes sadly still no control over the login screen on first start up :( so the automatic login is indeed required!
MeshCentral 1.1.0, MacOS 13.0.1 on M1 Pro
After installing the MeshAgent the service will run and connect but disappear after a reboot. Service can be run manually to reconnect the computer but will not survive a reboot.
Both agents for MacOS exhibit this behavior