Difference between revisions of "Installation on Debian"

From Linux-VServer

Jump to: navigation, search
(Buster)
 
(42 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''Note:''' Debian 6.0 is the final version to include precompiled Linux-Vserver kernels. In newer versions (including Debian Testing), you'll have to compile the kernel yourself or [http://linux-vserver.org/Frequently_Asked_Questions#Were_can_I_get_newer_versions_of_VServer_as_ready_made_packages_for_Debian.3F use a pre-packaged kernel]. [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=574529]
+
Debian 6.0 'Squeeze' was the final version to include precompiled Linux-Vserver kernels [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=574529]. In newer versions (including Debian Testing), you'll have to compile the kernel yourself or use a pre-packaged kernel. Information on alternative Debian repositories with more functional packages is [[Frequently_Asked_Questions#Were_can_I_get_newer_versions_of_VServer_as_ready_made_packages_for_Debian.3F | contained in this section of the FAQ]]. If you need to compile your own kernel, you need to apply the vserver-version.patch. See the [http://linux-vserver.org/Welcome_to_Linux-VServer.org]
  
If you need to compile your own kernel, you need to apply the vserver-version.patch. [http://www.kwu.hu/vserver.txt Details at 2007/May/04]
+
Here is a list of kernels and util-vserver in Debian's own repository and the actively maintained repo.psand.net repository:
  
In lenny and etch the tools are for the 2.2 version of vservers, you can find on beng repository packages for the 2.3 version of util-vserver until it is integrated in debian. See
 
* [[util-vserver:Devdebianpackage]] - Info about debian v2.3 package from the community
 
* explanation on how to use this repository from: http://repo.psand.net/info  How to use the Debian Repository
 
  
 +
{|class="wikitablenowrap"
 +
!Debian release
 +
!repo.psand.net Kernel Version
 +
!repo.psand.net Util-VServer Version
 +
!Debian Kernel version
 +
!Debian Util-VServer version
 +
|-
 +
| Debian 10.0 Buster
 +
| 4.4 4.9
 +
| 0.30.216-pre3131
 +
| x
 +
| 0.30.216-pre3120-1.4
 +
|-
 +
| Debian 9.0 Stretch
 +
| 3.18 4.1
 +
| 0.30.216-pre3126
 +
| x
 +
| 0.30.216-pre3120-1.4
 +
|-
 +
| Debian 8.0 Jessie
 +
| 3.14 3.18
 +
| 0.30.216-pre3126
 +
| x
 +
| 0.30.216-pre3054-1
 +
|-
 +
| Debian 7.0 Wheezy
 +
| 3.2 3.4 3.10 3.14 3.18
 +
| 0.30.216-pre3120
 +
| x
 +
| x
 +
|-
 +
| Debian 6.0 Squeeze
 +
| 2.6.36 2.6.38 3.0 3.2
 +
| 0.30.216-pre3038
 +
| 2.6.32
 +
| 0.30.216-pre2864
 +
|-
 +
| Debian 5.0 Lenny
 +
| 2.6.36
 +
| 0.30.216-pre2925
 +
| 2.6.26+17
 +
| 2.3.0.35
 +
|-
 +
| Debian 4.0 Etch
 +
| x
 +
| x
 +
| 2.6.18+6
 +
| 2.0.2.2-rc9
 +
|-
 +
|}
  
  
Line 18: Line 65:
 
You may need to satisfy some dependencies for this to work.
 
You may need to satisfy some dependencies for this to work.
  
== Versions ==
 
  
Debian already contains vservers kernels, so no manual patching and compiling is needed.  
+
== Distro Specific Notes ==
 +
 
 +
=== Buster ===
 +
 
 +
The buster release is really using systemd so to create a guest use something like
 +
 
 +
<pre>
 +
vserver buildbuster64 build  -n buildbuster64 -m debootstrap  --i-know-its-there --context <number> --hostname <whetever.net> -- -d buster -- --arch=amd64 <br/>
 +
--exclude=systemd-sysv,systemd,libsystemd0  <br/>
 +
--include=cron,sysvinit-core,sysvinit-utils;<br/>
 +
</pre>
 +
 
 +
Also the utils could have issue starting, if you have this issue starting the guest you can apply this patch to util vserver: <br/>
 +
 
 +
<pre>
 +
Index: util-vserver-0.30.216-pre3131/scripts/vserver.functions
 +
===================================================================
 +
--- util-vserver-0.30.216-pre3131.orig/scripts/vserver.functions
 +
+++ util-vserver-0.30.216-pre3131/scripts/vserver.functions
 +
@@ -324,7 +324,7 @@ function _generateInitOptions
 +
    test -n "$RUNLEVEL_START" || RUNLEVEL_START=3
 +
    test -n "$RUNLEVEL_STOP"  || RUNLEVEL_STOP=6
 +
 +
-     for i in /etc/init.d/rc /etc/rc.d/rc; do
 +
+     for i in /etc/init.d/rc /etc/rc.d/rc /lib/init/rc /usr/lib/init/rc; do
 +
test -x "$vdir/vdir/$i" || continue
 +
INITCMD_START=( "$i" "$RUNLEVEL_START" )
 +
INITCMD_STOP=(  "$i" "$RUNLEVEL_STOP"  )
 +
</pre>
 +
 
 +
=== Stretch ===
 +
 
 +
The situation for guests and host is identical to that of Jessie.
 +
 
 +
One enhancement is that a version of util-vserver featuring SystemD compatibility (solving the problem with Jessie listed below), is now available at [http://repo.psand.net/info/ repo.psand.net]. The patch set was put up for review in August 2016 by AlexanderS. Please test this and send any results to the Linux-Vserver mailing list. A new version of util-vserver has been compiled for repo.psand.net featuring the AlexanderS patch set.
 +
 
 +
The packages have the same names as the traditional package but have -systemd appended to them thus:
 +
 
 +
* util-vserver-systemd - utilities for managing Linux-VServer guests
 +
* util-vserver-systemd-build - tools which can be used to build vservers
 +
* util-vserver-systemd-core - core utilities of util-vserver-systemd
 +
* util-vserver-systemd-legacy - legacy scripts for util-vserver-systemd
 +
* util-vserver-systemd-python - python-bindings for util-vserver-systemd
 +
* util-vserver-systemd-sysv - initscripts for util-vserver-systemd
 +
 
 +
The mainline util-vserver packages are still available in Stretch too.
 +
 
 +
=== Jessie ===
 +
 
 +
==== Systemd on guests ====
 +
 
 +
For building new guests, or upgrading old ones, systemd needs to be prevented from installing.
 +
 
 +
* To make sure systemd is not present after upgrade see [http://without-systemd.org/wiki/index.php/How_to_remove_systemd_from_a_Debian_jessie/sid_installation]
 +
* To install a guest without systemd present a working example is:
 +
 
 +
vserver jessie64 build  -n jessie64 -m debootstrap --i-know-its-there \
 +
--context 44000 --hostname jessie64.whatever.com -- \
 +
-d jessie -- --arch=amd64 --include=sysvinit-core,sysvinit,sysvinit-utils \
 +
--exclude=systemd;
 +
 
 +
==== Systemd on hosts ====
 +
 
 +
Systemd must also be removed from hosts. With it present the host will lose it's /proc /sys and /dev on host starts or stops. See advice on how to remove it at [http://without-systemd.org/wiki/index.php/How_to_remove_systemd_from_a_Debian_jessie/sid_installation].
 +
 
 +
==== Getting Jessie Guests to Shutdown Properly ====
 +
 
 +
Disable "/etc/init.d/sendsigs" completely, so it doesn't kill off any processes too early (vserver stop will do that anyway if it hits the timeout).
 +
 
 +
  rm /etc/init.d/sendsigs
 +
  update-rc.d sendsigs remove
 +
 
 +
I also removed the "halt" and "reboot" scripts, though that's probably not necessary.
 +
 
 +
Add kill script links in /etc/rc6.d  for "cron", "dbus" and "ssh". These don't exist because their init scripts have a blank "Default-Stop" header. The simplest way to remedy this is to add override headers in /etc/insserv/overrides and force insserv to rebuild the links; this is a bit convoluted but is better than modifying the init scripts in case an upgraded package has newer ones, which won't be installed if the originals have been modified.
 +
 
 +
  for s in cron dbus ssh; do
 +
    sed -rn -e 's/^(# Default-Stop:).*$/\1 0 1 6/' -e '/^### BEGIN INIT INFO/,/^### END INIT INFO/p' /etc/init.d/$s > /etc/insserv/overrides/$s
 +
  done
 +
  /sbin/insserv -v -d
 +
 
 +
 
  
{|class="wikitablenowrap"
 
!Debian release
 
!Kernel version
 
!VServer version
 
|-
 
| Debian 6.0 Squeeze
 
| 2.6.32
 
| 2.3.0.36.29.6
 
|-
 
| Lenny
 
| 2.6.26+17
 
| 2.3.0.35
 
|-
 
| Etch
 
| 2.6.18+6
 
| 2.0.2.2-rc9
 
  
|-
 
|}
 
  
The Vserver versions given above are not completely pure, they have additional patches to fix various issues.
+
=== Wheezy ===
  
Information on alternative Debian repositories with more functional packages is [[Frequently_Asked_Questions#Were_can_I_get_newer_versions_of_VServer_as_ready_made_packages_for_Debian.3F | contained in this section of the FAQ]].
 
  
= Distro Specific Notes =
 
  
=== Issues with Wheezy's 3.2.55 Kernel and Util-vserver ===
+
There are some issues with Wheezy's 3.2.55 Kernel and Util-vserver.
  
 
* Util-vserver 0.30.216-pre3060-1 from the APT repository (repo.psand.net) moves vshelper to a new location.  If you attempt to manage guests (restart, start, etc) without restarting the util-vserver service, vserver will display "vshelper functionality" errors.  The util-vserver service will notify the kernel of the new location when the service is restarted.  However, restarting util-vserver will also restart all of your guests.  You can immediately notify the kernel of the new vshelper location (without restarting util-vserver or your guests) by running the following command:
 
* Util-vserver 0.30.216-pre3060-1 from the APT repository (repo.psand.net) moves vshelper to a new location.  If you attempt to manage guests (restart, start, etc) without restarting the util-vserver service, vserver will display "vshelper functionality" errors.  The util-vserver service will notify the kernel of the new location when the service is restarted.  However, restarting util-vserver will also restart all of your guests.  You can immediately notify the kernel of the new vshelper location (without restarting util-vserver or your guests) by running the following command:
 
  echo /usr/lib/x86_64-linux-gnu/util-vserver/vshelper >| /proc/sys/kernel/vshelper
 
  echo /usr/lib/x86_64-linux-gnu/util-vserver/vshelper >| /proc/sys/kernel/vshelper
  
=== Issues with Squeeze's 2.6.32 Kernel and Util-vserver ===
+
=== Squeeze ===
 +
 
 +
There is one small issues with Squeeze's own Util-vserver:
  
 
* Util-vserver shipping with debian, does not have the symbolic link for squeeze, fixed by  
 
* Util-vserver shipping with debian, does not have the symbolic link for squeeze, fixed by  
 
   ln -s debian /usr/lib/util-vserver/distributions/squeeze
 
   ln -s debian /usr/lib/util-vserver/distributions/squeeze
  
=== Issues with Lenny's 2.6.26 Kernel and Util-vserver ===
+
=== Lenny ===
 +
 
 +
There are many issues with Lenny's own 2.6.26 Kernel and Util-vserver.
 +
 
 +
In lenny the tools are for the 2.2 version of vservers, you can find on beng repository packages for the 2.3 version of util-vserver until it is integrated in debian. See
 +
* [[util-vserver:Devdebianpackage]] - Info about debian v2.3 package from the community
 +
* explanation on how to use this repository from: http://repo.psand.net/info  How to use the Debian Repository
  
 
==== Hard CPU scheduling ====
 
==== Hard CPU scheduling ====
Line 117: Line 232:
  
  
=== References ===
+
-----------
 +
 
 +
= References =
 
* Linux-VServer HOWTO by Daniel15: http://howtoforge.com/linux_vserver_debian_etch
 
* Linux-VServer HOWTO by Daniel15: http://howtoforge.com/linux_vserver_debian_etch
  
 
[[Category:Installation]]
 
[[Category:Installation]]

Latest revision as of 08:48, 7 September 2020

Debian 6.0 'Squeeze' was the final version to include precompiled Linux-Vserver kernels [1]. In newer versions (including Debian Testing), you'll have to compile the kernel yourself or use a pre-packaged kernel. Information on alternative Debian repositories with more functional packages is contained in this section of the FAQ. If you need to compile your own kernel, you need to apply the vserver-version.patch. See the [2]

Here is a list of kernels and util-vserver in Debian's own repository and the actively maintained repo.psand.net repository:


Debian release repo.psand.net Kernel Version repo.psand.net Util-VServer Version Debian Kernel version Debian Util-VServer version
Debian 10.0 Buster 4.4 4.9 0.30.216-pre3131 x 0.30.216-pre3120-1.4
Debian 9.0 Stretch 3.18 4.1 0.30.216-pre3126 x 0.30.216-pre3120-1.4
Debian 8.0 Jessie 3.14 3.18 0.30.216-pre3126 x 0.30.216-pre3054-1
Debian 7.0 Wheezy 3.2 3.4 3.10 3.14 3.18 0.30.216-pre3120 x x
Debian 6.0 Squeeze 2.6.36 2.6.38 3.0 3.2 0.30.216-pre3038 2.6.32 0.30.216-pre2864
Debian 5.0 Lenny 2.6.36 0.30.216-pre2925 2.6.26+17 2.3.0.35
Debian 4.0 Etch x x 2.6.18+6 2.0.2.2-rc9


Contents

[edit] Building util-vserver Packages

Download the source, unpack it, enter the directory you just unpacked and run:

dpkg-buildpackage -rfakeroot -us -uc

You may need to satisfy some dependencies for this to work.


[edit] Distro Specific Notes

[edit] Buster

The buster release is really using systemd so to create a guest use something like

vserver buildbuster64 build   -n buildbuster64 -m debootstrap  --i-know-its-there --context <number> --hostname <whetever.net> -- -d buster -- --arch=amd64 <br/>
--exclude=systemd-sysv,systemd,libsystemd0   <br/>
--include=cron,sysvinit-core,sysvinit-utils;<br/>

Also the utils could have issue starting, if you have this issue starting the guest you can apply this patch to util vserver:

Index: util-vserver-0.30.216-pre3131/scripts/vserver.functions
===================================================================
--- util-vserver-0.30.216-pre3131.orig/scripts/vserver.functions
+++ util-vserver-0.30.216-pre3131/scripts/vserver.functions
@@ -324,7 +324,7 @@ function _generateInitOptions
 	    test -n "$RUNLEVEL_START" || RUNLEVEL_START=3
 	    test -n "$RUNLEVEL_STOP"  || RUNLEVEL_STOP=6
 
-	    for i in /etc/init.d/rc /etc/rc.d/rc; do
+	    for i in /etc/init.d/rc /etc/rc.d/rc /lib/init/rc /usr/lib/init/rc; do
 		test -x "$vdir/vdir/$i" || continue
 		INITCMD_START=( "$i" "$RUNLEVEL_START" )
 		INITCMD_STOP=(  "$i" "$RUNLEVEL_STOP"  )

[edit] Stretch

The situation for guests and host is identical to that of Jessie.

One enhancement is that a version of util-vserver featuring SystemD compatibility (solving the problem with Jessie listed below), is now available at repo.psand.net. The patch set was put up for review in August 2016 by AlexanderS. Please test this and send any results to the Linux-Vserver mailing list. A new version of util-vserver has been compiled for repo.psand.net featuring the AlexanderS patch set.

The packages have the same names as the traditional package but have -systemd appended to them thus:

  • util-vserver-systemd - utilities for managing Linux-VServer guests
  • util-vserver-systemd-build - tools which can be used to build vservers
  • util-vserver-systemd-core - core utilities of util-vserver-systemd
  • util-vserver-systemd-legacy - legacy scripts for util-vserver-systemd
  • util-vserver-systemd-python - python-bindings for util-vserver-systemd
  • util-vserver-systemd-sysv - initscripts for util-vserver-systemd

The mainline util-vserver packages are still available in Stretch too.

[edit] Jessie

[edit] Systemd on guests

For building new guests, or upgrading old ones, systemd needs to be prevented from installing.

  • To make sure systemd is not present after upgrade see [3]
  • To install a guest without systemd present a working example is:
vserver jessie64 build   -n jessie64 -m debootstrap --i-know-its-there \
--context 44000 --hostname jessie64.whatever.com -- \
-d jessie -- --arch=amd64 --include=sysvinit-core,sysvinit,sysvinit-utils \
--exclude=systemd;

[edit] Systemd on hosts

Systemd must also be removed from hosts. With it present the host will lose it's /proc /sys and /dev on host starts or stops. See advice on how to remove it at [4].

[edit] Getting Jessie Guests to Shutdown Properly

Disable "/etc/init.d/sendsigs" completely, so it doesn't kill off any processes too early (vserver stop will do that anyway if it hits the timeout).

 rm /etc/init.d/sendsigs
 update-rc.d sendsigs remove

I also removed the "halt" and "reboot" scripts, though that's probably not necessary.

Add kill script links in /etc/rc6.d for "cron", "dbus" and "ssh". These don't exist because their init scripts have a blank "Default-Stop" header. The simplest way to remedy this is to add override headers in /etc/insserv/overrides and force insserv to rebuild the links; this is a bit convoluted but is better than modifying the init scripts in case an upgraded package has newer ones, which won't be installed if the originals have been modified.

 for s in cron dbus ssh; do
   sed -rn -e 's/^(# Default-Stop:).*$/\1 0 1 6/' -e '/^### BEGIN INIT INFO/,/^### END INIT INFO/p' /etc/init.d/$s > /etc/insserv/overrides/$s
 done
 /sbin/insserv -v -d



[edit] Wheezy

There are some issues with Wheezy's 3.2.55 Kernel and Util-vserver.

  • Util-vserver 0.30.216-pre3060-1 from the APT repository (repo.psand.net) moves vshelper to a new location. If you attempt to manage guests (restart, start, etc) without restarting the util-vserver service, vserver will display "vshelper functionality" errors. The util-vserver service will notify the kernel of the new location when the service is restarted. However, restarting util-vserver will also restart all of your guests. You can immediately notify the kernel of the new vshelper location (without restarting util-vserver or your guests) by running the following command:
echo /usr/lib/x86_64-linux-gnu/util-vserver/vshelper >| /proc/sys/kernel/vshelper

[edit] Squeeze

There is one small issues with Squeeze's own Util-vserver:

  • Util-vserver shipping with debian, does not have the symbolic link for squeeze, fixed by
 ln -s debian /usr/lib/util-vserver/distributions/squeeze

[edit] Lenny

There are many issues with Lenny's own 2.6.26 Kernel and Util-vserver.

In lenny the tools are for the 2.2 version of vservers, you can find on beng repository packages for the 2.3 version of util-vserver until it is integrated in debian. See

[edit] Hard CPU scheduling

This will not work in the Debian 'Lenny' Kernel, the patch used simply does not contain any of this functionality.

[edit] Problems due to Xattrs

There are two sets of issues within the Lenny kernel caused by the change in value of the Xattrs (extended attributes) applied to file in Vserver setups. The patch used in Debian Lenny uses Xattr flags which are set in positions which differ from the flags set by Debian kernels as well as most of the mainline Vserver patches. This result is that Xattrs of files in a non lenny system appear to have completely different flags in Lenny and vice versa. Since these flags are crucial to vserver hashification and chroot security, they can have devastating effects on Vserver guests and on host system security. If you have recently moved to or away from the stock Lenny Vserver kernel, have look at the symptoms below to see if any match your experiences, and apply the fixes/use another kernel as you see fit.

As of writing these issue has not been corrected within the Debian archive. These fixes must be applied whenever moving vserver guest from or to the Debian 'Lenny's vserver kernel. For more details and a more concise explanation see Bertls IRC explanation .

[edit] Chroot Security Problems

Linux-Vserver uses file Xattrs to protect guest superusers from being able to view files above their root, preventing access to host file. This creates issues for anyone who:

  • has created a guest with a Debian 2.6.26-*-vserver kernel and wishes to use it with another kernel.
  • has created a guest with a different kernel and wishes to use it on a Debian 2.6.26-*-vserver kernel based host.

In effect, the barrier normally in place for guest servers is not recognised by the kernel (the chroot problem) in the situation above and/or immutable links will not function correctly (the unification problem)failing to break when overwritten) in a unified guest setup. Symptoms suffered may include:

  • the possibility of vserver guest processes escaping their chroots and accessing other parts of the filesystem
  • guest not starting

To fix the barrier flags for a current kernel, see these instructions. Note that on some setups a barrier flags will appear on all directories under the guest hierarchy, and need to be unset in order to allow the servers to run. Use showattr to reveal the state of play for your guests and fix appropriately.

[edit] Unification Problems

There is a discrepancy between the immutable-unlink flag used for file unification, the process used in vhashify. This creates considerable issues for anyone who:

  • has unified guests with a Debian 2.6.26-*-vserver kernel and wishes to use them with another kernel.
  • has unified guests with a different kernel and wishes to then it on a Debian 2.6.26-*-vserver kernel based host.

Symptoms suffered may include:

  • file that cannot be deleted
  • any process involving the writing of files in guests not working
  • files not being unlinked on write

To fix the problem each file must be unlinked then the unification re-applied, or one could try this script submitted to bugs.debian.org.


[edit] /proc/mounts issue

The vserver's /proc/mounts let appear the vserver path on the host. lsof (for example) is able to print it.

[edit] "Ghosts" guests

[edit] Issue

Sometimes a guests loose it's name in vserver-stats and is acting like a zombie. It's impossible to restart or kill it. Stopping all the guests with the util-vserver init.d script doesn't solve the issue. vkill --xid $CTX doesn't either.

[edit] Fix
 echo 50 > /var/run/vservers/$vserver

Seems to fix the issue




[edit] References

Personal tools