Page 7 of 10

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Sun 10 Jul 2016 9:04 pm
by VTHokie74
OK, I changed the permissions all to pi and rebooted. CumulusMX started fine. Thank you my friend.

One last question. Can the DD backup directory be the same Windows share I mounted?

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Sun 10 Jul 2016 9:13 pm
by jank
VTHokie74 wrote:OK, I changed the permissions all to pi and rebooted. CumulusMX started fine. Thank you my friend.

One last question. Can the DD backup directory be the same Windows share I mounted?
Sure.

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Mon 11 Jul 2016 1:22 pm
by VTHokie74
I checked this morning to see if I got any backups from the Raspberry to my Windows share folder. Nope, nothing was there. I checked the owner of the mounted directory /home/pi/windowsshare/backup and sure enough it was root. I ran chown to change the owner from root to pi and ran a backup using -b -z parameters and everything worked. I am guessing if you use sudo nano /etc/fstab to add the mount directory it sets the owner as user root even if you are logged in an SSH terminal window as user pi.

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Mon 11 Jul 2016 1:49 pm
by jank
I would more or less say that it is not a problem of "who created an entry in th fstab" because pi should not have rights to modify /etc/fstab ....only root sould do this.
In your case someone has created the windows share and user pi has no rights to access this windows share.
In my fstab you can see some windows (samba) shares and a nfs (linux) share.

192.168.193.3:/export/Public /mnt/Public nfs rsize=8192,wsize=8192,timeo=14,intr 0 0
//192.168.193.3/Kerio_logs /var/log/kerio cifs username=jank,password=secret,iocharset=utf8,sec=ntlm 0 0
in bold, oyu can see that my windows share in the fstab is connecting as user: jank with the password: secret

did you have a username password in your share line ? If you here insert root and it''s password, you should run also the backup as user pi.

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Mon 11 Jul 2016 2:22 pm
by VTHokie74
This is what I added to the /etc/fstab file:

//routerdrive1/RaspberryPi /home/pi/routerdrive1/backup cifs username=xxxxxx,password=xxxxx,workgroup=WORKGROUP

The username and password are the router password. My network drive is connected directly to a USB port on my router and shared out to my network. "//routerdrive1/RaspberryPi" is the Windows network path for the drive and folder.

I edited the file logged in as pi using "sudo nano /etc/fstab".

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Mon 11 Jul 2016 6:05 pm
by jank
VTHokie74 wrote:This is what I added to the /etc/fstab file:

//routerdrive1/RaspberryPi /home/pi/routerdrive1/backup cifs username=xxxxxx,password=xxxxx,workgroup=WORKGROUP

The username and password are the router password. My network drive is connected directly to a USB port on my router and shared out to my network. "//routerdrive1/RaspberryPi" is the Windows network path for the drive and folder.
I edited the file logged in as pi using "sudo nano /etc/fstab".
Ahh okay. first of all, try: nano /etc/fstab make a change anywhere in this file (example: almost on top
#test
and try to save this file. You will see, that you are not allowed as user pi. Thats the reason, why you need to use sudo to modify such a system file.

I assume, your Router is having any SSH access ? ...and you are using root on your router to create the share //routerdrive1/RaspberryPi /home/pi/routerdrive1/backup folder ?
Try this one to change the owner of the share:
sudo chown pi:pi /home/pi/routerdrive1/backup I hope, after doing this, you are allowed to add/store/backup files to this share

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Mon 11 Jul 2016 7:03 pm
by VTHokie74
jank wrote: Ahh okay. first of all, try: nano /etc/fstab make a change anywhere in this file (example: almost on top
#test
and try to save this file. You will see, that you are not allowed as user pi. Thats the reason, why you need to use sudo to modify such a system file.
Correct. I opened the file with nano as pi from /home/pi and I got a a permission denied error when I attempted to save the changes.
I assume, your Router is having any SSH access ? ...and you are using root on your router to create the share //routerdrive1/RaspberryPi /home/pi/routerdrive1/backup folder ?
I am not sure about SSH. I just plugged the USB drive into a PC to access it that way. Then I created a \Raspberry\ backup folder using file manager in Windows. I plugged the drive back into the router and the folder was there. I think I could have done this through the router interface but my method worked.
Try this one to change the owner of the share:
sudo chown pi:pi /home/pi/routerdrive1/backup I hope, after doing this, you are allowed to add/store/backup files to this share
Yes, I did exactly that earlier and I can now manually backup to the external network drive with the script and the -b option. I assume the daily backups should work now also. I will check tomorrow and see if they ran.

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Mon 11 Jul 2016 7:10 pm
by jank
Great. Let me know if it works for you.

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Tue 12 Jul 2016 11:11 am
by VTHokie74
The backup worked.

I remembered I had to go back and edit the crontab. I had taken everything out when the @reboot didn't work. I added the daily and weekly backup lines back at the bottom.

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Mon 17 Oct 2016 10:52 pm
by jpsc
More feedback on the init.d no start.

You may recall that I had an 8GB SD Jessie Lite image that would boot and start cumulusmx and a 4GB image that would not. They were not identical but were built in the same way. I download Jessie Lite from raspbian.org and then add mono, Apache, etc. I then mount my SSD which has CumulusMX and the web server files. This way the SD card gets very little traffic, and is not subject to the corruption I regularly had when CumulusMX and data files were on it.

I have been running the 8GB image with no problems at all for the last few months (actually a clone of it on to a 16GB card because I could not find an 8GB SD with enough space) and so have not been back here at all. I have the SSD with the Pi in a Plusberry Pi case, all self contained.

I recently read of the new boot modes of the Pi3 and so bought one to experiment, hoping to eliminate the SD card entirely, booting directly from the SSD.

My first step was to build a bootable USB stick using the instructions here https://www.raspberrypi.org/blog/pi-3-b ... rage-boot/. I made sure I used a USB stick known to work - a Sandisk Cruzer Fit 16GB. Having cloned Jesse Lite on to it, it booted and I can now throw away my SD card (at least put it on a shelf in case of later trouble).

Next step copy the CumulusMX installation and Apache files from a temporarily mounted SSD, dismount that and get CumulusMX running from the booting USB stick - easy.

Next make another backup of CumulusMX in case, in case.

Finally repartition the SSD and clone the boot USB stick onto it.

I now have a Raspberry Pi that boots directly from SSD, no other storage media needed.


That is all very well but I found that the USB stick, and also the SSD build will not start the script at boot, just like the problems I had with the 4GB images. I am now using the -w watchdog switch in the script in crontab so can live with the startup delay.

I suppose my next move will be to clone the working 8GB SD card on to the Sandisk Cruzer Fit and see if that can be persuaded to start CumulusMX, if so it should work on the SSD. If not I will count my blessings and be happy with the current situation.


I just wanted to give my appreciation of a thoroughly good piece of work, and to show where it has got me.

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Wed 19 Oct 2016 7:37 am
by jank
jpsc wrote:More feedback on the init.d no start.You may recall that I had an 8GB SD Jessie Lite image that would boot and start cumulusmx
Yes, I recall and I already downloaded your SD Card image but had not the time trying it out......
jpsc wrote: I now have a Raspberry Pi that boots directly from SSD, no other storage media needed.
Wow, thats great and this might be the very best way to start a Reaspberry. But also using a SD Card just for the Boot process is good enough, because only a few files are being used during the boot (root is on SSD) and this will not damage a SD Card....for decades :-)
jpsc wrote: That is all very well but I found that the USB stick, and also the SSD build will not start the script at boot, just like the problems I had with the 4GB images. I am now using the -w watchdog switch in the script in crontab so can live with the startup delay.
I suppose my next move will be to clone the working 8GB SD card on to the Sandisk Cruzer Fit and see if that can be persuaded to start CumulusMX, if so it should work on the SSD. If not I will count my blessings and be happy with the current situation.
I just wanted to give my appreciation of a thoroughly good piece of work, and to show where it has got me.
thank you very much, but our goal should be, that the CumulusMX can start at system boot like all other deamons which are located in /etc/init.d, right?
OKay, you always cloned your installation form a USB/SSD/SD which not starts the CumulusMX init.d script....you never installed a new system? So you always cloned the error, or am I wrong?
My first impression when you used 2 devices (SD to boot and USB /SSD to work from) was, that the second device was not ready when the Script tried to start CumulusMX but this should not be the case when only 1 disc is being used......
But can you try this recommendation I mentioned in this post? ---> https://cumulus.hosiene.co.uk/viewtopic.p ... 30#p120756 Maybe the init Script is not correctly linked into the runlevels......Can you try using chkconfig command ?
Jan

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Sun 12 Feb 2017 3:46 pm
by jank
Today, after more then 200 days uptime, a network outage caused my Raspberry Pi to hang so I needed to reboot and once it came up again, the CumulusMX was not started by the init.d script.
After some minutes I found out, that the /etc/init.d/cumulusmx was set to run as user pi
CumulusMX_USER=pi

but since some files in the /CumulusMX Installation folder changed the ownership for any reason, the init.d script won't work anymore.

After changing the ownership for all files in the CumulusMX Installation folder back to pi, everything worked after the next reboot
sudo chown -R pi:pi /home/pi/CumulusMX

Maybe this was a reason, why some of you had no luck to get CumulusMX started when system starts?

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Sun 12 Feb 2017 11:26 pm
by richard_newberry
some files keeps changing the ownership so I keep having to do it every now and then.

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Mon 13 Feb 2017 1:16 pm
by jank
Hello Richard
I am not 100% sure, but from time to time, I am also unsure, if soemthing has changed the ownership of one file. I thought I am 100% that I run CumulusMX as user pi, but weeks later, when I am trying to restart, it says that some files have changed the ownership.

I am sure, you know the commands to test it ?

Test 1. Check the owner ship of all files in the cumulusMX Dir ----> find /home/pi/CumulusMX/ -type f -printf "%u \n" |sort |uniq
Change the path in case it is installed somewhere else
If you see only 1 username, for xmaple pi, you can check it by using this command

Test 2- Check if the query is working: sudo touch /home/pi/CumulusMX/test test
Run command again: find /home/pi/CumulusMX/ -type f -printf "%u \n" |sort |uniq
You should see 2 usernames now
Delete file test ---> sudo rm /home/pi/CumulusMX/test

To test who's the owner of the PID file: stat -c %U /tmp/CumulusMX.pid

If you now see days later, that an owner of a file has changed, use the stat command.
Example: If the owner of the file test has changed: stat /home/pi/CumulusMX/test

This command will give you at least an information about any changes of the file....

I will do the same on my pi, but after 24 hours, all files still belong to user pi.

Re: RaspberryPi: CumulusMX init.d System Startup Script

Posted: Mon 13 Feb 2017 2:00 pm
by BigOkie
jank wrote:Today, after more then 200 days uptime, a network outage caused my Raspberry Pi to hang so I needed to reboot and once it came up again, the CumulusMX was not started by the init.d script.
After some minutes I found out, that the /etc/init.d/cumulusmx was set to run as user pi
CumulusMX_USER=pi

but since some files in the /CumulusMX Installation folder changed the ownership for any reason, the init.d script won't work anymore.

After changing the ownership for all files in the CumulusMX Installation folder back to pi, everything worked after the next reboot
sudo chown -R pi:pi /home/pi/CumulusMX

Maybe this was a reason, why some of you had no luck to get CumulusMX started when system starts?
when I implemented mine, that was one of the first things I changed.

However, on a subsequent reboot (which happened in much the same manner as yours did) it didn't start.

Wasn't understanding why until I installed chkconfig and noticed that the cumulusmx script was not set to start as evidenced by issuing the command chkconfig | grep cumulusmx and the result returned 'cumulusmx off'.

I believe running 'update-rc.d cumulusmx defaults', then running 'update-rc.d cumulusmx enable' solved that issue.