Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create volume mount point in LXC #1393

Closed
megastary opened this issue Jun 14, 2024 · 7 comments · Fixed by #1398
Closed

Cannot create volume mount point in LXC #1393

megastary opened this issue Jun 14, 2024 · 7 comments · Fixed by #1398
Labels
🐛 bug Something isn't working

Comments

@megastary
Copy link

megastary commented Jun 14, 2024

Edited as it throws errors nearly all the time.

Describe the bug
When defining mount point for LXC, you will receive various errors depending on current state of the VM.

To Reproduce
Steps to reproduce the behavior:

  1. Define volume mount_point for LXC
  2. Run tofu apply
  3. See error

When adding mount_point to existing LXC I get this error:

Error: error updating container: received an HTTP 500 response - Reason: unable to parse volume ID 'ceph'
│ 
│   with module.gitea.module.gitea.proxmox_virtual_environment_container.lxc,
│   on modules/lxc/main.tf line 1, in resource "proxmox_virtual_environment_container" "lxc":
│    1: resource "proxmox_virtual_environment_container" "lxc" 

When creating fresh LXC including volume mountpoint from the start:

Error: error creating container: received an HTTP 500 response - Reason: mount points configured, but 'rootfs' not set - aborting
│ 
│   with module.gitea.module.gitea.proxmox_virtual_environment_container.lxc,
│   on modules/lxc/main.tf line 1, in resource "proxmox_virtual_environment_container" "lxc":
│    1: resource "proxmox_virtual_environment_container" "lxc" {

Please also provide a minimal Terraform configuration that reproduces the issue.

# >>> put your example here <<< #
disk {
    datastore_id = "ceph"
    size         = "4"
}

mount_point {
    # volume mount, a new volume will be created by PVE
    volume = "ceph"
    size   = "8G"
    path   = "/opt/gitea"
  }

Expected behavior
LXC gets created with specified volume mount point.

  • Single or clustered Proxmox: clustered
  • Proxmox version: 8.2.2
  • Provider version (ideally it should be the latest version): 0.60.0
  • Terraform/OpenTofu version: OpenTofu v1.7.2
  • OS (where you run Terraform/OpenTofu from): Fedora 40
  • Debug logs (TF_LOG=DEBUG terraform apply):
@megastary megastary added the 🐛 bug Something isn't working label Jun 14, 2024
@megastary
Copy link
Author

Nvm, now it does not work even with plain number.
Anyone knows why could that be happening?

@megastary megastary changed the title Misleading documentation about LXC volume mount points Cannot create volume mount point in LXC Jun 14, 2024
@bpg
Copy link
Owner

bpg commented Jun 16, 2024

Hi @megastary 👋🏼

Just a sanity check regarding the error message:

Reason: mount points configured, but 'rootfs' not set - aborting

Do you have the operating_system attribute configured in your template? It is not in the example you provided. 🤔

You can also check an example here. These templates are used as part of the integration test suite, which runs on every release.

@bpg bpg added the ⌛ pending author's response Requested additional information from the reporter label Jun 16, 2024
@LinuCC
Copy link

LinuCC commented Jun 16, 2024

I have the same problem in 0.55 as well as in 0.60, I just screwed around a bit and this helped:

  1. Commenting out mount_point and creating the container with terraform apply
  2. Uncommenting the mount_point block and adding its size at the end of the volume name:
  mount_point {
    volume = "local:1"
    size   = "1G"
    path   = "/mnt/foobar"
    backup = true
  }

Based on https://forum.proxmox.com/threads/unable-to-parse-directory-volume-name-with-pct-create.55373/post-254947 and the API request I got from the debug logs it seems like on creation the size in the volume param is missing.

Also:

  • operating_system configured to ubuntu
  • Proxmox v8.1.4

Trying a system update, maybe this'll fix it.

@LinuCC
Copy link

LinuCC commented Jun 17, 2024

Right, after testing out your link @bpg I've been able to reproduce the error by lowering the disk.size of example_template from 10 to 4 (Which OP and me used as disk size):

resource "proxmox_virtual_environment_container" "example_template" {
  vm_id = 323

  start_on_boot = "true"

  disk {
    datastore_id = "local-zfs" // Hardcoded some vals to fit my Proxmox instance
    size         = 4
  }

  // ...
}

Do you have an idea why this would lead to that rootfs error?

Edit:

Thinking about it, maybe the container disk size is just too small for Ubuntu to work properly.
A disk.size of 5 works. But so does a disk.size of 2 and 3, just not 4.
No idea if this is just my system, maybe @megastary can validate this?

@bpg
Copy link
Owner

bpg commented Jun 17, 2024

Thinking about it, maybe the container disk size is just too small for Ubuntu to work properly.

That is my guess as well. After you provisioned with size e.g. 5, can you check what is the reported root filesystem size on the deployed container?

EDIT: That's what I have with my example (10G + 4G mount):

Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/pve-vm--2043--disk--1  9.8G  1.1G  8.2G  12% /
/dev/mapper/pve-vm--2043--disk--0  3.9G   28K  3.7G   1% /mnt/local
none                               492K  4.0K  488K   1% /dev
tmpfs                              2.0G     0  2.0G   0% /dev/shm
tmpfs                              784M  136K  784M   1% /run
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              392M  4.0K  392M   1% /run/user/0

Now sure why 4G rootfs is a limit. I can reproduce it too, so will try to debug.

@bpg bpg removed the ⌛ pending author's response Requested additional information from the reporter label Jun 17, 2024
@bpg
Copy link
Owner

bpg commented Jun 17, 2024

I found the bug, 4Gb rootfs size is the default "magic number". Any value != 4 should work 🤦🏼
Will be fixed in the next release.

@LinuCC
Copy link

LinuCC commented Jun 17, 2024

Haha, great to hear! Thanks so much for picking up the terraform provider btw, incredibly helpful (when it works ;) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
3 participants