Code: Select all
#!/bin/bash until [ -f /boot/myfile.txt ]; do sleep 2;done exec myQTProgram
That does seem to be what is happening. My understanding or operating systems isn't that deep, but wouldn't /boot need to mounted quite early because the RPi needs the booting files (start.hex etc) and loads settings from the "/boot/config.txt" file a long time before "/etc/rc.local" and therefore my Qt program is run?I think that /etc/rc.local gets run very early in the process (in the world of systemd). So, it is reasonable to assume that at least some of the time, /boot will not have been mounted by the time rc.local gets run. So, I think your analysis is probably correct.
The Qt program is something I have written (I should have explained this in my first post), so my (inelegant) current solution was to store 2 settings files, one in the "/qtProgramSettings.dat" directory, and another in "/boot/qtProgramSettings.dat". When I save the settings I save both, but I only load settings from the "/qtProgramSettings.dat".As you say, the easiest fix would be to move the settings file to somewhere on the ext4 partition, but I get your reason for not wanting to change this.
I'm using Raspbian Lite, and once booted for a long time, I view the contents of "/boot" I get all the RPi files and my " /boot/qtProgramSettings.dat" file.HawaiianPi wrote: ↑Wed Oct 24, 2018 7:41 amAre you actually putting the settings file in /boot on the ext4 partition? If so, then that's your problem.
The small FAT32 partition gets mounted to /boot when the OS loads, and that will replace anything you have there. If you want something in /boot, you put it on the fist partition of the card (the small FAT32 partition that's labelled "boot"), not in the /boot folder on the 2nd partition.
Unless you are putting the file there from a running Raspbian OS, in which case /boot should already be mounted.
From very briefly looking at the pinn sorce code, looks like it measures the size of the contents of "/boot" before doing an action which I could do something similar before loading my settings file.procount wrote: ↑Wed Oct 24, 2018 7:58 am@XDSFyP - Because your qt program runs quite early it should first check that the first fat partition is actually mounted on /boot before checking for your settings file. If it is not, then just wait until it is.
You can find examples of this in the noobs or pinn source code on github, which also use qt.
Thanks for the suggestions, I need to learn more about systemd and this would be a good project to get started.