docs:vserver
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
docs:vserver [2012-10-28 12:39] – cleanup dead links, update desc glen | docs:vserver [2015-10-05 15:07] (current) – syn on glen | ||
---|---|---|---|
Line 14: | Line 14: | ||
===== Installing Vserver host on PLD Linux ===== | ===== Installing Vserver host on PLD Linux ===== | ||
- | Build and install the kernel: | ||
- | |||
- | < | ||
- | # poldek -u kernel | ||
- | </ | ||
+ | Ensure you have appropriate [[packages: | ||
+ | You can check this from kernel config: | ||
+ | < | ||
+ | # modprobe configs | ||
+ | # zgrep CONFIG_VSERVER / | ||
+ | CONFIG_VSERVER=y | ||
+ | </ | ||
===== Installing guest PLD Linux Vserver ===== | ===== Installing guest PLD Linux Vserver ===== | ||
==== Preparing userspace tools ==== | ==== Preparing userspace tools ==== | ||
- | First, install the tools: | ||
- | < | + | First, install the tools: |
+ | < | ||
+ | # poldek -u util-vserver | ||
</ | </ | ||
- | Then configure // | ||
- | < | + | If you need to review poldek repo sources, then the configs are in |
- | </ | + | '' |
- | Where XX is: ac, ti, th | + | where '' |
At this point you should have booted into vserver-enabled kernel. You must start '' | At this point you should have booted into vserver-enabled kernel. You must start '' | ||
Line 39: | Line 41: | ||
To start '' | To start '' | ||
- | < | + | < |
+ | # / | ||
</ | </ | ||
+ | ==== Guest creation ==== | ||
- | ==== Actual guest creation ==== | + | Build the guest system. |
- | Build the guest system: | + | |
+ | < | ||
+ | # a guest name (not hostname) | ||
+ | NAME=test | ||
+ | # <num> must be a number within 2-32767 range. | ||
+ | CTX=2 | ||
- | < | + | vserver |
</ | </ | ||
- | <num> must be a number within 2-32767 range. | ||
- | There are two versions of PLD available for guest systems: | + | This defaults installing guest same ARCH and VERSION that your host is. |
+ | |||
+ | If you need to use another combination, | ||
+ | * pld-ac - [[:ac|PLD 2.0 (Ac)]] | ||
+ | * pld-th - [[:th|PLD 3.0 (Th)]] | ||
- | * pld-ac - [[: | ||
- | * pld-th - [[: | ||
You may choose one using '' | You may choose one using '' | ||
+ | < | ||
+ | DIST=pld-th | ||
- | < | + | vserver |
</ | </ | ||
+ | |||
using '' | using '' | ||
- | < | + | < |
- | # vserver | + | MIRROR=http:// |
+ | |||
+ | vserver | ||
</ | </ | ||
+ | |||
+ | To build 32bit guest on 64bit host: | ||
+ | < | ||
+ | vserver $NAME build --context $CTX -m poldek -n $NAME --personality linux_32bit --machine i686 -- -d $DIST | ||
+ | </ | ||
+ | |||
To build vserver from template (archive containing whole filesystem): | To build vserver from template (archive containing whole filesystem): | ||
- | < | + | < |
+ | # vserver | ||
</ | </ | ||
To see other '' | To see other '' | ||
- | < | + | < |
+ | # vserver test build --help | ||
</ | </ | ||
+ | |||
Install '' | Install '' | ||
- | < | + | < |
+ | # vpoldek test -- -u rc-scripts | ||
</ | </ | ||
+ | |||
you should consider installing '' | you should consider installing '' | ||
And then start the guest system: | And then start the guest system: | ||
- | < | + | < |
+ | # vserver test start | ||
</ | </ | ||
+ | |||
To enter that vserver, type: | To enter that vserver, type: | ||
- | < | + | < |
+ | # vserver test enter | ||
</ | </ | ||
- | Note, however, that if you don't run //plain// init style you must have at least one daemon running inside your guest vserver or it will be shut down shortly. | ||
+ | Note, however, that if you don't run //plain// init style you must have at least one daemon running inside your guest vserver or it will be shut down shortly. | ||
Line 363: | Line 392: | ||
[[http:// | [[http:// | ||
- | You can use //lcap// program to see available | + | You can use //lcap// program to see available |
Line 547: | Line 576: | ||
==== Running 32 bit vserver on an 64 bit host ==== | ==== Running 32 bit vserver on an 64 bit host ==== | ||
- | With recent PLD util-vserver package you can create 32-bit guest systems inside a 64-bit host. First you need to prepare a new distribution definition skeleton: | ||
+ | With recent [[package> | ||
+ | To specify arch during guest creation, use '' | ||
- | < | + | < |
</ | </ | ||
- | Then copy your repository configuration to ''/ | ||
- | + | If you need to set '' | |
- | + | < | |
- | < | + | # echo linux_32bit |
+ | # echo i686 > / | ||
</ | </ | ||
- | Later to force i686 32bit use: | ||
- | |||
- | |||
- | < | ||
- | # echo i686 > / | ||
- | </ | ||
- | however, you can do that at vserver build time using arguments '' | ||
Line 687: | Line 710: | ||
+ | ==== Running auditd inside guest ==== | ||
+ | |||
+ | You need '' | ||
+ | |||
+ | ==== XFS filesystem - kernel upgrade causes xfs related oops (xfs_filestream_lookup_ag) ==== | ||
+ | |||
+ | After upgrading from 2.6-3.4 kernels (possibly other versions) to 3.18 (tested, possibly other versions) kernel ooppses | ||
+ | almost immediately after accessing some files on xfs filesystem with '' | ||
+ | (or other filestream related function). | ||
+ | |||
+ | That's because vserver patch for kernels earlier than 2.6.23 patched xfs filesystem to introduce new flag: | ||
+ | |||
+ | <file c> | ||
+ | #define XFS_XFLAG_BARRIER | ||
+ | </ | ||
+ | |||
+ | and files/dirs with such flag got saved on your filesystem. | ||
+ | |||
+ | Starting with kernel 2.6.23 kernel introduced filestreams which are using 0x00004000 bit, thus causing conflict with vserver. | ||
+ | |||
+ | <file c> | ||
+ | #define XFS_XFLAG_FILESTREAM | ||
+ | </ | ||
+ | |||
+ | Vserver stopped adding such xfs xflag in 3.13 BUT your existing filesystem can still have XFS_XFLAG_BARRIER (0x00004000) set | ||
+ | causing oops in newer kernels. | ||
+ | |||
+ | How to find out if I'm affected? | ||
+ | |||
+ | IIF you don't use filestream feature then modify http:// | ||
+ | |||
+ | <file diff> | ||
+ | diff --git a/ | ||
+ | index 4e22ecd..887512f 100644 | ||
+ | --- a/ | ||
+ | +++ b/ | ||
+ | @@ -34,19 +34,21 @@ dotime(void *ti, char *s) | ||
+ | void | ||
+ | | ||
+ | { | ||
+ | - | ||
+ | - (long long)sp-> | ||
+ | - | ||
+ | - | ||
+ | - | ||
+ | - | ||
+ | - | ||
+ | - | ||
+ | - | ||
+ | - | ||
+ | - | ||
+ | - | ||
+ | - | ||
+ | + if (sp-> | ||
+ | + | ||
+ | + (long long)sp-> | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | and then run it with mounted directory of each filesystem (bstat /; bstat /home etc). It will print "ino ..." information for filestream files. | ||
+ | |||
+ | |||
+ | How to clean up? | ||
+ | |||
+ | rsync files to other partition, recreate problematic partition and then copy files back. | ||
===== Debian or Ubuntu guest installation ===== | ===== Debian or Ubuntu guest installation ===== | ||
Line 960: | Line 1060: | ||
</ | </ | ||
- | * load the '' | + | * load the '' |
- | * you can optionaly increase max vroot number of devices by putting the limit in your ''/ | + | |
</ | </ | ||
- | | + | * assing a free vroot node for the device in question: < |
</ | </ | ||
- | | + | * copy the vroot device to the guest: < |
</ | </ | ||
- | | + | * add to ''/ |
</ | </ | ||
- | | + | * add '' |
- | restart your vserver and run '' | + | |
===== Network namespace in vservers ===== | ===== Network namespace in vservers ===== | ||
+ | |||
+ | Starting from util-vserver 0.30.216-1.pre3054 there is basic support for creating network namespaces with interfaces inside. | ||
+ | |||
+ | Enabling netns and two capabilities: | ||
+ | |||
+ | |||
+ | < | ||
+ | touch / | ||
+ | echo NET_ADMIN >> / | ||
+ | echo NET_RAW >> / | ||
+ | echo ' | ||
+ | </ | ||
+ | |||
+ | Avoid context isolation since it makes little sense when using network namespaces: | ||
+ | < | ||
+ | |||
+ | Configure interfaces: | ||
+ | |||
+ | 0 - arbitrary directory name, just for ordering | ||
+ | |||
+ | myiface0 will be interface name inside of guest (optional, default geth0, | ||
+ | geth1 and so on) | ||
+ | |||
+ | veth-host - interface name on the host side | ||
+ | |||
+ | < | ||
+ | mkdir -p / | ||
+ | echo myiface0 > / | ||
+ | echo veth-host > / | ||
+ | </ | ||
+ | |||
+ | !!! FINISH ME. FINISH ME. FINISH ME. !!! | ||
+ | |||
+ | ===== Network namespace in vservers (OLD WAY) ===== | ||
Enabling netns and two capabilities: | Enabling netns and two capabilities: | ||
Line 985: | Line 1117: | ||
- | < | + | < |
- | touch /etc/vserver/ | + | touch /etc/vservers/ |
echo NET_ADMIN >> / | echo NET_ADMIN >> / | ||
echo NET_RAW >> / | echo NET_RAW >> / | ||
Line 1008: | Line 1140: | ||
ip link add name " | ip link add name " | ||
- | vserver ${VSERVER_NAME} | + | vserver ${VSERVER_NAME} exec sleep 60 & |
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do | for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do | ||
pid=$(vserver ${VSERVER_NAME} exec pidof -s sleep) | pid=$(vserver ${VSERVER_NAME} exec pidof -s sleep) | ||
Line 1014: | Line 1146: | ||
usleep 100000 | usleep 100000 | ||
done | done | ||
+ | if [ -z " | ||
+ | echo " | ||
+ | fi | ||
ip link set " | ip link set " | ||
sysctl -q -w net.ipv4.conf.${VSERVER_HOST_IFACE}.forwarding=1 | sysctl -q -w net.ipv4.conf.${VSERVER_HOST_IFACE}.forwarding=1 | ||
Line 1074: | Line 1209: | ||
< | < | ||
- | cgroup /dev/ | + | cgroup /sys/fs/ |
- | cgroup /dev/cgroup/cpu cgroup rw, | + | cgroup /sys/fs/cgroup/cpu cgroup rw, |
- | cgroup /dev/ | + | cgroup /sys/fs/ |
- | cgroup /dev/ | + | cgroup /sys/fs/ |
- | cgroup /dev/ | + | cgroup /sys/fs/ |
- | cgroup /dev/ | + | cgroup /sys/fs/ |
- | cgroup /dev/ | + | cgroup /sys/fs/ |
- | cgroup /dev/ | + | cgroup /sys/fs/ |
</ | </ | ||
For these to work you need at least util-vserver-0.30.216-1.pre2955.3 (that .3 is important) and turn on per subsys support by doing: | For these to work you need at least util-vserver-0.30.216-1.pre2955.3 (that .3 is important) and turn on per subsys support by doing: | ||
- | |||
< | < | ||
# touch / | # touch / | ||
+ | </ | ||
+ | |||
+ | ===== cgroups mountpoint ===== | ||
+ | |||
+ | if you have cgroups mounted somewhere else, you can inform vserver of that (it searching in ''/ | ||
+ | |||
+ | < | ||
+ | none / | ||
+ | </ | ||
+ | |||
+ | you need to tell vserver where it mounted: | ||
+ | < | ||
+ | # cat / | ||
+ | /dev/cgroup | ||
</ | </ |
docs/vserver.1351424350.txt.gz · Last modified: 2012-10-28 12:39 by glen