Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have specific embedded hardware that I am building LFS and BLFS with minimal requirements such as X graphics stack in order to run dedicated OpenGL accelerated software. I build this custom system as an image file and then dd this image onto CFast media cards to boot up on the hardware which is all fine.
However I do have a requirement that the root filesystem must be read only and can not have any bytes altered. On older software where I used a debootstrap system (Ubuntu 14.04) and a lot of insane extra effort to make it read only with initramfs this was possible. However I'm not sure if I need to use initramfs to achieve the same thing with LFS/BLFS. I'm wondering if I can achieve this read only bootable rootfs system (on ext2) without initramfs and if there are any pointers to how I can do it? Is it just as simple as making sure in /etc/fstab I have the options for "/" to be "ro"? Will this ensure that the mount counter and any other meta data doesn't get altered?
Should be possible, as e.g. squashfs may be used as rootfs.
But usually B/LFS will want to write to certain locations during boot or later, like e.g. /tmp; /run; ... So it might be necessary to mount there some tmpfs or work with e.g. overlayfs to stack some rw-filesystem over the ro-filesystem.
My fstab is pretty standard. I still have a tmpfs and such, its just the main root filesystem "/" that needs to remain read only and not have any partition metadata updated at all, from what I've understood from both documentation and looking at the code myself if I mount the root filesystem "/" as read-only (this is an ext2 fs) then technically mount counters or any other meta data should not be touched by the system or kernel. I can still create files and write to tmpfs as it is a true tmpfs system (RAM) and specifics like Xorg that write lock files generally use tmpfs also. The only thing I'm not 100% sure about is the /run mount and why on a proper pre-built distribution like Ubuntu you also need to modify the initramfs to make sure that the root filesystem partition will not be updated. I would rather not use squashfs if I dont have to.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.