LXDE desktop not showing with read-only-rootfs

Hi there,

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.

Image.

Thanks,
Álvaro.

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).

Hi Stefan,

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 ro saveenv boot. 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.

In u-boot, this is prefered:

setenv ubiargs ubi.mtd=ubi root=ubi0:rootfs rootfstype=ubifs ubi.fm_autoconvert=1 ro
saveenv

For a test you can try symlinking /var/volatile/log to /var/log

rm -rf /var/log
ln -s /var/volatile/log /var/log

and then reboot with ro filesystem

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):

  1. 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 http://developer.toradex.com/knowledge-base/resistive-touch-screen-(linux) 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?

  2. My Qt application still doesn’t work. Output is:

    No protocol specified
    QXcbConnection: Could not connect to display :0.0
    Aborted (core dumped)

Thanks, Álvaro.

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.

Thanks for your comment Dominik. I’ve added an answer with half the solution, can you please check it?

Hi

@ 1

Compare with /usr/bin/xinput_calibrator_once.sh

Copy the last two lines of you xinput_calibrator.pointercal.log into the last two lines of the (probably new) file /etc/pointercal.xinput

This sets the stored calibration and prevents the automatic start of the calibrator.

@ 2

Could not connect to display :0.0 Aborted (core dumped)

Is X really started?

ps ax | grep X
xrandr

Max

Hi Max,

I’ve just realised that you commented…

@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 595-selection-197.png

Thanks again,
Álvaro.

Hm, there is likely something missing to do proper inter process communication…

You don’t have proper Xauthority since your /home/root directory is read-only. just add

tmpfs /home/root tmpfs defaults 0 0

to /etc/fstab and it should work.

@Stefan, maybe one of the services launched by systemd, that are not being launched in the ro image, has to start the IPC with X?

X does not need a specific service. Its probably what @dominik.tx suggested above…

Thanks @Dominik, that worked!