Centos 8.1 CT - Cannot start container (again)

MrDigit

New Member
Feb 23, 2020
3
0
1
24
Hello all,

just started my first steps with proxmox and got a really annoying problem after 1 hour that I want to share with you.

I've installed Proxmox yesterday, version 6.1-3. Then tried installing an LXC container with Centos 8. Everything went smooth.

Then I've started a yum update inside Centos 8, current version is Centos 8.1.1911.

Afterwards I could not start the container again, error message:

Code:
conf - conf.c:run_buffer:340 - Script exec /usr/share/lxc/hooks/lxc-pve-prestart-hook 101 lxc pre-start produced output: unsupported centos release 'CentOS Linux release 8.1.1911 (Core) '

The problem seems to be in /usr/share/perl5/PVE/LXC/Setup/CentOS.pm:

Perl:
if ($release =~ m/release\s+(\d+\.\d+)(\.\d+)?/) {
        if ($1 >= 5 && $1 <= 8) {
            $version = $1;
        }
    }

Ok, LXC is checking for the major.minor number and not only for the major number.

Solving the problem when LXC is really interested in minor version is not so hard:

Diff:
--- CentOS.pm.bak       2019-11-26 18:27:41.000000000 +0100
+++ CentOS.pm   2020-02-23 14:06:26.606020102 +0100
@@ -20,7 +20,7 @@
     my $version;

     if ($release =~ m/release\s+(\d+\.\d+)(\.\d+)?/) {
-       if ($1 >= 5 && $1 <= 8) {
+       if ($1 >= 5 && $1 <= 8.1) {
            $version = $1;
        }
     }

In my opinion it doesn't make sense to test for point-subreleases, so this should be even better:

Diff:
--- CentOS.pm.bak       2019-11-26 18:27:41.000000000 +0100
+++ CentOS.pm   2020-02-23 14:16:05.954508545 +0100
@@ -19,7 +19,7 @@

     my $version;

-    if ($release =~ m/release\s+(\d+\.\d+)(\.\d+)?/) {
+    if ($release =~ m/release\s+(\d+)\.(\d+)\.(\d+)?/) {
        if ($1 >= 5 && $1 <= 8) {
            $version = $1;
        }

Hope this helps someone :)

Best regards
MrDigit