Fix PVE LXC Container Startup

Fixing Proxmox VE LXC container startup after upgrading to Ubuntu 24.04


Before Starting

I am using Proxmox VE 8.2.2, but the solution should work on any Proxmox VE version.

This issue was fixed officially but it's currently only available in the "Test" repository but not in the "No-Subscription" or "Enterprise" repository as of 2024-11-05.
Ref: setup: support Ubuntu 24.04 Noble

The Problem

After updating a Proxmox VE LXC container with ID 100 from Ubuntu 22.04 to Ubuntu 24.04, the container failed to start with the following error:

run_buffer: 571 Script exited with status 255
lxc_init: 845 Failed to run lxc.hook.pre-start for container "100"
__lxc_start: 2034 Failed to initialize container "100"
TASK ERROR: startup for container '100' failed

This blog post will guide you through the steps to resolve the startup failure caused by the unsupported Ubuntu version.

Identifying the Issue

Let's start the container again but in foreground mode and store the debug logs so we can debug the issue.
Replace 100 with the ID of your container:

lxc-start -n 100 -F -l DEBUG -o /tmp/lxc-100.log

Inspecting the logs, we can see that the startup failed because of "unsupported Ubuntu version '24.04'":

/tmp/lxc-100.log
lxc-start 100 20241104192347.208 INFO     confile - ../src/lxc/confile.c:set_config_idmaps:2273 - Read uid map: type u nsid 0 hostid 100000 range 65536
lxc-start 100 20241104192347.208 INFO     confile - ../src/lxc/confile.c:set_config_idmaps:2273 - Read uid map: type g nsid 0 hostid 100000 range 65536
lxc-start 100 20241104192347.208 INFO     lsm - ../src/lxc/lsm/lsm.c:lsm_init_static:38 - Initialized LSM security driver AppArmor
lxc-start 100 20241104192347.208 INFO     utils - ../src/lxc/utils.c:run_script_argv:587 - Executing script "/usr/share/lxc/hooks/lxc-pve-prestart-hook" for container "100", config section "lxc"
lxc-start 100 20241104192347.853 DEBUG    utils - ../src/lxc/utils.c:run_buffer:560 - Script exec /usr/share/lxc/hooks/lxc-pve-prestart-hook 100 lxc pre-start produced output: unsupported Ubuntu version '24.04'
 
lxc-start 100 20241104192347.868 ERROR    utils - ../src/lxc/utils.c:run_buffer:571 - Script exited with status 255
lxc-start 100 20241104192347.868 ERROR    start - ../src/lxc/start.c:lxc_init:845 - Failed to run lxc.hook.pre-start for container "100"
lxc-start 100 20241104192347.868 ERROR    start - ../src/lxc/start.c:__lxc_start:2034 - Failed to initialize container "100"
lxc-start 100 20241104192347.868 INFO     utils - ../src/lxc/utils.c:run_script_argv:587 - Executing script "/usr/share/lxcfs/lxc.reboot.hook" for container "100", config section "lxc"
lxc-start 100 20241104192348.370 INFO     utils - ../src/lxc/utils.c:run_script_argv:587 - Executing script "/usr/share/lxc/hooks/lxc-pve-poststop-hook" for container "100", config section "lxc"
lxc-start 100 20241104192348.972 ERROR    lxc_start - ../src/lxc/tools/lxc_start.c:lxc_start_main:307 - The container failed to start
lxc-start 100 20241104192348.972 ERROR    lxc_start - ../src/lxc/tools/lxc_start.c:lxc_start_main:312 - Additional information can be obtained by setting the --logfile and --logpriority options
lxc-start 100 20241104192454.590 INFO     confile - ../src/lxc/confile.c:set_config_idmaps:2273 - Read uid map: type u nsid 0 hostid 100000 range 65536
lxc-start 100 20241104192454.590 INFO     confile - ../src/lxc/confile.c:set_config_idmaps:2273 - Read uid map: type g nsid 0 hostid 100000 range 65536
lxc-start 100 20241104192454.591 INFO     lsm - ../src/lxc/lsm/lsm.c:lsm_init_static:38 - Initialized LSM security driver AppArmor
lxc-start 100 20241104192454.591 INFO     utils - ../src/lxc/utils.c:run_script_argv:587 - Executing script "/usr/share/lxc/hooks/lxc-pve-prestart-hook" for container "100", config section "lxc"
lxc-start 100 20241104192455.246 DEBUG    utils - ../src/lxc/utils.c:run_buffer:560 - Script exec /usr/share/lxc/hooks/lxc-pve-prestart-hook 100 lxc pre-start produced output: unsupported Ubuntu version '24.04'
 
lxc-start 100 20241104192455.261 ERROR    utils - ../src/lxc/utils.c:run_buffer:571 - Script exited with status 255
lxc-start 100 20241104192455.261 ERROR    start - ../src/lxc/start.c:lxc_init:845 - Failed to run lxc.hook.pre-start for container "100"
lxc-start 100 20241104192455.261 ERROR    start - ../src/lxc/start.c:__lxc_start:2034 - Failed to initialize container "100"
lxc-start 100 20241104192455.261 INFO     utils - ../src/lxc/utils.c:run_script_argv:587 - Executing script "/usr/share/lxcfs/lxc.reboot.hook" for container "100", config section "lxc"
lxc-start 100 20241104192455.763 INFO     utils - ../src/lxc/utils.c:run_script_argv:587 - Executing script "/usr/share/lxc/hooks/lxc-pve-poststop-hook" for container "100", config section "lxc"
lxc-start 100 20241104192456.385 ERROR    lxc_start - ../src/lxc/tools/lxc_start.c:lxc_start_main:307 - The container failed to start
lxc-start 100 20241104192456.385 ERROR    lxc_start - ../src/lxc/tools/lxc_start.c:lxc_start_main:312 - Additional information can be obtained by setting the --logfile and --logpriority options

Solution

The error occurs because the Proxmox VE container setup script does not yet include support for the latest Ubuntu 24.04 release.
To resolve this issue, we need to manually add the new version to the $known_versions list in the container setup script.

  1. Open the Ubuntu container setup script located at /usr/share/perl5/PVE/LXC/Setup/Ubuntu.pm.
  2. Find the $known_versions hash and add the entry for Ubuntu 24.04.
/usr/share/perl5/PVE/LXC/Setup/Ubuntu.pm
my $known_versions = {
    '24.04' => 1, # noble LTS
    '23.10' => 1, # mantic
    '23.04' => 1, # lunar
    '22.10' => 1, # kinetic
    '22.04' => 1, # jammy LTS
    '21.10' => 1, # impish
    '21.04' => 1, # hirsute
    '20.10' => 1, # groovy
    '20.04' => 1, # focal LTS
    '19.10' => 1, # eoan
    '19.04' => 1, # disco
    '18.10' => 1, # cosmic
    '18.04' => 1, # bionic LTS
    # ... other Ubuntu versions ...
};

After making this change, the Proxmox VE container should now be able to start with the Ubuntu 24.04 image.

Conclusion

By following the steps outlined in this blog post, you should be able to resolve the startup issues with Proxmox VE LXC containers after upgrading to Ubuntu 24.04.
Remember to keep an eye out for any official updates from the Proxmox VE team, as they may provide a more permanent solution in the future.