Following the instructions here: MicroK8s - MicroK8s in LXD . My Ubuntu desktop sessions logs off and when I log back in session has restarted. The profile from that page is reproduced below check to see if some configuration is problematic there.
### This is a YAML representation of the profile.
### Any line starting with a '# will be ignored.
###
### A profile consists of a set of configuration items followed by a set of
### devices.
###
### An example would look like:
### name: onenic
### config:
### raw.lxc: lxc.aa_profile=unconfined
### devices:
### eth0:
### nictype: bridged
### parent: lxdbr0
### type: nic
###
### Note that the name is shown but cannot be changed
config:
boot.autostart: "true"
linux.kernel_modules: ip_vs,ip_vs_rr,ip_vs_wrr,ip_vs_sh,ip_tables,ip6_tables,netlink_diag,nf_nat,overlay,br_netfilter
raw.lxc: |
lxc.apparmor.profile=unconfined
lxc.mount.auto=proc:rw sys:rw cgroup:rw
lxc.cgroup.devices.allow=a
lxc.cap.drop=
security.nesting: "true"
security.privileged: "true"
description: ""
devices:
aadisable:
path: /sys/module/nf_conntrack/parameters/hashsize
source: /sys/module/nf_conntrack/parameters/hashsize
type: disk
aadisable1:
path: /sys/module/apparmor/parameters/enabled
source: /dev/null
type: disk
aadisable2:
path: /dev/kmsg
source: /dev/kmsg
type: unix-char
aadisable3:
path: /sys/fs/bpf
source: /sys/fs/bpf
type: disk
aadisable4:
path: /proc/sys/net/netfilter/nf_conntrack_max
source: /proc/sys/net/netfilter/nf_conntrack_max
type: disk
name: microk8s
used_by:
- /1.0/instances/microk8s-worker0
- /1.0/instances/microk8s-worker1
I have an other instance that doesn’t use this profile and it doesn’t suffer this issue when stopping and starting it.
It’s not really surprising. The combination of security.privileged=true and your raw.lxc allows for very terrible things to be possible by the container.
That container can change apparmor profiles, load kernel modules and perform a lot of other actions which could seriously upset your host and cause your desktop session to restart.
I also encountered this using version 5.21.2 LTS (on a container without raw.lxc). If I set security.privileged=false, the host session logout does not happen, which makes me wonder why it happens when security.privileged=true?
Then, it would be great to make a list of steps to reproduce the host session logout.
When you enable security.privileged=true, then your container can harm the host. It’s interesting to get reproducible steps to figure out what’s going on.
I’ve tested with incus 6.0.0 stock package on host ubuntu 24.04, and can confirm that when following the steps below to install microk8s on an incus container also causes a session logout when restarting the container: https://microk8s.io/docs/install-lxd
(Replace lxd with incus in the instructions above)
This profile is a train wreck; an experiment on how to rollback all the effort in isolating processes from an isolation system. I wouldn’t touch this.
If you really need to run microk8s, launch an Incus VM and add a dedicated network device.