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

LVM volumes are not activated on boot #819

Open
spigell opened this issue Nov 19, 2021 · 4 comments
Open

LVM volumes are not activated on boot #819

spigell opened this issue Nov 19, 2021 · 4 comments
Labels
kind/bug Something isn't working

Comments

@spigell
Copy link

spigell commented Nov 19, 2021

Version (k3OS / kernel)
v0.20.11-k3s2r1

Architecture
amd64

Describe the bug
Greeting! I created my own disk layout and installed bootloader. But when k3os boots all volumes not activated. Is there any workarounds?

To Reproduce

Packer boot_command

  default = [
    "rancher", "<enter>",
    "export K3OS_INSTALL_POWER_OFF=true", "<enter>",
    "export INTERACTIVE=true", "<enter>",
    "export K3OS_INSTALL_NO_FORMAT=true", "<enter>",
    "curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/create-disk-layout.sh | sudo bash", "<enter>",
    "<wait5m>",
    "sudo -E k3os install", "<enter>",
    "1", "<enter>", "y", "<enter>",
    "http://{{ .HTTPIP }}:{{ .HTTPPort }}/config.yml", "<enter>", "y", "<enter>"
    ...install bootloader...
  ]

create-disk-layout.sh

readonly DEVICE=/dev/vda
readonly PART=${DEVICE}1


dd if=/dev/zero of=${DEVICE} bs=1M count=1

parted -s ${DEVICE} mklabel msdos
parted -s ${DEVICE} mkpart primary 1 100%
parted -s ${DEVICE} set 1 lvm on
parted -s ${DEVICE} set 1 boot on
partprobe ${DEVICE}
sleep 2

pvcreate $PART
vgcreate k3os $PART
lvcreate -n root -l 100%FREE k3os

mkfs.ext4 -F -L K3OS_STATE /dev/k3os/root


Expected behavior
All lvm volumes will be activated

Actual behavior
Without lvm k3os can't determine boot mode. If I specify mode via kernel (k3os.mode=disk) k3os can't mount root partition
Additional context
photo_2021-11-25_03-35-26

@spigell spigell added the kind/bug Something isn't working label Nov 19, 2021
@dweomer
Copy link
Contributor

dweomer commented Nov 24, 2021

I haven't double-checked but LVM should be present in the initrd. You may need a modules entry in your config.yaml.

@spigell
Copy link
Author

spigell commented Nov 25, 2021

Hi! i have attached a screenshot to description.
I tried to add lvm to modules and also specify 'vgchange -a y' to init_cmd => It can't find partition with K3OS_STATE label because a lvm volume is not activated.

@ivan98
Copy link

ivan98 commented Dec 6, 2021

@spigell, can you show us your config.yaml? I have successfully mounted a LVM RAID5 device but am now using mdadm for the same.

@spigell
Copy link
Author

spigell commented Dec 12, 2021

@ivan98 Hi. Here it is:

init_cmd:
- 'sudo vgchange -a y'
boot_cmd:
- 'sudo sh -c "echo GA_PATH=/dev/vport1p1 > /etc/conf.d/qemu-guest-agent"'
k3os:
  modules:
  - lvm
  - wireguard
  password: "$6$7Mw7WhZ6wwxR28uD$W3VhXiO7zTQm.jubGlxHLxWsXKFLNwQUbIenxjfRnqoUrfyl0ORlYRB9m3AJcvFppkccO6BsCV7cT5hIzglwM."

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

3 participants