I’ve been playing with Yocto builds for some time already and now I was interested in making a read only system through the read-only-rootfs approach.
After solving the pck_postinst issues, I flashed the image and it worked just fine, except for the desktop that it never appeared (nor the touchscreen calibration screen). I tried the following commands with the following outputs:
# xrandr
Can't open display: 0.0
# lxpanel
(lxpanel:1203): Gtk-WARNING **: cannot open display: : 0.0
Also, the Qt programs don’t launch (expected). Login, ssh and other native programs work without any issue.
I’ve tried rebuilding the image without read-only-rootfs to check if I messed up in the postinst scripts, but the LXDE Desktop worked as expected.
If it helps, at boot time, I have several FAILED flags, which I’m guessing it would have something to do. You may find a couple of screenshots attached.
It seems that the X-Server does not start/exits immediately. Can you check /var/log/Xorg.0.log.
Systemd should support read-only rootfs, so I am a bit surprised that you see that many errors during boot. It might be that systemd does not realize that the rootfs should be/is read-only. Do you use the ro kernel boot parameter?
Otherwise I would start investigating with the first failing service and try fix that issue (you should find more information why the service failed by using systemctl status systemd-tmpfiles-setup.service).
thanks for your answer. Forgot to mention that there is no Xorg.0.log filed generated, but checking with systemctl status I think I found the issue: It seems that /var/ and /var/tmp/ are ro as well for some reason…
[upload|LEoZ18GY0qqsS6ct/odt5kRDKSA=]
You may find the output of mount if it could be of help: [upload|HTocVZx43JwGt5I+PfO5mVsdhL0=]
I’ve tried in U-boot the following sequence: setenv bootargs rosaveenvboot. I’m not sure if that is correct, my knowledge in U-boot is more limited.
Thanks again,
Álvaro.
EDIT: Calling mount -o remount,rw /launches the desktop, but I think it misses the initial purpose of the read-only. I’ve tried launching the services after opening the rootfs, but after the restart it doesn’t work and the systemctl still fails.
At the end, what solved it was to change the mount point in rootfs’ /etc/fstab from /var/volatile to /var before installing the image in the SD.
This way machine boots to the desktop (logs were, indeed, created in /var/log) but I’m still having 2 additional issues (which I hope I could get solved in the comments section since it’s related to the original issue):
Every time I restart, screen asks me for calibration (which is kind of expected since there is no place to save the changes permanently). Is it possible to obtain this values, and have them loaded before hand? I’ve checked in High performance, low power Embedded Computing Systems | Toradex Developer Center and I also found that the calibration values are stored in /var/log/xinput_calibrator.pointercal.log. How can I save these values in my image to be used?
My Qt application still doesn’t work. Output is:
No protocol specified
QXcbConnection: Could not connect to display :0.0
Aborted (core dumped)
EDIT: I’m completely fine with setting these parameters (xorg/touchscreen) directly in the image before installing, even from the Yocto image. Just in case these could be forced to the one’s used in a RW image, copied and saved in the RO image.
@1, it worked! But with a workaround since in the ro image the pointercal.xinput was not generated: I copied the /etc/pointercal.xinput file from an open (rw) image after the calibration, to the image before flashing to the SD.
@2: Funny thing is that the desktop/LXDE is loaded but still xrandr is unable to find a display