[SOLVED] lxc template for ubuntu 22.04

ilia987

Active Member
Sep 9, 2019
275
13
38
37
I know this is a bit early and the version is not final,
but i would like to start integrate our system and migration from older Ubuntu to this one,
i have a working Ubuntu 20.04 based on standard 20.04 template, but the upgrade did not work.

any idea what would be the best practice ?
 
I have several LXC containers running 22.04 LTS beta. How did the upgrade not work? You should also be able to use a 21.10 template and upgrade it with "do-release-upgrade -d".
from 20.04 i did upgrade and this is the output:


Code:
Reading cache

Checking package manager
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Hit http://archive.ubuntu.com/ubuntu focal InRelease                                                   
Hit http://archive.ubuntu.com/ubuntu focal-updates InRelease                                           
Hit http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease                                       
Hit http://archive.ubuntu.com/ubuntu focal-security InRelease                                           
Hit http://packages.microsoft.com/repos/code stable InRelease                                           
Hit https://packages.microsoft.com/repos/vscode stable InRelease                                       
Fetched 0 B in 0s (0 B/s)                                                                               
Reading package lists... Done   
Building dependency tree         
Reading state information... Done

Restoring original system state

Aborting
Reading package lists... Done   
Building dependency tree         
Reading state information... Done
=== Command detached from window (Wed Apr 20 15:11:23 2022) ===
=== Command terminated with exit status 1 (Wed Apr 20 15:11:33 2022) ===
 
from 20.04 i did upgrade and this is the output:


Code:
Reading cache

Checking package manager
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Hit http://archive.ubuntu.com/ubuntu focal InRelease                                                  
Hit http://archive.ubuntu.com/ubuntu focal-updates InRelease                                          
Hit http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease                                      
Hit http://archive.ubuntu.com/ubuntu focal-security InRelease                                          
Hit http://packages.microsoft.com/repos/code stable InRelease                                          
Hit https://packages.microsoft.com/repos/vscode stable InRelease                                      
Fetched 0 B in 0s (0 B/s)                                                                              
Reading package lists... Done  
Building dependency tree        
Reading state information... Done

Restoring original system state

Aborting
Reading package lists... Done  
Building dependency tree        
Reading state information... Done
=== Command detached from window (Wed Apr 20 15:11:23 2022) ===
=== Command terminated with exit status 1 (Wed Apr 20 15:11:33 2022) ===

I created a 20.04 LXC container from scratch and successfully upgraded it to 22.04. I can't replicate your problem.
 
What are the package versions for your Proxmox node? Is it fully up to date?

not latest but relatively updated
Code:
proxmox-ve: 7.1-1 (running kernel: 5.13.19-2-pve)
pve-manager: 7.1-8 (running version: 7.1-8/5b267f33)
pve-kernel-helper: 7.1-6
pve-kernel-5.13: 7.1-5
pve-kernel-5.11: 7.0-10
pve-kernel-5.4: 6.4-6
pve-kernel-5.13.19-2-pve: 5.13.19-4
pve-kernel-5.11.22-7-pve: 5.11.22-12
pve-kernel-5.11.22-5-pve: 5.11.22-10
pve-kernel-5.4.140-1-pve: 5.4.140-1
pve-kernel-4.4.134-1-pve: 4.4.134-112
pve-kernel-4.4.35-1-pve: 4.4.35-77
ceph: 16.2.7
ceph-fuse: 16.2.7
corosync: 3.1.5-pve2
criu: 3.15-1+pve-1
glusterfs-client: 9.2-1
ifupdown: not correctly installed
ifupdown2: 3.1.0-1+pmx3
ksm-control-daemon: 1.4-1
libjs-extjs: 7.0.0-1
libknet1: 1.22-pve2
libproxmox-acme-perl: 1.4.0
libproxmox-backup-qemu0: 1.2.0-1
libpve-access-control: 7.1-5
libpve-apiclient-perl: 3.2-1
libpve-common-perl: 7.0-14
libpve-guest-common-perl: 4.0-3
libpve-http-server-perl: 4.0-4
libpve-storage-perl: 7.0-15
libqb0: 1.0.5-1
libspice-server1: 0.14.3-2.1
lvm2: 2.03.11-2.1
lxc-pve: 4.0.11-1
lxcfs: 4.0.11-pve1
novnc-pve: 1.2.0-3
proxmox-backup-client: 2.1.2-1
proxmox-backup-file-restore: 2.1.2-1
proxmox-mini-journalreader: 1.3-1
proxmox-widget-toolkit: 3.4-4
pve-cluster: 7.1-2
pve-container: 4.1-3
pve-docs: 7.1-2
pve-edk2-firmware: 3.20210831-2
pve-firewall: 4.2-5
pve-firmware: 3.3-3
pve-ha-manager: 3.3-1
pve-i18n: 2.6-2
pve-qemu-kvm: 6.1.0-3
pve-xtermjs: 4.12.0-1
qemu-server: 7.1-4
smartmontools: 7.2-pve2
spiceterm: 3.2-2
swtpm: 0.7.0~rc1+2
vncterm: 1.7-1
zfsutils-linux: 2.1.1-pve3
What is the output of "cat /usr/share/perl5/PVE/LXC/Setup/Ubuntu.pm"

Code:
package PVE::LXC::Setup::Ubuntu;

use strict;
use warnings;

use PVE::Tools;
use PVE::LXC;
use File::Path;

use PVE::LXC::Setup::Debian;

use base qw(PVE::LXC::Setup::Debian);

my $known_versions = {
    '22.04' => 1, # jammy
    '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
    '17.10' => 1, # artful
    '17.04' => 1, # zesty
    '16.10' => 1, # yakkety
    '16.04' => 1, # xenial LTS
    '15.10' => 1, # wily
    '15.04' => 1, # vivid
    '14.04' => 1, # trusty LTS
    '12.04' => 1, # precise LTS
};

sub new {
    my ($class, $conf, $rootdir) = @_;

    my $lsb_fn = "$rootdir/etc/lsb-release";
    my $lsbinfo = PVE::Tools::file_get_contents($lsb_fn);

    die "got unknown DISTRIB_ID\n" if $lsbinfo !~ m/^DISTRIB_ID=Ubuntu$/mi;

    my $version;
    if ($lsbinfo =~ m/^DISTRIB_RELEASE=(\d+\.\d+)$/mi) {
    $version = $1;
    }

    die "unable to read version info\n" if !defined($version);

    die "unsupported Ubuntu version '$version'\n"
    if !$known_versions->{$version};

    my $self = { conf => $conf, rootdir => $rootdir, version => $version };

    $conf->{ostype} = "ubuntu";

    return bless $self, $class;
}

sub template_fixup {
    my ($self, $conf) = @_;

    my $version = $self->{version};

    if ($version >= '17.10') {
    # enable systemd-networkd
    $self->ct_mkdir('/etc/systemd/system/multi-user.target.wants');
    $self->ct_mkdir('/etc/systemd/system/socket.target.wants');
    $self->ct_symlink('/lib/systemd/system/systemd-networkd.service',
              '/etc/systemd/system/multi-user.target.wants/systemd-networkd.service');
    $self->ct_symlink('/lib/systemd/system/systemd-networkd.socket',
              '/etc/systemd/system/socket.target.wants/systemd-networkd.socket');

    # unlink default netplan lxc config
    $self->ct_unlink('/etc/netplan/10-lxc.yaml');
    }

    if ($version eq '15.04' || $version eq '15.10' || $version eq '16.04') {
    # edit /etc/securetty (enable login on console)
    $self->setup_securetty($conf, qw(pts/0));
    }

    if ($version eq '12.04') {
    # suppress log level output for udev
    my $filename = '/etc/udev/udev.conf';
    my $data = $self->ct_file_get_contents($filename);
    $data =~ s/=\"err\"/=0/m;
    $self->ct_file_set_contents($filename, $data);
    }
}

sub setup_init {
    my ($self, $conf) = @_;

    my $version = $self->{version};

    if ($version >= '16.10') {
        $self->setup_container_getty_service($conf);
    }

    if ($version eq '12.04' || $version eq '14.04') {
    my $ttycount =  PVE::LXC::Config->get_tty_count($conf);
    for (my $i = 1; $i < 7; $i++) {
        my $filename = "/etc/init/tty$i.conf";
        if ($i <= $ttycount) {
        my $tty_conf = <<__EOD__;
# tty$i - getty
#
# This service maintains a getty on tty$i from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345] and (
            not-container or
            container CONTAINER=lxc or
            container CONTAINER=lxc-libvirt)

stop on runlevel [!2345]

respawn
exec /sbin/getty -8 38400 tty$i
__EOD__
                $self->ct_file_set_contents($filename, $tty_conf);
        } else {
        for (my $i = $ttycount + 1; $i < 7; $i++) {
            $self->ct_unlink($filename);
        }
        }
    }
    }
}

sub setup_network {
    my ($self, $conf) = @_;

    if ($self->{version} >= '17.10') {
    $self->setup_systemd_networkd($conf);
    } else {
    $self->SUPER::setup_network($conf);
    }
}

1;
 
Are you using do-release-upgrade or do-release-upgrade -d? 22.04 isn't released yet.
do-release-upgrade -d .


and do-release-upgrade -d -c returns:

Code:
Checking for a new Ubuntu release
New release '22.04' available.
Run 'do-release-upgrade' to upgrade to it.
 
How long does Proxmox usually take to list new major releases? I don't see a LXC template for 22.04 yet, but it only released yesterday.

I did manage to create 22.04 containers using the template from linuxcontainers.org but would prefer the official proxmox one.
 
  • Like
Reactions: UniverseX
How long does Proxmox usually take to list new major releases? I don't see a LXC template for 22.04 yet, but it only released yesterday.

I did manage to create 22.04 containers using the template from linuxcontainers.org but would prefer the official proxmox one.
Hi,

I know it's a little bit of topic, but how did you manage to do that?
 
I just downloaded the image.tar.xz file and then created a CT with it using the pct command, not much to it really. Seems to work fine, but I'd prefer to use an official proxmox template.
 
How long does Proxmox usually take to list new major releases? I don't see a LXC template for 22.04 yet, but it only released yesterday.

I did manage to create 22.04 containers using the template from linuxcontainers.org but would prefer the official proxmox one.
according to history versions http://download.proxmox.com/images/system/ it can take around two weeks.
 
A 22.04 Jammy CT Template is available as of now. You can find it in the CT template index, which gets refreshed automatically once daily, but you can also refresh the index manually via pveam update.
 
A 22.04 Jammy CT Template is available as of now. To find it in the CT template index, which gets refreshed automatically once daily, but you can also refresh the index manually via pveam update.
works.
i ll close the question.
thanks
 
A 22.04 Jammy CT Template is available as of now. You can find it in the CT template index, which gets refreshed automatically once daily, but you can also refresh the index manually via pveam update.

Can't see the template even after running pveam update
 
Yes, it's already released and available here (just re-checked), PVE 7.x is the stable release after all..

Bash:
pveam available --section system | grep ubuntu
system          ubuntu-18.04-standard_18.04.1-1_amd64.tar.gz
system          ubuntu-20.04-standard_20.04-1_amd64.tar.gz
system          ubuntu-21.10-standard_21.10-1_amd64.tar.zst
system          ubuntu-22.04-standard_22.04-1_amd64.tar.zst
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!