I’ve looked through several similar issues and have not managed to find a solution.
Steps I took so far:
sudo usermod --add-subuids 100000-165536 s
sudo usermod --add-subgids 100000-165536 s
echo 's veth lxcbr0 10' | sudo tee -a /etc/lxc/lxc-usernet
Created ~/.config/lxc/default.conf
:
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx
lxc.idmap = u 0 100000 1000
lxc.idmap = g 0 100000 1000
lxc.idmap = u 1000 1000 1
lxc.idmap = g 1000 1000 1
lxc.idmap = u 1001 101001 64535
lxc.idmap = g 1001 101001 64535
# GUI
lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
lxc.mount.entry = /dev/snd dev/snd none bind,optional,create=dir
lxc.mount.entry = /tmp/.X11-unix tmp/.X11-unix none bind,optional,create=dir
lxc.mount.entry = /dev/video0 dev/video0 none bind,optional,create=file
lxc.mount.entry = /home/s/Hacking home/ubuntu/hacking none bind,create=dir
lxc.mount.entry = /home/s/Desktop home/ubuntu/desktop none bind,create=dir
Added s:1000:1
to /etc/subuid and /etc/subgid.
Then running:
lxc-create -t download -n mygui -- -d debian -r bookworm -a amd64
systemd-run --unit=myshell --user --scope -p "Delegate=yes" lxc-start -n mygui
After attaching, it seems the network is unreachable.
dnsmasq is running on the host. ip r
returns nothing in the container.