Page 1 of 1

Can't update Cumulus on Pi - Permissions issue with InstallCMX

Posted: Mon 11 Jul 2022 7:54 pm
by ukchaser
Hi all

I've been running an old version of cumulusmx for years with a raspberry pi but the sd card died a few months back. I've just set it up again with the pre-built Raspberry Pi Image (3.18.0 b3190) and noticed it needed updating (3.19). Fine, I used the InstallCMX.exe tool and it appeared to work, no errors, but when I checked the log I got this below. In filezilla I can see most of the files in the /otp/CumulusMX directory are owned by root and it seems the user cmx can't overwrite them. Do I have to pull the SD card out and use a linux viewer on windows to copy the files? Can I chmod the directory? Can I give cmx user some more rights? I've tried just unzipping the files too and that doesn't work!

Hopefully I'm just missing something silly :)
2022-07-11 20:29:28 CMX multiplatform installer version Version 1.0.2 - (c) Hans Rottier
2022-07-11 20:29:28 CommandLineArgs : starting
2022-07-11 20:29:28 Running on : Unix
2022-07-11 20:29:29 Error No authorisation reading Directory /lib
2022-07-11 20:29:29 Error No authorisation reading Directory /var
2022-07-11 20:29:30 Error No authorisation reading Directory /usr
2022-07-11 20:29:30 Error No authorisation reading Directory /root
2022-07-11 20:29:30 Error No authorisation reading Directory /tmp
2022-07-11 20:29:30 Error No authorisation reading Directory /lost+found
2022-07-11 20:29:30 Error No authorisation reading Directory /etc
2022-07-11 20:29:30 Error No authorisation reading Directory /run
2022-07-11 20:29:30 Updating ./CumulusMXDist3191.zip in /opt/CumulusMX/

2022-07-11 20:29:36 Extracting : CumulusMX/acknowledgements.txt => /opt/CumulusMX/acknowledgements.txt
2022-07-11 20:29:36 Extracting : CumulusMX/AirLinkFileHeader.txt => /opt/CumulusMX/AirLinkFileHeader.txt
2022-07-11 20:29:36 Error Failed Extracting : CumulusMX/AirLinkFileHeader.txt to /opt/CumulusMX/AirLinkFileHeader.txt
2022-07-11 20:29:36 Error Exception message : Access to the path '/opt/CumulusMX/AirLinkFileHeader.txt' is denied.
2022-07-11 20:29:36 Installation of CMX Failed.
2022-07-11 20:29:36 Please check your logfile, destination directory and/or user rights.
2022-07-11 20:29:36 Done

Re: Can't update Cumulus on Pi - Permissions issue with InstallCMX

Posted: Mon 11 Jul 2022 8:52 pm
by HansR
If all files are owned (owner/group) by root you will have to install/update as root and also run as root (assuming your datafiles are also owned by root.

However, it is possible to chown/chgrp all files to your cmx user and update simply from the account cmx. In that case you must also run as the cmx owner. If you run as root, new data files will be owned by root. Mixed ownership is a source of problems.

Ownership is a choice but you must be consistent.
If you use systemd to start/stop you must set the user according to file ownership.

Re: Can't update Cumulus on Pi - Permissions issue with InstallCMX

Posted: Mon 11 Jul 2022 9:43 pm
by ukchaser
Thanks for your reply!

I had no option with the raspberry image to set ownership. When it first runs you log in with cmx and just change the password and I can't seem to find any details on the root account. I did try logging in as root as I figured this was the issue, but no luck. I assumed cmx may have been set with all the user rights necessary seeing as it was pre built for running cumulusmx.

So, I can assume the cmx user is pointless? Or do I need to run cumulusmx from a new folder that I set up with the cmx user? If that's the case then surely that's just the same as having a blank raspian install? Can I take ownership of the current root folders with the cmx user that's pre built in to the image?

Thanks again.

Re: Can't update Cumulus on Pi - Permissions issue with InstallCMX

Posted: Tue 12 Jul 2022 7:00 am
by HansR
In general: check out the sudo command!
ukchaser wrote: Mon 11 Jul 2022 9:43 pm I had no option with the raspberry image to set ownership. When it first runs you log in with cmx and just change the password and I can't seem to find any details on the root account.
OK. I don't know about the image, never used it maybe @mcrossley can say something about it.
ukchaser wrote: Mon 11 Jul 2022 9:43 pm I did try logging in as root as I figured this was the issue, but no luck.
You can't login as root, you just use the sudo command.
If you wish to do multiple commands as root do sudo su first (which gives you the root prompt) and when done do exit getting back to your original login.

If you use installCMX.exe under root (do: sudo installCMX.exe) it will probably install perfectly, maintaining the ownership for files which are already owned by cmx. Do check the ownership of the datafiles against the owner you run with though.
ukchaser wrote: Mon 11 Jul 2022 9:43 pm I assumed cmx may have been set with all the user rights necessary seeing as it was pre built for running cumulusmx.
I assume so yes, the wiki does not really say this explicitly but that seems logical. Again, I don't know, this seems to be a topic for @mcrossley. Again updating under root will do I think (NOTE that updating is different from installing under root because when installing you give all ownership of the newly created files to root).
ukchaser wrote: Mon 11 Jul 2022 9:43 pm So, I can assume the cmx user is pointless? Or do I need to run cumulusmx from a new folder that I set up with the cmx user? If that's the case then surely that's just the same as having a blank raspian install? Can I take ownership of the current root folders with the cmx user that's pre built in to the image?
I assume that is a bit too fast jumped to conclusion ;)
But again, Mark might have something to say about this.

Re: Can't update Cumulus on Pi - Permissions issue with InstallCMX

Posted: Tue 12 Jul 2022 8:47 am
by mcrossley
ukchaser wrote: Mon 11 Jul 2022 9:43 pm I had no option with the raspberry image to set ownership. When it first runs you log in with cmx and just change the password and I can't seem to find any details on the root account.
Just the default for Raspberry Pi OS - which is no password for root. You have to set one yourself using sudo if you want one. You cannot login as root by default, again you can alter that if you wish, though it is not recommended practice.

ukchaser wrote: Mon 11 Jul 2022 9:43 pm So, I can assume the cmx user is pointless? Or do I need to run cumulusmx from a new folder that I set up with the cmx user? If that's the case then surely that's just the same as having a blank raspian install? Can I take ownership of the current root folders with the cmx user that's pre built in to the image?
The cmx user is the only user account on the system that allows you to login. It is a non-privileged account so you have to use sudo to stop/start the CMX service.

The CMX service runs as root in the prebuilt image.

Re: Can't update Cumulus on Pi - Permissions issue with InstallCMX

Posted: Tue 12 Jul 2022 9:21 am
by ukchaser
Many thanks for the help from both of you!

I've managed to update it using the tool now. I had to sudo su first, then sudo ./InstallCMX.exe to get it to work.

I think in one of the wiki files is said you had to use mono to update it it.

Now I can set it all up again knowing I can update the core files easily :lol:

Re: Can't update Cumulus on Pi - Permissions issue with InstallCMX

Posted: Tue 12 Jul 2022 9:39 am
by mcrossley
If you put the installer in one of the folders in the default sudoers path (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin), then you should be able to just sudo it from the cmx user. (I think, reaching my Linux limits here!)

Re: Can't update Cumulus on Pi - Permissions issue with InstallCMX

Posted: Tue 12 Jul 2022 9:40 am
by HansR
ukchaser wrote: Tue 12 Jul 2022 9:21 am I've managed to update it using the tool now. I had to sudo su first, then sudo ./InstallCMX.exe to get it to work.
OK. The sudo su is redundant but if you do that you do not have to give the next sudo ;)
ukchaser wrote: Tue 12 Jul 2022 9:21 am I think in one of the wiki files is said you had to use mono to update it it.
Indeed, if mono has not been activated you have to activate mono.
ukchaser wrote: Tue 12 Jul 2022 9:21 am Now I can set it all up again knowing I can update the core files easily :lol:
Good :D

Re: Can't update Cumulus on Pi - Permissions issue with InstallCMX

Posted: Tue 12 Jul 2022 2:33 pm
by freddie
mcrossley wrote: Tue 12 Jul 2022 9:39 am If you put the installer in one of the folders in the default sudoers path (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin), then you should be able to just sudo it from the cmx user. (I think, reaching my Linux limits here!)
You can just sudo it from the cmx user anyway. You can add the location of the installer to the user's path, but the only change that makes is that you don't have to give a path to the installer (which is what ./InstallCMX.exe does. If you've put the installer location in the path you can just issue "InstallCMX.exe").

As Hans said earlier the only reason to use "sudo su" is if you have a lot of root-level stuff you want to do, to save typing sudo every command. I think the Windows equivalent of "sudo su" is running a CMD window as Administrator.

You certainly don't have to sudo anything if you have already typed "sudo su" in your terminal - Hans stated this too.