Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

loadkmap in sysinit runlevel disrupts localmount #814

Open
ivan98 opened this issue Nov 8, 2021 · 1 comment
Open

loadkmap in sysinit runlevel disrupts localmount #814

ivan98 opened this issue Nov 8, 2021 · 1 comment
Labels
kind/bug Something isn't working

Comments

@ivan98
Copy link

ivan98 commented Nov 8, 2021

Version (k3OS / kernel)
k3os version v0.22.2-k3s2r0
5.4.0-88-generic _99 SMP Tue Oct 5 16:53:38 UTC 2021

Architecture
x86_64

Describe the bug
I need to mount a LVM disk before k3s-service starts, so I did the following:

  • Add lvm to boot runlevel
  • Add entry into /etc/fstab

Thinking that service localmount will auto mount the entry in /etc/fstab

To Reproduce

boot_cmd:
  - "rc-update add lvm boot"
  - "sed -i 's|^#critical_mounts.*|critical_mounts=\"/data\"|' /etc/conf.d/localmount"
  - "sed -i '$arc_before=\"localmount\"' /etc/conf.d/lvm"
write_files:
  - path: /etc/fstab
    content: |-
      /dev/cdrom     /media/cdrom iso9660 noauto,ro 0 0
      /dev/usbdisk   /media/usb   vfat    noauto,ro 0 0
      /dev/vg2/lvol0 /data        xfs     noatime,nodiratime,attr2,logbsize=256k 0 2
      #
    owner: root
    permissions: '0644'

Expected behavior
/dev/vg2/lvol0 should be mounted at /data before k3s-service starts

Actual behavior
During the sysinit phase of boot up, loadkmap requires and runs the localmount service.
localmount fails to find /dev/vg2/lvol0 as lvm has not started yet.

In the boot phase, lvm starts but since localmount has already started in the previous phrase, it no longer runs. /dev/vg2/lvol0 is now present but not mounted to /data.

Additional context
I downloaded Alpine Linux 3.14.2, and notice that its loadkmap service is in the boot runlevel, not in the sysinit runlevel. While I update my config.yaml accordingly, it is working:

boot_cmd:
  - "rc-update del loadkmap sysinit"
  - "rc-update add loadkmap boot"
  - "rc-update add lvm boot"
  - "sed -i 's|^#critical_mounts.*|critical_mounts=\"/data\"|' /etc/conf.d/localmount"
  - "sed -i 's/^#rc_logger.*/rc_logger=\"YES\"/' /etc/rc.conf"
  # - "sed -i 's/^#rc_verbose.*/rc_verbose=\"YES\"/' /etc/rc.conf"
  - "sed -i '$arc_before=\"localmount\"' /etc/conf.d/lvm"
write_files:
  - path: /etc/fstab
    content: |-
      /dev/cdrom     /media/cdrom iso9660 noauto,ro 0 0
      /dev/usbdisk   /media/usb   vfat    noauto,ro 0 0
      /dev/vg2/lvol0 /data        xfs     noatime,nodiratime,attr2,logbsize=256k 0 2
      #
    owner: root
    permissions: '0644'
@ivan98 ivan98 added the kind/bug Something isn't working label Nov 8, 2021
@dkowis
Copy link

dkowis commented Nov 11, 2021

I think I also just encountered this trying to get lvm of disks working, and failing miserably. Thanks for this workaround.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants