User Tools

Site Tools


linux:virtualization:lxc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:virtualization:lxc [2019/02/10 15:58]
tkilla [Bugfixes]
linux:virtualization:lxc [2022/01/13 23:08] (current)
tkilla [Unprivileged containers]
Line 344: Line 344:
 http://wiki.fr33.info/doku.php/linux/virtualization/lxc?&#unprivileged_containers http://wiki.fr33.info/doku.php/linux/virtualization/lxc?&#unprivileged_containers
  
-  lxc-create -n debian8  -B btrfs -t debian -- -r jessie+FIX:  original keyserver is broken! add: --keyserver hkp://keyserver.ubuntu.com 
 + 
 + 
 +  lxc-create -n debian8  -B btrfs -t debian -- -r jessie --keyserver hkp://keyserver.ubuntu.com
  
 or or
  
-  lxc-create -n websrv -t debian-wheezy  -B btrfs+  lxc-create -n websrv -t debian-wheezy  -B btrfs --keyserver hkp://keyserver.ubuntu.com
  
 Start / Stop VS: Start / Stop VS:
Line 356: Line 359:
 Enter VS: Enter VS:
   lxc-console -n websrv   lxc-console -n websrv
 +
 +
 +In Buster, use the lxc-download script:
 +
 +  /usr/share/lxc/templates/lxc-download --list --no-validate| grep debian | grep amd64
 +  lxc-create -t /usr/share/lxc/templates/lxc-download -n <NAME> --  --no-validate -d debian -r buster -a amd64
  
  
Line 366: Line 375:
   lxc-clone --backingstore btrfs --orig vs1 --new vs2 --snapshot   lxc-clone --backingstore btrfs --orig vs1 --new vs2 --snapshot
  
 +\\
 +===== Mount external Dirs in Container =====
 +
 +The recommended way is to add the mountpoint with a relative path in the VS config:
 +
 +  lxc.mount.entry=/home/mountme home none bind,optional,relative,create=dir
 +
 +
 +Under some cicumstances it does not work (in unprivileged containers), but this works:
 +
 +  lxc.mount.entry = /home/test /home/vservers/stretch/rootfs/home/test none bind 0 0
 +
 +Also check Permissions and Ownership. chown to the root ID inside the container.
  
 \\ \\
Line 375: Line 397:
  
   lxc-create -B btrfs -n mycontainer -t ubuntu   lxc-create -B btrfs -n mycontainer -t ubuntu
 +
 +
  
  
Line 437: Line 461:
   lxc.id_map = g 0 100000 65536   lxc.id_map = g 0 100000 65536
  
 +in buster it's called idmap:
 +  lxc.idmap = u 0 100000 65536
 +  lxc.idmap = g 0 100000 65536
  
 **shift uuids to another span:** **shift uuids to another span:**
Line 448: Line 475:
 create container - use download method for unprivileged. jessie is not available, so you can upgrade wheezy and fix systemd error :( create container - use download method for unprivileged. jessie is not available, so you can upgrade wheezy and fix systemd error :(
  
-  lxc-create -B btrfs -t download -n websrv   +FIX for download: Original keyserver is broken, add --keyserver hkp://keyserver.ubuntu.com 
 + 
 +  lxc-create -B btrfs -t download -n websrv --keyserver hkp://keyserver.ubuntu.com
  
   # error no jessie:    # error no jessie: 
-  lxc-create -B btrfs -n websrv -t download -- -d debian -r jessie -a amd64   +  lxc-create -B btrfs -n websrv -t download -- -d debian -r jessie -a amd64 --keyserver hkp://keyserver.ubuntu.com
  
   # error not working with unprivileged   # error not working with unprivileged
-  LANG=C SUITE=jessie MIRROR=http://httpredir.debian.org/debian lxc-create -n websrv -B btrfs -t debian+  LANG=C SUITE=jessie MIRROR=http://httpredir.debian.org/debian lxc-create -n websrv -B btrfs -t debian 
  
  
Line 540: Line 569:
 12 is a systemd hierarchy - if you remove systemd and switch to sysvinit-core, this might be leftover. 12 is a systemd hierarchy - if you remove systemd and switch to sysvinit-core, this might be leftover.
  
-FIX:+FIXME:
  
 check all of systemd is gone (uninstall ii): check all of systemd is gone (uninstall ii):
   dpkg -l *systemd*   dpkg -l *systemd*
 +  apt remove --purge *systemd*    # without systemd apt/preferences.d/ must not be set
      
 /etc/pam.d/common-session - unset this line: /etc/pam.d/common-session - unset this line:
Line 549: Line 579:
   session     optional    pam_cgfs.so -c freezer,memory,name=systemd   session     optional    pam_cgfs.so -c freezer,memory,name=systemd
  
 +Check, if 12 is still active:
 +
 +  cat /proc/self/cgroup
 +
 +WORKAROUND:
 +mcedit /etc/lxc/lxc.conf and remove 
 +  lxc.cgroup.use = @all
  
-this is helpful: https://github.com/lxc/lxc/issues/1279 +this is helpful: https://github.com/lxc/lxc/issues/1279 
-this is not: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769494+this is not: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769494
  
 \\ \\
linux/virtualization/lxc.1549810706.txt.gz · Last modified: 2019/02/10 15:58 by tkilla