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

[Q] Change linux client install location? Possible? #5384

Open
tiagogbarbosa opened this issue Oct 1, 2023 · 15 comments
Open

[Q] Change linux client install location? Possible? #5384

tiagogbarbosa opened this issue Oct 1, 2023 · 15 comments

Comments

@tiagogbarbosa
Copy link

I have some Raspberries with Overlay file system (essentially read-only), but i have a mount to a partition in sdcard that is writable all the time.. (mounted in /sdcard)

Can i specify MeshCentral client to install in /sdcard/meshcentral?
Or is possible to make a custom install script?

Ty in advance

@krayon007
Copy link
Collaborator

If you use the binary installer, use the /help option. One of the command line parameters shows how to change the install location. I forget what it is off the top of my head

@tomsik-radek
Copy link

@tiagogbarbosa Hey, if you ever get this working please report it. I have a device with read only file system (Steam Deck) but would love Mesh on it.

@si458
Copy link
Collaborator

si458 commented Oct 2, 2023

@krayon007 /help doesnt work but -help does but returns no info about how to install

simon@SiUbuntu22:~/wtf$ sudo ./meshagent -help
You can run the text version from the command line with the following command(s): 
./meshagent -connect
./meshagent -update
./meshagent -uninstall

EDIT: the above output is because i already have the agent installed
below is output for IF you dont have it installed

simon@SiUbuntu22:~/wtf$ sudo ./meshagent -help
You can run the text version from the command line with the following command(s): 
./meshagent -connect
./meshagent -install
./meshagent -install --installPath="/alternate/path"

@tomsik-radek
Copy link

@krayon007 /help doesnt work but -help does but returns no info about how to install

simon@SiUbuntu22:~/wtf$ sudo ./meshagent -help
You can run the text version from the command line with the following command(s): 
./meshagent -connect
./meshagent -update
./meshagent -uninstall

EDIT: the above output is because i already have the agent installed below is output for IF you dont have it installed

simon@SiUbuntu22:~/wtf$ sudo ./meshagent -help
You can run the text version from the command line with the following command(s): 
./meshagent -connect
./meshagent -install
./meshagent -install --installPath="/alternate/path"

Sadly doesn't seem to work on SteamOS (Arch derivative with read only filesystem, similar to Fedora Silverblue)

/var/lib is writeable (flatpaks install here and I could create the folder)

(deck@steamdeck Downloads)$ sudo ./meshagent -install --installPath="/var/lib/meshcentral"
...Checking for previous installation of "meshagent" [NONE]
...Installing service [ERROR] FS CreateWriteStream Error

Even tried to ~

sudo ./meshagent -install --installPath="/home/deck/.meshagent"
...Checking for previous installation of "meshagent" [NONE]
...Installing service [ERROR] FS CreateWriteStream Error

@si458
Copy link
Collaborator

si458 commented Oct 2, 2023

@tomsik-radek FS CreateWriteStream Error this to me screams a read/write permission issue
Are u sure the folders u enters have read/write permission and not readonly?

@tomsik-radek
Copy link

Given one of them is in my home directory and I created it, yes I'm sure I (and root) user can write into those two folders. The question is is the script trying to write somewhere else, fails and doesn't tell us where?

@tomsik-radek
Copy link

(deck@steamdeck ~)$ cd .meshagent/
(deck@steamdeck .meshagent)$ ls
meshagent
(deck@steamdeck .meshagent)$ ls -la
total 3716
drwxr-xr-x  2 root root    4096 Oct  2 19:13 .
drwx------ 26 deck deck    4096 Oct  2 19:19 ..
-rwxr-xr-x  1 root root 3794180 Oct  2 19:13 meshagent
(deck@steamdeck .meshagent)$ sudo ./meshagent -install --installPath="/home/deck/.meshagent"
[sudo] password for deck:

...Checking for previous installation of "meshagent" [NONE]
...Installing service [ERROR] FS CreateWriteStream Error(deck@steamdeck .meshagent)$
(deck@steamdeck .meshagent)$ ls -la
total 3748
drwxr-xr-x  2 root root    4096 Oct  2 19:33 .
drwx------ 26 deck deck    4096 Oct  2 19:19 ..
-rwxr-xr-x  1 root root 3794180 Oct  2 19:13 meshagent
-rw-r--r--  1 root root   29391 Oct  2 19:33 meshagent.msh
(deck@steamdeck .meshagent)$

@si458
Copy link
Collaborator

si458 commented Oct 2, 2023

It does say installing service, so it might be it doesn't have permission to write the systemd file to start the service on start up?
(Just a guess, I don't own a steam deck, I'm not made of money haha)

@tomsik-radek
Copy link

tomsik-radek commented Oct 2, 2023

It does say installing service, so it might be it doesn't have permission to write the systemd file to start the service on start up? (Just a guess, I don't own a steam deck, I'm not made of money haha)

Hmm, didn't think about that. Yes that might be a possibility.

Okay, manual test, I can create a text file in /etc/systemd/system, is that the right folder?

(deck@steamdeck system)$ sudo touch test.service
(deck@steamdeck system)$ ls -la
total 84
drwxr-xr-x 1 root root 4096 Oct  2 19:37 .
drwxr-xr-x 1 root root 4096 Dec 29  2022 ..
lrwxrwxrwx 1 root root    9 Dec 22  2022 alsa-restore.service -> /dev/null
drwxr-xr-x 1 root root   34 Sep  1 04:11 bluetooth.target.wants
lrwxrwxrwx 1 root root    9 Nov 10  2022 boot.mount -> /dev/null
[removed bloat]
drwxr-xr-x 1 root root   46 Sep  1 04:10 systemd-remount-fs.service.d
-rw-r--r-- 1 root root    0 Oct  2 19:37 test.service
lrwxrwxrwx 1 root root    9 Sep  1 04:11 usr-lib-debug.mount -> /dev/null
lrwxrwxrwx 1 root root    9 Sep  1 04:11 usr-local.mount -> /dev/null
(deck@steamdeck system)$

@tomsik-radek
Copy link

Hmm, it might be trying to write to /usr/lib/systemd/system/ which is indeed read only

@si458
Copy link
Collaborator

si458 commented Oct 2, 2023

Hmm, it might be trying to write to /usr/lib/systemd/system/ which is indeed read only

Just checked my pikvm and proxmox machines, yeh it stores the startup file in there

The only thing I can suggest is if u put meshagent into a read/write folder then manually run meshagent -run on startup somehow?

Does steam deck have a startup menu u can add stuff to?

Edit: what about the rc.local file? Is that read/writeable?

@tomsik-radek
Copy link

tomsik-radek commented Oct 2, 2023

Nicked the systemd file from my Debian server (don't run anything arch/rhel/fedora etc sadly)

(1)(deck@steamdeck ~)$ cat /etc/systemd/system/meshagent.service
[Unit]
Description=meshagent background service
Wants=network-online.target
After=network-online.target
[Service]
WorkingDirectory=/home/deck/.meshagent
ExecStart=/home/deck/.meshagent/meshagent --installedByUser=0
StandardOutput=null
Restart=on-failure
RestartSec=3
[Install]
WantedBy=multi-user.target
Alias=meshagent.service

It doesn't crash, but it autoexits

Oct 02 19:57:34 steamdeck systemd[1]: Started meshagent background service.
Oct 02 19:57:35 steamdeck systemd[1]: meshagent.service: Deactivated successfully.
Oct 02 19:57:35 steamdeck systemd[1]: meshagent.service: Consumed 1.002s CPU time.
Oct 02 19:58:20 steamdeck systemd[1]: Started meshagent background service.

Okay, manual run works, now just work out systemd

(deck@steamdeck .meshagent)$ sudo ./meshagent -connect

Server URL: wss://meshcentral.domain.tld:443/agent.ashx
Device Group: Laptops

Press Ctrl-C to exit.

SteamOS doesn't seem to ship with rc.local, or at least not /etc/rc.local

@tomsik-radek
Copy link

tomsik-radek commented Oct 2, 2023

Okay with

(deck@steamdeck .meshagent)$ sudo cat /etc/systemd/system/meshagent.service
[Unit]
Description=meshagent background service
Wants=network-online.target
After=network-online.target
[Service]
WorkingDirectory=/home/deck/.meshagent
ExecStart=/home/deck/.meshagent/meshagent --installedByUser=0 -connect
Group=nobody
StandardOutput=null
Restart=on-failure
RestartSec=3
[Install]
WantedBy=multi-user.target
Alias=meshagent.service

Scratch this last part, I'm an idiot. I added it to a group where I set up user rights notifications
it runs, but files, ssh, desktop etc, all go "waiting for user to grant rights" and then a second later goes "denied".
A login prompt should pop up (and does on my other Linux boxes)

"terminal": {
            "linuxshell": "login",
              "launchCommand": {
                "linux": "clear\necho \"Hello Linux\"\n",
                "darwin": "clear\necho \"Hello MacOS\"\n",
                "freebsd": "clear\necho \"Hello FreeBSD\"\n"
              }
        }

@tomsik-radek
Copy link

tomsik-radek commented Oct 2, 2023

Okay, now it seems to work. Question is if it will survive updates, hopefully yes.

Now, I'm not a Linux developer so I can't help here much, but would it be possible to check if /usr/lib/systemd/system/ is writeable and if not create the service file in /etc/systemd/system/?

Also I'm not sure why I had to put -connect in the service file when my Debian devices don't have it. Because I'm technically running the "portable" version of the agent as a service, so not ideal setup

@tomsik-radek
Copy link

tomsik-radek commented Oct 2, 2023

Okay this won't work either because after a while, the Desktop, Files and terminal tabs just disappear completely. I guess the agent in portable -connect mode doesn't keep handshaking with the server?

Don't appear after OS restart either, but do after service restart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants