You are not logged in.

#1 2012-10-19 11:26:14

Butcher
Member
Registered: 2009-02-04
Posts: 158

[SOLVED] How to fsck+badblocks with systemd?

Before systemd I could boot into single mode, then "mount / -o remount,ro" and then "fsck.ext4 -c ...". Now I can't since it says / is in use and I can't remount as read-only. What do I do?

Last edited by Butcher (2012-10-22 09:54:22)

Offline

#2 2012-10-19 11:52:21

89c51
Member
Registered: 2012-06-05
Posts: 741

Re: [SOLVED] How to fsck+badblocks with systemd?

I think that if you boot the kernel with single as a parameter you will get into rescue mode. But better wait for an answer from someone more competent than me.

Offline

#3 2012-10-19 12:11:51

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,635
Website

Re: [SOLVED] How to fsck+badblocks with systemd?

If you want to fsck your /, is there a reason why you're not letting the initramfs do so?


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#4 2012-10-19 12:44:11

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: [SOLVED] How to fsck+badblocks with systemd?

WorMzy wrote:

If you want to fsck your /, is there a reason why you're not letting the initramfs do so?

How would he trigger it?

Offline

#5 2012-10-19 12:49:49

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,635
Website

Re: [SOLVED] How to fsck+badblocks with systemd?

Add fsck to the list of modules in /etc/mkinitcpio.conf, regenerate initramfs. (If necessary) And set pass_no for / to 1 in /etc/fstab. Reboot.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#6 2012-10-19 12:54:44

Gusar
Member
Registered: 2009-08-25
Posts: 3,607

Re: [SOLVED] How to fsck+badblocks with systemd?

graysky wrote:

How would he trigger it?

Add fsck.mode=force to the kernel command-line. The initramfs should be built with the fsck hook of course.

89c51 is also correct, adding single to the kernel command-line will make systemd boot into emergency mode. I know that and I don't even use systemd smile. Adding 1, s, S or emergency will do the same.

Last edited by Gusar (2012-10-19 12:58:59)

Offline

#7 2012-10-19 13:06:04

brain0
Developer
From: Aachen - Germany
Registered: 2005-01-03
Posts: 1,382

Re: [SOLVED] How to fsck+badblocks with systemd?

No, this will boot into rescue.target. What you want is emergency.target. So, you want to add systemd.unit=emergency.target to your command line.

If you have fsck in initramfs (which you should), then you can instead add break=premount. This will drop you into the emergency shell and allow to fsck from there.

Offline

#8 2012-10-19 13:16:02

Gusar
Member
Registered: 2009-08-25
Posts: 3,607

Re: [SOLVED] How to fsck+badblocks with systemd?

brain0 wrote:

No, this will boot into rescue.target. What you want is emergency.target.

Two similar targets? Interesting. I just found Fedora's sysvinit to systemd cheat sheet - adding emergency gets you the emergency target. All the others I mentioned get you the rescue target. Now I'll have to go figure out what the difference between those two targets is smile

Offline

#9 2012-10-19 13:19:42

Butcher
Member
Registered: 2009-02-04
Posts: 158

Re: [SOLVED] How to fsck+badblocks with systemd?

Thanks for your replies. I already have fsck in my initramfs, but I don't have badblocks there. How do I add it?

Offline

#10 2012-10-19 15:21:15

brain0
Developer
From: Aachen - Germany
Registered: 2005-01-03
Posts: 1,382

Re: [SOLVED] How to fsck+badblocks with systemd?

Gusar wrote:

Two similar targets? Interesting. I just found Fedora's sysvinit to systemd cheat sheet - adding emergency gets you the emergency target. All the others I mentioned get you the rescue target. Now I'll have to go figure out what the difference between those two targets is smile

[Unit]
Description=Emergency Mode
Documentation=man:systemd.special(7)
Requires=emergency.service
After=emergency.service
AllowIsolate=yes

emergency.target only launches emergency.service, which is a root shell (sulogin) on your primary console. No udev, no journald, no nothing.

[Unit]
Description=Rescue Mode
Documentation=man:systemd.special(7)
Requires=sysinit.target rescue.service
After=sysinit.target rescue.service
AllowIsolate=yes

[Install]
Alias=kbrequest.target

This launches sysinit.target, thus udev and journal are running and file systems are mounted. Then it launches rescue.service, which is almost identical to emergency.service.

Last edited by brain0 (2012-10-19 15:21:47)

Offline

#11 2012-10-19 15:21:33

brain0
Developer
From: Aachen - Germany
Registered: 2005-01-03
Posts: 1,382

Re: [SOLVED] How to fsck+badblocks with systemd?

Butcher wrote:

Thanks for your replies. I already have fsck in my initramfs, but I don't have badblocks there. How do I add it?

BINARIES="badblocks" in mkinitcpio.conf.

Offline

Board footer

Powered by FluxBB