Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
fsck on an encrypted /boot partition
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
etnull
Guru
Guru


Joined: 26 Mar 2019
Posts: 330

PostPosted: Fri May 31, 2019 7:00 pm    Post subject: fsck on an encrypted /boot partition Reply with quote

I have my /boot partition encrypted on a separate USB flash drive.
When I boot - first it boots the grub bootloader, then GRUB asks me for my /boot passphrase, then it continues to initramfs where it decrypts and mounts the rest of the drives and finishes the boot process.
I want to fsck my /boot partition every time on boot, but when I'm in initramfs the /boot partition is already unmounted and its crypt volume is closed, I think GRUB does it as soon as the job of a bootloader is done.
How can I do fsck on an encrypted /boot? I would love not to mount /boot once again in initramfs, as it would take ~10 additional seconds, and it is useless if my boot process is already successful, I want to check /boot fs, right after it decrypts itself but before it is mounted or unmounted by GRUB.
---
I tried to add fsck.mode=force fsck.repair=yes to a GRUB_CMDLINE_LINUX_DEFAULT, grub variable but It doesn't seem to do anything, at least I haven't noticed any difference in the dmesg output.


Last edited by etnull on Tue Jun 18, 2019 11:09 am; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 45451
Location: 56N 3W

PostPosted: Fri May 31, 2019 7:54 pm    Post subject: Reply with quote

etnull,

Grub cannot mount any of your drives. Mounting involves the kernel and userspace. Neither are available until grub is long gone.

grub makes its own arrangements for reading your /boot.
unless grub has a fsck module, grub cannot perform the check you would like.
Then how many filesystems should it support?

You need to do this either in the initrd at startup, or in the shutdown sequence.
Its a bit late after a successful start.

The filesystem must not be mounted but must be decrypted to run fsck.
If/when fsck finds a problem what would you have it do?
Fix it is usually the wrong answer as fsck guesses what should be there and often guesses incorrectly.
As a result, it makes a bad situation worse.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
etnull
Guru
Guru


Joined: 26 Mar 2019
Posts: 330

PostPosted: Fri May 31, 2019 8:28 pm    Post subject: Reply with quote

I had previously some problems with fs on my USB flash drive, and fsck did helped me to boot successfully, though it was a system which was in its entirety on the same USB flash drive (without any write reducing modifications). I guess having only /boot on an external USB drive will be much less dangerous? I have a relatively frequent power losses. Does /boot mounts as ro by GRUB, correct? In this case it should basically be safe no matter what happens (apart of drive malfunction itself or power loss during grub-mkconfig)
Also my /boot entry in fstab is completely ignored, if I set defaults,ro, it still unmounts by GRUB.. how can I prevent GRUB to unmount /boot automatically?
Back to top
View user's profile Send private message
jamapii
Guru
Guru


Joined: 16 Sep 2004
Posts: 582

PostPosted: Sun Jun 02, 2019 10:21 am    Post subject: Reply with quote

Whatever GRUB "mounts", is forgotten when the kernel takes over.

I think as no bootloader does fsck, and if a later fsck is not what's needed, you can take advantage of it being a USB drive, and keep some working backups.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum