[TUTORIAL] How to upgrade LXC containers from buster to bullseye

Taylan

Active Member
Oct 19, 2020
94
33
38
55
Solution:
Same upgrade process applies here as well.
- Backup
- Test if backup works
- adjust the amount of memory of the containers (I tried with 1024MB)
- update the apt sources
Code:
deb http://ftp.debian.org/debian bullseye main contrib

deb http://ftp.debian.org/debian bullseye-updates main contrib

deb http://security.debian.org/debian-security bullseye-security main contrib
- run 'apt update && apt dist-upgrade -y; apt autoremove -y'
- restart
- you can return to the original amount of memory afterwards.


Original post:

Hello everyone,

first of all, thanks for the all documentation, how-to's and support regarding upgrading pve from 6.4 to 7.0.
I didn't have any problems, other than three tiny issues:
- The apt sources needed to be cleaned up.
- Although I have a UEFI boot, the upgrade process tried and failed to install GRUB -> I just skipped it
- All privileged containers who had device passthrough needed to get adjusted for cgroup2 -> just change cgroup to cgroup2 in the configs:
Code:
...
lxc.cgroup2.devices.allow: ...
...

Now to my question:
Is there a guideline about upgrading LXC containers to bullseye as well?

I searched the forum and find one discussion about how to find the bullseye images, but it didn't answer the upgrade path.

I tried and failed to upgrade one container with adding the bullseye repositories and doing apt update; apt dist-upgrade. It failed reporting about dpkg select alternatives

Can somebody point me to a direction?

Thanks...
 
Last edited:
  • Like
Reactions: teissler and User01
Is there a guideline about upgrading LXC containers to bullseye as well?
Usually just upgrading with `apt update; apt full-upgrade` should work

It failed reporting about dpkg select alternatives
could you paste the output of the upgrade and the relevant logs?
 
  • Like
Reactions: Taylan
Sure, here is a simple container with grafana installation:
Code:
arch: amd64
cores: 1
hostname: Grafana
memory: 128
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=AE:D7:85:02:0C:0F,ip=dhcp,type=veth
onboot: 1
ostype: debian
rootfs: Containers:subvol-107-disk-1,size=4G
swap: 128
unprivileged: 1

Here is the /etc/apt/sources.list
Code:
deb http://ftp.debian.org/debian bullseye main contrib

deb http://ftp.debian.org/debian bullseye-updates main contrib

deb http://security.debian.org/debian-security bullseye-security main contrib

And the output of relevant part of "apt update -y && apt dist-upgrade -y":
Code:
apt-listchanges: Mailing root: apt-listchanges: news for Grafana
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_US.UTF-8",
    LC_ALL = "en_US.UTF-8",
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Extracting templates from packages: 100%
Preconfiguring packages ...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_US.UTF-8",
    LC_ALL = "en_US.UTF-8",
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_US.UTF-8",
    LC_ALL = "en_US.UTF-8",
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
E: Sub-process dpkg --set-selections received signal 9.
E: Couldn't record the approved state changes as dpkg selection states


I think it has to do with apparmor preventing setting some settings, because I get a warning when I attach to the container:
Code:
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
If I try to set the locale with following:
Code:
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales # choosing the en_US.UTF-8

It fails with:
Code:
Generating locales (this might take a while)...
  en_US.UTF-8...Killed
 done
Generation complete.
*** update-locale: Error: invalid locale settings:  LANG=en_US.UTF-8

I tried to disable apparmor with
Code:
lxc.apparmor.profile = unconfined
and restarting the container, but it didn't change anything with the behaviour.
 
Hello, i did the same but with default template of debian buster works well,
but with the bullseye full-upgrade, i have some slow situation
- login into ssh avec correct credidential (4-5 secs to get the shell)
- installing package:download fast and the part of installing take a while before installing rapidely.
i found with apparmor perhaps this message :
Aug 4 19:40:00 doublehype kernel: audit: type=1400 audit(1628098800.425:113): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxc-502_</var/lib/lxc>" name="/run/systemd/unit-root/proc/" pid=61258 comm="(d-logind)" fstype="proc" srcname="proc" flags="rw, nosuid, nodev, noexec" Aug 4 19:40:00 doublehype kernel: audit: type=1400 audit(1628098800.437:114): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxc-502_</var/lib/lxc>" name="/run/systemd/unit-root/proc/" pid=61262 comm="(d-logind)" fstype="proc" srcname="proc" flags="rw, nosuid, nodev, noexec"

any suggestion?
thanks in advance,

Flavinux
 
Hello, i did the same but with default template of debian buster works well,
but with the bullseye full-upgrade, i have some slow situation
- login into ssh avec correct credidential (4-5 secs to get the shell)
- installing package:download fast and the part of installing take a while before installing rapidely.
i found with apparmor perhaps this message :
Aug 4 19:40:00 doublehype kernel: audit: type=1400 audit(1628098800.425:113): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxc-502_</var/lib/lxc>" name="/run/systemd/unit-root/proc/" pid=61258 comm="(d-logind)" fstype="proc" srcname="proc" flags="rw, nosuid, nodev, noexec" Aug 4 19:40:00 doublehype kernel: audit: type=1400 audit(1628098800.437:114): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxc-502_</var/lib/lxc>" name="/run/systemd/unit-root/proc/" pid=61262 comm="(d-logind)" fstype="proc" srcname="proc" flags="rw, nosuid, nodev, noexec"

any suggestion?
thanks in advance,

Flavinux
I had same issue and solved it by enabling "keyctl" and "nestig". It's a temporary solution...