~gsthnz/public-inbox

2 2

Read-only root with overlayfs under systemd

Josemaria Malgosa Sanahuja <josem.malgosa@upct.es>
Details
Message ID
<d20622a1-9da9-2838-83dd-bc4a6b18dd31@upct.es>
DKIM signature
missing
Download raw message
Hi gsthnz,

I'm interested in doing something similar to what you described in the 
post "Read-only root with overlayfs". However, my Linux boots under 
systemd instead of init.

systemd is better than init but also more complicated, so I'm not able 
to mount automatically an overlayed version of the root file system.

Could you give me some clue?
Many thanks in advance!
Details
Message ID
<1f54b214-1739-5d74-5518-aa8cbc7910e1@gsthnz.com>
In-Reply-To
<d20622a1-9da9-2838-83dd-bc4a6b18dd31@upct.es> (view parent)
DKIM signature
missing
Download raw message
On 3/16/23 05:41, Josemaria Malgosa Sanahuja wrote:
> Hi gsthnz,
> 
> I'm interested in doing something similar to what you described in the 
> post "Read-only root with overlayfs". However, my Linux boots under 
> systemd instead of init.
> 
> systemd is better than init but also more complicated, so I'm not able 
> to mount automatically an overlayed version of the root file system.
> 
> Could you give me some clue?
> Many thanks in advance!

Hello, Josemaria

Are you using buildroot to build you system? Or are you using a general 
purpose distro?

You have to create a script that executes before systemd, you probably 
should look into how linux loads the init and load this script instead 
of the init.

In my case, I created a new "init" shell script which makes the 
overlayfs mount and then chroots into the new fs with the actual init 
system, in your case you should be able to run systemd instead of init.

I have little experience running systemd by hand, but it shouldn't be 
too different.

I'm also not sure if systemd has this as a native feature. I've done 
this for a embedded busybox system.

Feel free to mail me on any other questions you have :)

-- 
Gustavo Heinz
Details
Message ID
<52088ce5-72b9-4aea-9616-2b7700330a93@gmail.com>
In-Reply-To
<1f54b214-1739-5d74-5518-aa8cbc7910e1@gsthnz.com> (view parent)
DKIM signature
missing
Download raw message
On 3/16/23 07:50, Gustavo Heinz wrote:
> On 3/16/23 05:41, Josemaria Malgosa Sanahuja wrote:
>> Hi gsthnz,
>>
>> I'm interested in doing something similar to what you described in 
>> the post "Read-only root with overlayfs". However, my Linux boots 
>> under systemd instead of init.
>>
>> [...]
> Hello, Josemaria
>
> [...]
>
> You have to create a script that executes before systemd, you probably 
> should look into how linux loads the init and load this script instead 
> of the init.
>
> In my case, I created a new "init" shell script which makes the 
> overlayfs mount and then chroots into the new fs with the actual init 
> system, in your case you should be able to run systemd instead of init.
>
One may have to look into the initramfs scripts.  This has been bugging 
me for a while too.

Hopefully, I'll get back to you.
Reply to thread Export thread (mbox)