[systemd-devel] moving from SysV to systemd - issue with / being ro
Warpme
warpme at o2.pl
Wed Oct 16 11:31:02 PDT 2013
On 10/16/13 7:40 PM, Zbigniew Jędrzejewski-Szmek wrote:
> On Wed, Oct 16, 2013 at 07:22:28PM +0200, Warpme wrote:
>> On 10/16/13 7:02 PM, Zbigniew Jędrzejewski-Szmek wrote:
>>> On Wed, Oct 16, 2013 at 06:18:12PM +0200, Warpme wrote:
>>>> Hi,
>>>> I want to switch init system from SysV to systemd-196.
>>>> Sys is PXE booted disk-less appliance with rootfs based on overlayfs.
>>>>
>>>> Currently I can PXEboot, successfully switch root from initrd to
>>>> overlayfs based root, systemd starts and executes many of it's
>>>> units.
>>>> Unfortunately user units are failing due / is read-only.
>>>> When I issue "mount -o remount,rw /" - root becomes rw - so it
>>>> looks like systemd for some reason isn't remounting root to rw.
>>>> Interesting is that exactly the same initrd->overlayfs script (see
>>>> below) works OK for SysV - so I think issue isn't in my pivot_root
>>>> procedure but rather systemd receives / in rw but leaves in ro (as
>>>> "mount -o remount,rw /" allows to write to /).
>>>>
>>>> Script switching initrd to overlayfs root looks following:
>>>>
>>>> /bin/mount -n -t tmpfs none /rw
>>>> /bin/mkdir -p /rw/rootfs
>>>> /bin/mount -n -t overlayfs -o
>>>> lowerdir=/rootfs-ro,upperdir=/rw/rootfs none /rootfs
>>>> cd /rootfs
>>>> /bin/mkdir -p initrd proc sys
>>>> /sbin/pivot_root . initrd
>>>> exec /usr/sbin/chroot . /usr/lib/systemd/systemd
>>>>
>>>> Where issue might be?
>>> What's in /etc/fstab?
>>>
>>> Zbyszek
>>>
>> Zbyszku,
>>
>> Here is my fstab:
>>
>> none / auto remount,rw 0 0
> OK, so fstab-generator will ignore the mount point becuase of the 'none'.
> This means that systemd will not remount it.
>
> Actually, I don't understand why / is mounted read-only: -w is the default
> for mount, and you don't specify -r anywhere. Maybe it's specific to overlayfs.
>
> I think that your best option is to add
>
> /bin/mount -o remount,rw /
>
> in the script.
>
> The other option — modifying systemd — is also possible, but it won't
> happen without a good reason. Your usecase should be trivially solved
> by modifying the script, so it's not good enough.
>
> Zbyszek
>
Zbyszku,
I add remount just after pivot_root. No change.
I don't get one thing: why exactly such script works OK for SysV ?
If it works for SysV - it means script leaves / in rw mode.
So it leaves / in rw mode also for systemd (only difference between SysV
and systemd is script last line).
So logic say for me that systemd changes / mode to ro. But why?
br
More information about the systemd-devel
mailing list