You are not logged in.

#1 2015-04-14 16:18:36

DoctorJellyface
Member
From: Slovakia
Registered: 2015-02-19
Posts: 40
Website

[SOLVED] is the fsck hook needed if the systemd hook is present?

Hiya. The Wiki isn't really clear about this. There are some instructions about building a systemd based init image here, but nothing about fsck.

On the silent boot page there is a entry about fsck , more specifically letting systemd check the filesystem instead of the fsck hook, which involves copying configuration files.

I understand both entries, but after migrating my init image to systemd, I keep getting systemd-fsck messages on boot, and now I have a couple of questions:

  • Is my disk being fscked twice?

  • Is the fsck hook needed anymore? What would happen if I remove it?

  • If I want to turn off the output, can I follow the instructions on the Wiki?

  • What is the general recommended approach with systemd and fsck?

I skimmed through this thread, but I must say I didn't become any more educated on this topic.

Thanks.

Last edited by DoctorJellyface (2015-04-16 14:59:29)

Offline

#2 2015-04-15 19:14:34

Bevan
Member
Registered: 2009-09-08
Posts: 100

Re: [SOLVED] is the fsck hook needed if the systemd hook is present?

I just had a quick look on how these things fit together. Short answer: If you want the root filesystem to be checked in the initrd (and therefore before mount) you do need the fsck hook.

Long answer:

systemd-fsck just uses fsck.* to check the disks (see source code line 288ff.). If it does not exist, systemd-fsck just quits. The reason for this is clear: fsck tools are made by filesystem developers, not by systemd developers.

The fsck hook is the only one that installs these binaries (fsck.*) into the initrd (see grep -r 'fsck\.' /usr/lib/initcpio). That means: No fsck hook --> no filesystem check in the initrd.

Now to your questions:

DoctorJellyface wrote:
  • Is my disk being fscked twice?

No. The root filesystem is checked in the initrd if the appropriate fsck.* tool is available. All other filesystems are checked after leaving the initrd.

DoctorJellyface wrote:
  • Is the fsck hook needed anymore? What would happen if I remove it?

It is needed if you want the root filesystem to be checked in the initrd and therefore before being mounted. If you remove it it might be checked after leaving the initrd while being mounted read-only. But I did not test that and don't know if Arch actually does it this way. You may quickly test this yourself.

DoctorJellyface wrote:
  • If I want to turn off the output, can I follow the instructions on the Wiki?

If you use systemd in the initrd you would probably have to edit the files directly in /usr/lib/systemd/system, because mkinitcpio copies the files from there. They will be overwritten on every systemd update so that is not a very nice approach. For all output after leaving the initrd you should be able to follow the steps in the wiki (copy to /etc...)

DoctorJellyface wrote:
  • What is the general recommended approach with systemd and fsck?

My recommendation would be: Keep the fsck hook, because it is the only way to check the filesystem before actually mounting it. It works nicely with the systemd hook.

Offline

#3 2015-04-15 19:36:13

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,769
Website

Re: [SOLVED] is the fsck hook needed if the systemd hook is present?

Bevan wrote:

Keep the fsck hook, because it is the only way to check the filesystem before actually mounting it.

My system performs an fsck check with this mkinitcpio.conf:

MODULES="ahci sd_mod ext4 i915"
BINARIES="fsck fsck.ext4"
FILES=""
HOOKS="base"

So as long as the filesystem-specific fsck variant is present in the "BINARIES" section, it will run.

Offline

#4 2015-04-15 19:55:31

Bevan
Member
Registered: 2009-09-08
Posts: 100

Re: [SOLVED] is the fsck hook needed if the systemd hook is present?

Head_on_a_Stick wrote:

So as long as the filesystem-specific fsck variant is present in the "BINARIES" section, it will run.

Correct. But that's exactly what you get when using the fsck hook together with the autodetect hook. In this case only the binary needed to check your root file system will be included.

Offline

#5 2015-04-16 14:58:23

DoctorJellyface
Member
From: Slovakia
Registered: 2015-02-19
Posts: 40
Website

Re: [SOLVED] is the fsck hook needed if the systemd hook is present?

Thanks a lot! You really helped me clear things out.

Bevan wrote:
DoctorJellyface wrote:
  • Is the fsck hook needed anymore? What would happen if I remove it?

It is needed if you want the root filesystem to be checked in the initrd and therefore before being mounted. If you remove it it might be checked after leaving the initrd while being mounted read-only. But I did not test that and don't know if Arch actually does it this way. You may quickly test this yourself.

I tried removing the fsck hook, and I got no message on startup. I checked the boot log, and it only showed fscking of all the other partitions, so the fscking of the root partition must have happened earlier in the boot process.

I'll leave the fsck hook where it is. Thanks again.

Offline

Board footer

Powered by FluxBB