To give a brief context of my issue. I wanted to enable local autologin in my raspberry-pi cm3.
In order to do that I had created a recipe which basically disable serial getty service and link my own service with tty1.
Once I make my Image rootfs as read-only I am unable to do that.
My question is,
Did anyone else face similar issue? How do I get over it?
Should I move my service file to persistent data location ?
This error is because you are using an ontarget function to do it. You want to use SYSTEM_AUTO_ENABLE and SYSTEMD_SERVICE stuff instead to make sure it is setup at bitbake time. You can see how we do it for the mender client recipe here.
@drewmoseley okay. Please bear with me. So what you are saying is that it should be happening during the install phase and not during the package phase.
pkg_postinst_${PN}() {
#!/bin/sh
if [ x"$D" != "x" ]; then # This guard is needed for it not to run on first boot
ln -s /etc/systemd/system/autologin.service ${D}/etc/systemd/system/getty.target.wants/getty@tty1.service
systemctl --root=${D} disable serial-getty@.service
fi
}
I think postinst tasks will run on the build system during the bitbake run if they can. If they return an error, then I think they will run on first boot which obviously won’t work with a read-only root filesystem. Sounds like you have it being done at bitbake time.
I think that sums up all the issues that I am facing. Because some of my recipes ran commands on target which now is impossible to do on a read only file system.