Ask Your Question
0

Disabling auto-dsck systemd service

asked 2014-04-27 01:55:55 -0500

rmblr gravatar image

I have my /boot partition on a removable USB device. When the device is removed, which I tend to do as I have a dearth of USB ports, and the auto-scheduled systemd fsck service runs, it fails spectacularly by shutting down X and dropping me to a virtual console. From here I have to reboot to recover.

I've tried disabling the systemd-fsck@dev-disk-by\x2duuid-[SNIP].service but this doesn't work.

As it stands now, I must leave in the usb stick else be interrupted by a complete system shutdown every so often.

How can I effectively disable this service or, even better, make it fail silently if it can't locate my /boot device?

edit retag flag offensive close merge delete

Comments

If I understand correctly, systemd-fsck is only run at boot, not periodically while the system is running.

I suggest you check the system log/journal when that occurs to figure out what's happening exactly.

(Having /boot on a removable USB device which you remove while the system is running is bound to cause problems; one scenario off of the top of my head is if you update the system and there's a new kernel it'll fail since it can't generate the inistramfs).

Ahmad Samir gravatar imageAhmad Samir ( 2014-04-27 11:33:40 -0500 )edit

I'm aware of the implications of updates when running with /boot on a separate USB device, that's not an issue. Anyways, I'll reproduce this issue and see if I can salvage the journal when it happens and post it here.

rmblr gravatar imagermblr ( 2014-04-28 06:31:24 -0500 )edit

3 Answers

Sort by » oldest newest most voted
2

answered 2014-07-18 22:58:02 -0500

abadrinath gravatar image

You have 2 options:

Disable in /etc/fstab

#
# /etc/fstab
# Created by anaconda on Mon Apr 14 19:56:10 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=6b266543-a497-44de-981f-ee460b85590a /                       ext4    defaults        1 0 
UUID=48ce0f9f-eee1-4f72-b90e-1a28e6a83c8e /boot                   ext4    defaults        1 0
UUID=D58E-1C9A          /boot/efi               vfat    umask=0077,shortname=winnt 0 0
UUID=448774a1-05f9-47e6-9fad-ac5ac4e10b64 /home                   ext4    defaults        1 0
UUID=a60856f9-2247-4d13-b4a8-a9e2ecd91aa4 /var                    ext4    defaults        1 0
UUID=0a0ff8de-5395-469d-8e51-a7982d4a3645 swap                    swap    defaults        0 0

As you see, the last value should be a zero (0) for not checking, and a one (1) to check. Be sure to backup your /etc/fstab using cp /etc/fstab /etc/fstab.bak. Reboot (reboot) to apply the changes.

Disable the service

systemd-fsck-root.service                   static  
systemd-fsck@.service                       static  

using systemctl disable systemd-fsck@.service or systemctl mask systemd-fsck@.service. The first one is safer to get rid of (just systemctl enable systemd-fsck@.service), but the other one is harder to get rid of. I recommend the first.

edit flag offensive delete link more
1

answered 2014-07-17 16:27:51 -0500

zbyszek gravatar image

First a clarification: systemd-fsck@.service is not run periodically. Instead there's the following dependency chain: basic.target ← sysinit.target ← local-fs.target ← boot.mount ← systemd-fsck@dev-xxx.service ← dev-xxx.device . It is created automatically because /boot is in your fstab. When any service is started, it has an automatic dependency on basic.target and systemd will start all dependencies if they have not been started yet. When you remove the USB device, systemd notices that the device is gone and removes the dev-xxx.device unit, which in turn causes systemd-fsck@dev-xxx.service and boot.mount to be removed. At some later point, when a service is started, the fact that boot.mount is missing causes a switch to emergency.target.

There's a couple of options, probably the best one is to make /boot automounted, by adding x-systemd.automount setting in the options fields in /etc/fstab. Before you remove the stick, be sure to unmount it, e.g. by saying

 systemctl stop boot.mount
edit flag offensive delete link more
0

answered 2014-07-17 19:09:17 -0500

hedayat gravatar image

If you want your /boot device to not be checked by fsck, all you need to do is to specify it in your /etc/fstab. You should change the value of sixth field of the /boot line to zero as pointed out in man fstab:

   The sixth field (fs_passno).
          ...If the sixth field is not present or zero, a value of zero is returned and fsck will assume that the filesystem does not need to be checked.
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-04-27 01:55:55 -0500

Seen: 4,649 times

Last updated: Jul 18 '14