/boot 파티션이 부팅 시 마운트되지 않음

/boot 파티션이 부팅 시 마운트되지 않음

암호화된 두 개의 SSD에 RAID-1 mdraid를 실행하는 서버가 있습니다. 머신을 부팅한 후 /boot(또한 EFI 파티션)는 예상대로 자동으로 마운트되지 않습니다. 정상 시작 후 상태:

$ lsblk 
NAME       MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
sda          8:0    0 931,5G  0 disk  
├─sda1       8:1    0   500M  0 part  
│ └─md127    9:127  0 499,9M  0 raid1 
└─sda2       8:2    0   930G  0 part  
  └─md126    9:126  0 929,9G  0 raid1 
    └─root 253:0    0 929,9G  0 crypt /
sdb          8:16   0 931,5G  0 disk  
├─sdb1       8:17   0   500M  0 part  
│ └─md127    9:127  0 499,9M  0 raid1 
└─sdb2       8:18   0   930G  0 part  
  └─md126    9:126  0 929,9G  0 raid1 
    └─root 253:0    0 929,9G  0 crypt /
$ cat /proc/cmdline 
initrd=\intel-ucode.img initrd=\initramfs-linux.img root=UUID=2b9dc231-ed74-442c-841d-8254d3d7e91a rw rd.luks.options=bf4b8b61-5907-408c-8fcb-65f77e34cc86=keyfile-timeout=10s rd.luks.key=bf4b8b61-5907-408c-8fcb-65f77e34cc86=/keyfile:UUID=B332-1C72 rd.luks.name=bf4b8b61-5907-408c-8fcb-65f77e34cc86=root init=/usr/lib/systemd/systemd quiet
$ sudo mdadm --detail /dev/md126
/dev/md126:
           Version : 1.2
     Creation Time : Fri Nov 13 12:32:44 2020
        Raid Level : raid1
        Array Size : 975043584 (929.87 GiB 998.44 GB)
     Used Dev Size : 975043584 (929.87 GiB 998.44 GB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Fri Jul 16 13:50:39 2021
             State : clean 
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : bitmap

              Name : archiso:cryptroot
              UUID : e4353e5f:188eaaa7:afbb8df6:a1a914bb
            Events : 5329

    Number   Major   Minor   RaidDevice State
       0       8        2        0      active sync   /dev/sda2
       2       8       18        1      active sync   /dev/sdb2
$ sudo mdadm --detail /dev/md127
/dev/md127:
           Version : 1.0
     Creation Time : Fri Nov 13 15:41:39 2020
        Raid Level : raid1
        Array Size : 511936 (499.94 MiB 524.22 MB)
     Used Dev Size : 511936 (499.94 MiB 524.22 MB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

       Update Time : Fri Jul 16 13:46:13 2021
             State : clean 
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : resync

              Name : archiso:efi
              UUID : 457d2b2d:e0f98963:65fb2d50:43d742ad
            Events : 150

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       2       8       17        1      active sync   /dev/sdb1
$ mount
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,size=4007800k,nr_inodes=1001950,mode=755,inode64)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,size=1613448k,nr_inodes=819200,mode=755,inode64)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
/dev/mapper/root on / type ext4 (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=31,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=13578)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,nr_inodes=409600,inode64)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
none on /run/credentials/systemd-sysusers.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=806720k,nr_inodes=201680,mode=700,uid=1000,gid=1001,inode64)
$ cat /etc/fstab
# /dev/mapper/root LABEL=root
UUID=2b9dc231-ed74-442c-841d-8254d3d7e91a   /           ext4        rw,relatime 0 1

# tracefs
tracefs                 /sys/kernel/tracing tracefs     rw,nosuid,nodev,noexec  0 0

# /dev/md127 LABEL=EFI
UUID=B332-1C72          /boot       vfat        rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro   0 2

$ cat /etc/mkinitcpio.conf
# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES="piix ide_disk reiserfs"
MODULES=(vfat)

# BINARIES
# This setting includes any additional binaries a given user may
# wish into the CPIO image.  This is run last, so it may be used to
# override the actual binaries included by a given hook
# BINARIES are dependency parsed, so you may safely ignore libraries
BINARIES=()

# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way.  This is useful for config files.
FILES=()

# HOOKS
# This is the most important setting in this file.  The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added.  Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
##   This setup specifies all modules in the MODULES setting above.
##   No raid, lvm2, or encrypted root is needed.
#    HOOKS="base"
#
##   This setup will autodetect all modules for your system and should
##   work as a sane default
#    HOOKS="base udev autodetect block filesystems"
#
##   This setup will generate a 'full' image which supports most systems.
##   No autodetection is done.
#    HOOKS="base udev block filesystems"
#
##   This setup assembles a pata mdadm array with an encrypted root FS.
##   Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
#    HOOKS="base udev block mdadm encrypt filesystems"
#
##   This setup loads an lvm2 volume group on a usb device.
#    HOOKS="base udev block lvm2 filesystems"
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr, fsck and shutdown hooks.
HOOKS=(base systemd autodetect keyboard sd-vconsole modconf block mdadm_udev sd-encrypt filesystems fsck)

# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"
COMPRESSION="cat"

# COMPRESSION_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=""
$ sudo find /run/systemd/ -name *.mount
/run/systemd/generator/boot.mount
/run/systemd/generator/sys-kernel-tracing.mount
/run/systemd/generator/local-fs.target.requires/boot.mount
/run/systemd/generator/local-fs.target.requires/sys-kernel-tracing.mount
/run/systemd/generator/local-fs.target.requires/-.mount
/run/systemd/generator/-.mount
/run/systemd/units/invocation:sys-fs-fuse-connections.mount
/run/systemd/units/invocation:sys-kernel-config.mount
/run/systemd/units/invocation:tmp.mount
/run/systemd/units/invocation:sys-kernel-tracing.mount
/run/systemd/units/invocation:sys-kernel-debug.mount
/run/systemd/units/invocation:dev-mqueue.mount
/run/systemd/units/invocation:dev-hugepages.mount
/run/systemd/units/invocation:sysroot.mount
$ sudo cat /run/systemd/generator/boot.mount
# Automatically generated by systemd-fstab-generator

[Unit]
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
SourcePath=/etc/fstab
Before=local-fs.target
After=blockdev@dev-disk-by\x2duuid-B332\x2d1C72.target

[Mount]
Where=/boot
What=/dev/disk/by-uuid/B332-1C72
Type=vfat
Options=rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro
$ cat /run/systemd/generator/local-fs.target.requires/boot.mount
# Automatically generated by systemd-fstab-generator

[Unit]
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
SourcePath=/etc/fstab
Before=local-fs.target
After=blockdev@dev-disk-by\x2duuid-B332\x2d1C72.target

[Mount]
Where=/boot
What=/dev/disk/by-uuid/B332-1C72
Type=vfat
Options=rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro

정보 잡지

재부팅 후 실행 하면 sudo mount -a/boot 파티션이 오류 없이 마운트됩니다. /boot가 자동으로 마운트되지 않는 이유는 무엇입니까? 왜 수동으로만 할 수 있나요?

고쳐 쓰다

$ systemctl status boot.mount
○ boot.mount - /boot
     Loaded: loaded (/etc/fstab; generated)
     Active: inactive (dead) since Thu 2021-08-05 10:07:28 CEST; 48s ago
      Where: /boot
       What: /dev/disk/by-uuid/B332-1C72
       Docs: man:fstab(5)
             man:systemd-fstab-generator(8)
        CPU: 5ms

Aug 05 10:07:28 offsrv systemd[1]: Unmounting /boot...
Aug 05 10:07:28 offsrv systemd[1]: boot.mount: Deactivated successfully.
Aug 05 10:07:28 offsrv systemd[1]: Unmounted /boot.
$ journalctl -au boot.mount
-- Journal begins at Fri 2021-07-23 02:09:41 CEST, ends at Thu 2021-08-05 10:08:02 CEST. --
Jul 26 19:53:05 offsrv systemd[1]: Unmounting /boot...
Jul 26 19:53:05 offsrv systemd[1]: boot.mount: Deactivated successfully.
Jul 26 19:53:05 offsrv systemd[1]: Unmounted /boot.
-- Boot c3526248def14c31869cf62cc450e680 --
Jul 26 19:53:26 offsrv systemd[1]: Unmounting /boot...
Jul 26 19:53:26 offsrv systemd[1]: boot.mount: Deactivated successfully.
Jul 26 19:53:26 offsrv systemd[1]: Unmounted /boot.
-- Boot 6b6baf91260148e5a3e70e94a48c26a9 --
Aug 03 14:06:56 offsrv systemd[1]: Unmounting /boot...
Aug 03 14:06:56 offsrv systemd[1]: boot.mount: Deactivated successfully.
Aug 03 14:06:56 offsrv systemd[1]: Unmounted /boot.
-- Boot 5bf6c69ef8e0452388e425f7fbd0d75e --
Aug 03 14:07:15 offsrv systemd[1]: Unmounting /boot...
Aug 03 14:07:15 offsrv systemd[1]: boot.mount: Deactivated successfully.
Aug 03 14:07:15 offsrv systemd[1]: Unmounted /boot.
Aug 05 10:07:06 offsrv systemd[1]: Unmounting /boot...
Aug 05 10:07:06 offsrv systemd[1]: boot.mount: Deactivated successfully.
Aug 05 10:07:06 offsrv systemd[1]: Unmounted /boot.
-- Boot 3845a0a027984e5995d42ac52c87813f --
Aug 05 10:07:28 offsrv systemd[1]: Unmounting /boot...
Aug 05 10:07:28 offsrv systemd[1]: boot.mount: Deactivated successfully.
Aug 05 10:07:28 offsrv systemd[1]: Unmounted /boot.

답변1

좀 더 고민한 끝에 파일 시스템에 작은 문제가 있다는 사실이 밝혀졌고 다음을 사용하여 이를 감지하고 수정했습니다 dosfstools.

$ sudo dosfsck /dev/md126
fsck.fat 4.2 (2021-01-31)
There are differences between boot sector and its backup.
This is mostly harmless. Differences: (offset:original/backup)
  65:01/00
1) Copy original to backup
2) Copy backup to original
3) No action
[123?q]? 1
Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
1) Remove dirty bit
2) No action
[12?q]? 1

*** Filesystem was changed ***
The changes have not yet been written, you can still choose to leave the
filesystem unmodified:
1) Write changes
2) Leave filesystem unchanged
[12?q]? 1
/dev/md126: 17 files, 11536/127730 clusters

그 후에 /boot는 자동으로 설치됩니다(여러 번의 재부팅으로 테스트). 불행히도 systemd에 해당하는 마운트 장치는 이 문제를 기록/보고하지 않으므로 무슨 일이 일어나고 있는지 알 수 없습니다.

관련 정보