[systemd-devel] systemd-fsck-root semantics

Colin Guthrie gmane at colin.guthr.ie
Wed Jul 2 06:03:03 PDT 2014


'Twas brillig, and Daniel Drake at 02/07/14 13:29 did gyre and gimble:
> On Wed, Jul 2, 2014 at 1:13 PM, Zbigniew Jędrzejewski-Szmek
> <zbyszek at in.waw.pl> wrote:
>> Thinking about it, I'm not sure how the new systemd would know that
>> systemd-fsck at dev-something.service from the initramfs is the same
>> thing as systemd-fsck-root.service. Maybe that's the problem?
>>
>> Currently systemd-fsck-root.service does nothing if / is mounted rw,
>> which of course is used by almost everybody, so I think you might
>> be using codepaths that are rarely tested.
> 
> If I'm reading things right, actually the default behaviour is (when
> no hints are supplied in kernel cmdline) :
>  1. systemd runs fsck on root from initramfs
>  2. systemd mounts root fs ro

I'd have thought that there would be more steps here...

e.g.:
2a. Check /sysroot/forcefsck file's existence and run fsck if so.

>  3. switch-root onto real system
>  4. systemd-fsck-root runs
>  5. systemd-remount-fs remounts / as rw
> 
> Also just noticed another interesting thing -
> systemd-fsck-root.service is only loaded dynamically, when /etc/fstab
> has a non-zero passno for /. So maybe the idea is that anyone running
> a regular and modern dracut/systemd setup sets passno=0 for / in
> fstab, with the knowledge that fsck of / is done by the initramfs.

I don't really see why there would be a problem checking the
/sysroot/etc/fstab here while still in the initramfs and doing the same
thing in the pre-switchroot environment (perhaps umounting it again and
mounting it fresh after the fsck if this is still something that is
needed these days?), but as you point out I'm not sure what mechanism is
used to tell e.g. systemd-fsck-root.service to do nothing... it would be
easy to conditionalise this with some touched flag files in
/run/initramfs/ tree if needed.

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list