Frequently Asked Questions
From Linux-VServer
We currently migrate to MediaWiki from our old installation, but not all content has been migrated yet. Take a look at the Wiki Team page for instructions how to help or look at the old wiki to find the information not migrated yet.
To ease migration we created a List of old Documentation pages.
CURRENTLY THE CONTENT OF THE OLD WIKI FAQ (AND MORE) IS BEING MIGRATED TO THIS PAGE (TASK: DERJOHN)
What is a 'Guest'?
What kind of Operating System (OS) can I run as guest?
Which distributions did you test?
Is VServer comparable to XEN/UML/QEMU?
Is VServer secure?
Performance?
Is SMP Supported?
Resource sharing?
- memory: Dynamically.
- CPU usage: Dynamically (token bucket)
Resource limiting?
Disk I/O limiting? Is that possible?
# cat /sys/block/hdc/queue/scheduler noop [anticipatory] deadline cfq
The default is anticipatory a.k.a. "AS". When running several guests on a host you probably want the I/O performance shared in a fair way among the different guests. The kernel comes with a "completely fair queueing" scheduler, CFQ, which can do that. (More on schedulers can be found at http://lwn.net/Articles/114770/)
This is how to set the scheduler to "cfq" manually:
root# echo "cfq" > /sys/block/hdc/queue/scheduler root# cat /sys/block/hdc/queue/scheduler noop anticipatory deadline [cfq]
Keep in mind that you have to do it on all physical discs. So if you run an md-softraid, do it to all physical /dev/hdXYZ discs!
If you run Debian there is a predefined way to set the /sys values at boot-time:
# apt-get install sysfsutils [...] # cat /etc/sysfs.conf | grep cfq block/sda/queue/scheduler = cfq block/sdc/queue/scheduler = cfq # /etc/init.d/sysfsutils restart
For non-vserver processes and CFQ you can set by which key the kernel decides about the fairness:
cat /sys/block/hdc/queue/iosched/key_type pgid [tgid] uid gid
Hint: The 'key_type'-feature has been removed in the mainline kernel recently. Don't look for it any longer :(
The default is tgid, which means to share fairly among process groups. Think every guest is treated like a own process group. It's not possible to set a scheduler strategy within a guest. All processes belonging to the same guest are treated like "noop" within the guest. So: If you run apache and some ftp-server within the _same_ guest, there is no fair scheduling between them, but there is fair scheduling between the whole guest and all other guests.
And: It's possible to tune the scheduler parameters in several ways. Have a look at /sys/block/hdc/queue/....
You need a very recent Version of VS devel, e.g. the 2.1.1-rc18 can do it. Some older version have that feature too, then it got lost and was reinvented. So: Go and get a rc18 - only in 'devel', not stable!
Why isn't there a device /dev/bla? within a guest
What is Unification (vunify)?
What is vhashify?
How do I manage a multi-guest setup with vhashify?
mkdir /etc/vservers/.defaults/apps/vunify/hash /vservers/.hash ln -0s /vservers/.hash /etc/vservers/.defaults/apps/vunify/hash/root
Then, do this one line per vserver:
mkdir /etc/vservers/<vservername>/apps/vunify # vhashify reuses vunify configuration
With which VS version should I begin?
is there a way to implement "user/group quota" per VServer?
what about "Quota" for a context?
Does it support IPv6?
I can't do all I want with the network interfaces inside the guest?
Is there a web-based interface for vserver that will allow creation/deletion/configuration etc. of vserver guests?
What is old-style and new-style config?
What is the "great flower page"?
How do I add several IPs to a vserver?
Here is a little helper-script that adds a list of IPs defined in a text file, one per line.
#!/bin/bash j=1 for i in `cat myiplist`; do j=$(($j+1)) mkdir $j echo $i > $j/ip echo $i > $j/ip-old echo "24" > $j/prefix done
If my host has only one a single public IP, can I use RFC1918 IP (e.g. 192.168.foo.bar) for the guest vservers?
iptables -t nat -I POSTROUTING -s $VSERVER_NETZ ! -d $VSERVER_NETZ -j SNAT --to $EXT_IP
See: HowtoPrivateNetworking and
http://www.tgunkel.de/it/software/doc/linux_server#h3-Vserver_Masquerading_SNAT (THX, [MUPPETS]Gonzo)
If I shut down my vserver guest, the whole Internet interface ethX on the host is shut down. What happened?
On Debian Sarge (stable) only util-vserver is 0.30-204 available, which has been reported to be buggy (I didnt check the version for longer time) How do I compile a local version of alpha util-vserver .210 on Debian?
apt-get build-dep util-vserver ./configure --prefix=/usr/local/ --enable-release \ --mandir=/usr/local/share/man \ --infodir=/usr/local/share/info \ --sysconfdir=/etc --enable-dietlibc \ --localstatedir=/var \ --with-vrootdir=/var/lib/vservers make make install-distribution (Which does a make install + setting a symlink ln -s /usr/local/lib/util-vserver/vshelper /sbin/vshelper )
To test which version you are running:
# which vserver /usr/local/sbin/vserver
This should point to ..local...
If you dont want to build it yourself: On www.backports.org there are backported (for sarge) linux-images (2.6.16) with vserver-patch enabled and a updated util-vserver package as well.
I use derjohn's kernel or a differnet kernel with a more-than-16-IPs-per-guest-patch and can't use more than 16 IPs. Why?
kernel/network.h:#define NB_IPV4ROOT 64BTW: The initial patches can be found here: http://vserver.13thfloor.at/Experimental/VARIOUS/util-vserver-0.30.196-net64.diff.bz2 and http://vserver.13thfloor.at/Experimental/VARIOUS/delta-2.6.9-vs1.9.3-net64.diff
I run a Debian host and want to build an Ubuntu guest. Howto?
vserver vubuntu build --force -m debootstrap --hostname vubuntu.myvservers.net --netdev eth0 --interface 192.168.0.2/24 \ --context 42 -- -d breezy -m http://de.archive.ubuntu.com/ubuntu
[UPDATE] Currently there are problems in building breezy under unclear circumstances, which seems to have to do with udev. If the above didnt work, try:
vserver vubuntu build --force -m debootstrap --hostname vubuntu.myvservers.net --netdev eth0 --interface 192.168.0.2/24 \ --context 42 -- -d breezy -m http://de.archive.ubuntu.com/ubuntu -- --exclude=udev
In very recent versions of the utils, the problem should not occur anymore (it has to do with the 'secure-mount' if you look in the MLs)
Well, sid's debootstrap knows how to bootstrap Ubuntu linux. Make sure to have a current debootstrap package:
apt-get update apt-get install debootstrapThe knowledge how to build ubuntu 'breezy badger' (which you probably want to be your guest at the time of writing) has been added recently.
How do I make a vserver guest start by default?
echo "default" > /etc/vservers/derjohn/apps/init/mark
If you want to start it earlier, please read the init script "/etc/init.d/vserver-default" to find out how to do it. In most cases you don't need to change this. On Debian the vservers are started at "90", so after most other stuff is up (networking etc.).
Besides that I created a small helper script for managing the autostart foo: ((vserver-autostart))
My host works, but when I start a guest it says that it has a problem with chbind.
When I try to ssh to the guest, I log into the host, even if I installed sshd on the guest. What's wrong here?
Port 22 # Use these options to restrict which interfaces/protocols sshd will bind to #ListenAddress ::
And now change the setting to
Port 22 # Use these options to restrict which interfaces/protocols sshd will bind to ListenAddress your.hosts.ip.here # not the guests IP!
Then '/etc/init.d/ssh restart' on the host, after that on the guest (if you did apt-get install ssh on the guest already.)
Do I have to explain more? If the hosts sshd binds all available IP addresses on port 22 (The hosts 'sees' even all addresses of the guests!). So if the guest starts its sshd, it cant bind to port 22 any more. You need to change that setting only on the host.
(BTW: A similar approach has to be done for a lot of daemons, e.g. Apache. If the daemon does not support an explicit bind, you may use the chbind command to 'hide' IP addresses from the daemon before starting.)
I did everything right, but the application foo does not start. What's up there?
Some programs do things that might work on a normal host but not inside a V-Server. This is often not a fault of V-Server itself, the programs are doing automagic things which fail and no proper error handling is done. Also sometimes the actions need special rights which are not permitted by default in V-Servers. Allowing CAPs is often not necessary since those special CAPs are only required once (e.g. when the program initializes the directories/settings/whatever).
OpenGroupware Apache Module
If your V-Server doesn't have access to localhost, then the connection to the OpenGroupware server will fail with a "Internal Server Error". The apache module for OpenGroupware called mod_ngobjweb uses a hardcoded "127.0.0.1" IP address in the source (handler.c line 339), this line you need to change to the IP address that should be used (the IP of the V-Server that runs the OpenGroupware? server)
Hylafax (with CAPI)
If you want to run hylafax in a V-Server, you will get a CAP and device problem which can be easily solved. First you need your capi20 devices in your V-Server, which can't be created by ./MAKEDEV (requires special CAPs) so copy the devices into the V-Server, like this (command run on the host):cp -aR /dev/capi* /vservers/your_vserver/devNow hylafax can access your CAPI ISDN card but will exit after a few seconds, the problem is it tries to create a /dev/null nod in the hylafax chroot. This fails because of missing CAPs, so lets help hylafax again with copying the nod into the hylafax chroot in the V-Server. Like this (command run on the host):
cp -aR /dev/null /vservers/your_vserver/var/spool/hylafax/dev
Allright, now hylafax should have CAPI access and run properly.
Links inside screen inside a V-Server
Don't know why, but links crashes systematically being inside a screen session inside a V-Server started outside a V-Server. (please elaborate!)
screen inside a VServer
[root@ge root]# vserver zoe enter zoe:/# screen Cannot open your terminal '/dev/pts/5' - please check. zoe:/# strace screen ... stat64("/dev/pts/5", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 5), ...}) = 0 open("/dev/pts/5", O_RDWR|O_NONBLOCK) = -1 EACCES (Permission denied)
is neither a bug nor an issue with screen, it just shows that a vserver context is not allowed to mess with host terminals. either use ssh/telnet to reach the 'guest' or start the screen session before you do the 'enter' (i.e. on the host)
util-vserver 0.30.211+ includes a workaround for the issue (vlogin), which allocates a tty inside the guest.
OpenLDAP Startup
slapd needs name resolution available in order to start up, otherwise it appears to hang. Make sure you have working DNS (or whatever) available to your vserver before starting one with slapd. This behavior is confirmed in my setup, no confirmation from others yet. My Setup: vservers all bind to an interface on a DMZ-like network segment, BIND runs on a vserver. slapd would hang at startup if the BIND vserver had not been started first.
rndc
Bind's rndc has a hardcoded 127.0.0.1 somewhere so any command to rndc will fail with connection refused. You should have a reachable localhost address defined in /etc/hosts and then you can userndc -s localhostcommand. You can make a rndc.conf and set the default-server option, like that the '-s localhost' isn't necessary.
Please see the section below to get rndc working without switches.
- -Paul Allen
Asterisk
Since some version of Asterisk (at least since 1.0.2), it will not run anymore. On start it fails with: "Unable to set high priority". This can be solved by allowing CAP_SYS_NICE for that V-Server. You can also not run Asterisk with the realtime priority - Just pass the '-p' command line argument to disable the read-time priority. Good doc on setting up Asterisk devices in the vserver: http://www.telephreak.org/papers/vpa/ (additional documentation for Asterisk 1.4 installation available here: https://customer.lylix.net/knowledgebase.php?action=displayarticle&catid=2&id=27)
Open/FreeSwan
No patch needed, openswan gives out some errors about writing to /proc, but those can be ignored.
Samba
Oplocks don't work as smbd insists on receiving break requests from 127.0.0.1 Just patch source/smbd/oplock.c (commenting paranoid code)
+++ oplock.c.orig 2005-02-14 14:27:51.000000000 +0200 --- oplock.c 2005-02-02 12:27:50.000000000 +0200 @@ -181,14 +181,12 @@ return False; } +#if 0 /* Validate message from address (must be localhost). */ if(from.sin_addr.s_addr != htonl(INADDR_LOOPBACK)) { DEBUG(0,("receive_local_message: invalid 'from' address \ (was %lx should be 127.0.0.1)\n", (long)from.sin_addr.s_addr)); return False; } +#endif /* Setup the message header */ SIVAL(buffer,OPBRK_CMD_LEN_OFFSET,msg_len);
or if you don't want to patch the samba source code you can disable oplock in Samba and it will work too!
Just put the following in your smb.conf:
kernel oplocks = no oplocks = no
Note: The Vserver using Samba should also listen on the broadcast address. Thereby you will not be able to have two samba servers in the same net (on the same broadcast).
To assign the broadcast address to a vserver guest you need to create a new directory inside the /etc/vservers/<guest name>/interfaces/ directory. The directory is a number not used by this vserver guest. Inside the directory should be normal information and a file called nodev (see util-vserver for information). The contents of the dev file can be identical between directories.
Samba from Debian 3.1
The samba deb in sarge (3.1) provided file sharing. The only oddity observed is that the vserver guest running samba did not appear in a windows box's 'My Network Places'
Use a WINS server. The SMB browsing protocol relies heavily on broadcasts on the local net, which are problematic with vservers. WINS resolution on the other hand is unicast and works flawlessly under vserver.
Samba printer and file server with cups
Samba runs correctly in a Mandriva (Mdk) 10.1 Vserver, (Apart from the above oplock problem ?).First, edit your /etc/sysconfig/network file, and set networking to yes (This will solve problems for other services !):
# cat /etc/sysconfig/network NETWORKING=yes
Some more tweaking is needeed in /etc/smb.conf
# cat /etc/smb.conf ... # YOUR VSERVER IP/MASK HERE interfaces = xxx.xxx.xxx.xxx/mask ...
But if you're using Samba + Cups to provide printing for Windows clients, AND if you want to use the Point and Print feature, there is more: In the [printers] section of your smb.conf, you should have the use client drivers directive set to no, or the driver upload procedure will fail !
# cat /etc/smb.conf ... use client driver = no ...
So, here is a full smb.conf file:
# cat /etc/samba/smb.conf | awk '!/^$/ && !/^\s*(#|;)/ {print $0}' [global] workgroup = MYDOMAIN netbios name = MYHOSTNAME server string = MYCOMMENT (Samba %v) printcap name = cups load printers = yes printing = cups printer admin = @adm log file = /var/log/samba/log.%m max log size = 50 map to guest = bad user security = domain password server = * encrypt passwords = yes smb passwd file = /etc/samba/smbpasswd username map = /etc/samba/smbusers idmap uid = 10000-20000 idmap gid = 10000-20000 socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 interfaces = 127. MYVSERVERIP/MYVSERVERMASK wins server = MYWINSIP dns proxy = no # for french users: dos charset = 850 unix charset = ISO8859-1 [homes] comment = Home Directories browseable = no writable = no [printers] comment = All Printers path = /var/spool/samba browseable = no guest ok = no writable = no printable = yes create mode = 0700 print command = lpr-cups -P %p -o raw %s -r # using client side printer drivers. use client driver = no [print$] path = /var/lib/samba/printers browseable = yes write list = @adm root guest ok = yes inherit permissions = yes
...And a working smbusers:
# Unix_name = SMB_name1 SMB_name2 ... root = administrator MYDOMAIN\administrator nobody = guest pcguest smbguest
Cups print server
Symptoms: The Cups init script exits with:
Starting CUPS printing system: cupsd: Child exited with status 98!
And the logs (/var/log/cups/error_log) show:
E [date:hour...] StartListening: Unable to bind socket for address 0.0.0.0:631 - Address already in use.
...Or something like this.
With a correct "cupsd.conf file" (Tested version 1.1.21-0.rc1.7mdk, on Mandrake 10.1 - Now Mandriva), it works; All we need is to remove references to 127.0.0.1 or localhost from the file, as well as correctly unsetting the Listen directive:
LogLevel info TempDir /var/spool/cups/tmp # No 'Listen' directive ! Port 631 BrowseAddress @LOCAL BrowseDeny All BrowseAllow @LOCAL BrowseOrder deny,allow <Location /> Order Deny,Allow Deny From All Allow From @LOCAL </Location> <Location /admin> AuthType Basic AuthClass System Order Deny,Allow Deny From All Allow From YOUR_NETWORK_ADDRESS/YOUR_NETMASK # Example: 172.16.0.0/24 # Or Allow From @LOCAL </Location>
Then you'll need to modify the /etc/init.d/cups script, to comment any section referring to 127.0.0.1 lookup and configuration. This section exists at least on Mandrake 10.1, and is pretty long (Lines 35 to 55 and/or 79), and additionnaly four "else...if" lines must be commented far below (Lines 161 to 164) !
Remember to stop any Cupsd running in the host server, or to start it via a wrapper /etc/init.d/v_cups script:
#!/bin/sh # chkconfig: 2345 15 60 # description: Wrapper to start cups bound to a single IP USR_LIB_VSERVER=/usr/lib/util-vserver exec $USR_LIB_VSERVER/vsysvwrapper cups $*
Do not forget to give a password to the root user, if you want to be able to manage your printers from the web interface (http://yourcupsvserver:631)!
# passwd root ...
If you use Mandriva 10.1 (And maybe some other distros), you’ll need to add the printers drivers for Cups, and reload it:
# urpmi --root /vservers/yourcupsvserver/ cups-drivers # /etc/init.d/cups reload
…It added 67 Mb of packages for me.
Then use /etc/init.d/v_cups (re)start to launch Cups on the host server. You will now be able to make Cupsd start in the vserver , but more tweaking on the ACLs may be necessary to avoid authentification problems...
Bind9 on Debian GNU/Linux Woody (3.0), Sarge (3.1), Etch (4.0)
named provided by the bind9 binary packages fails to start because it is compiled with CAPs option.
The debian way is to build** your own package without CAPs:
su - cd /usr/src apt-get build-dep bind9 apt-get source bind9 cd bind9-x.x.x vi debian/rules
Insert the following line after "./configure --prefix=/usr \":
--disable-linux-caps \
On a NPTL-enabled system you alse have to replace
--enable-threads \
with
--disable-threads \
or bind might refuse to run with an other user than root.
Save the file and go ahead with compiling/installing:
dpkg-buildpackage dpkg -i ../bind9-x.x.x.deb echo "bind9 hold" | dpkg --set-selections
or you may be better off to set the selections for all the packages that were generated by dpkg-buildpackage:
echo -e "bind9-doc hold\nbind9-host hold\nbind9utils hold\ndnsutils hold\nlibbind9-40 hold\nlibbind-dev hold\nlibdns43 hold\nlibisc44 hold\nlibisccc40 hold\nlibisccfg40 hold\nliblwres40 hold\nlwresd hold" | dpkg --set-selections
The last line is to set the package "on hold", so it is not touched by the update process. you have to take care of security holes by yourself now!
The Xs in "bind9-x.x.x" denote the version number of bind9. Alternatively you can allow the CAP_SYS_RESOURCE for that V-Server. The best way would be to fix bind, which is somehow broken when it comes to capabilities. Daniel Hokka Zakrisson repaired it. His patch is to be found here:
bind-9.3.2-caps-when-available.patch
So, if you recompile, it would be the cleanest way to apply that patch. Thanks Daniel! It would be also nice, if someone submits that patch to the bind people or maybe to your distribution's package maintainers in the first step.
Get my vserver-guest-ready Debian bind9 package for Debian Sid guests. Feedback welcome: aj@net-lab.net
AMD 64 Etch Vserver Guest WORKING!!! :o) 21Oct2008
Before I begin with all the grueling steps, if you want to be lazy, I wrote a Perl script to do all of this for you, and you can get it here.
- Note:
- If you plan to use the script, you need to ensure you have Perl5, as well as have your locale set properly.
- (On a brand-new Etch guest, I had to do those before my script would work)
- I noticed after much googling that all links I found to any of the pre-compiled Bind9 (in the above bind9-capacheck directories) are DEAD. However, after many times of running into a brick wall, I caught something that isn't mentioned here...
Following the above steps to build Bind9 from source acquired with apt-get, if you look closely, on about line 499 or so after you execute the dpkg-buildpackage command, you'll see this:
dpkg-source: building bind9 using existing bind9_9.3.4.orig.tar.gz dpkg-source: building bind9 in bind9_9.3.4-2etch3.diff.gz dpkg-source: building bind9 in bind9_9.3.4-2etch3.dsc
- ...which is basically ignoring the debian/rules modifications you just made...
So, following you will find the steps I took to make Bind9 AND rndc run flawlessly on my vserver guest. Everything denoted with // in front is a comment:
su - cd /usr/src mkdir bind9-build cd !$ apt-get build-dep bind9 apt-get source bind9 mkdir unused mv bind9_* !$ //note the ones you don't need all have the underscore _ cd bind9-x.x.x //whatever your version # is nano debian/rules beneath this line: ./configure --prefix=/usr \ -add --disable-linux-caps \ -change --enable-threads \ to: --disable-threads \ dpkg-buildpackage cd ../ dpkg -i *deb //This will install all the debs that were created, but the actual bind9 deb will fail because of dependencies //At this point, you can just run it again, or 'apt-get install -f' might fix it, but I'm unsure on that dpkg -i *deb echo "bind9 hold" | dpkg --set-selections
- Here you will still see it fail to start, and even though it says that, it isn't named that failed, but only rndc.
- So actually, you can stop here, but rndc will fail every time, and bind won't restart with the /etc/init.d/bind9 restart call
- In fact, everytime you want to reload, you'll need to manually kill the named process ID and then issue:
- /etc/init.d/bind9 start
- But if you're a perfectionist like me, and you want a completely error-free starting Bind9 with working rndc, keep reading...
ps aux|grep named
- That will show an output something like:
bind 9376 0.0 0.3 20844 3228 ? Ss 15:52 0:00 /usr/sbin/named -u bind
- Assuming the above was your actual output, your next command would be:
kill 9376 //Kill the process ID
- Now here's where the trickery comes in...
- For some reason, if you have the EXACT same key definitions in all the correct places, but the conf files aren't using the actual key file, rndc WILL fail...
- Let me say that again... rndc WILL fail... I only know because it took me 3 days to find out why it was failing...
- So first:
rndc-confgen -s your.eth0.ip.address -k your-custom-keyname
- Assuming my eth0 IP is 11.22.33.44 and I used a keyname of my-vps-key, the following would be my output:
vps:~# rndc-confgen -s 11.22.33.44 -k my-vps-key # Start of rndc.conf key "my-vps-key" { algorithm hmac-md5; secret "D4fZPZPFpG037a/NHLedgg=="; }; options { default-key "my-vps-key"; default-server 11.22.33.44; default-port 953; }; # End of rndc.conf # Use with the following in named.conf, adjusting the allow list as needed: # key "my-vps-key" { # algorithm hmac-md5; # secret "D4fZPZPFpG037a/NHLedgg=="; # }; # # controls { # inet 11.22.33.44 port 953 # allow { 11.22.33.44; } keys { "my-vps-key"; }; # }; # End of named.conf
- Now, this information is VERY important, and misleading at the same time...
- Don't simply plop the 'named.conf' data into named.conf and the 'rndc.conf' data into rndc.conf... It will NOT work.
- The 'key' portion is all you need for your keyfile, and your keyfile MUST be named the same as the name you put into rndc-confgen
- There are several ways to do this, but the simplest is to highlight the key section, right click, click 'copy' and then:
nano /etc/bind/my-vps-key //Don't forget, name must match the rdnc-confgen output!
- Inside nano, hit shift+insert on your keyboard, and it *should* paste everything properly. Hit ctrl+x to exit nano (press y at the prompt to save).
- Once complete, you can verify your key file with:
cat /etc/bind/my-vps-key
- ...and the output should read something like:
vps:~# cat /etc/bind/my-vps-key key "my-vps-key" { algorithm hmac-md5; secret "D4fZPZPFpG037a/NHLedgg=="; };
- Now, do the same thing for the 'options' section of the rndc-confgen output, except you'll be adding that to the rndc.conf file, along with an include statement for the key file you just made.
- NOTE: Delete all lines in rndc.conf first so that it contains only what you paste. (ctrl+k will cut lines... cut all of them before pasting)
- After pasting, your ENTIRE rndc.conf file should look thusly:
include "/etc/bind/my-vps-key"; options { default-key "my-vps-key"; default-server 11.22.33.44; default-port 953; };
- Finally, you need to do the same process, but with the 'controls' section of the rndc-confgen output, and that goes in /etc/named.conf. Again, you will need to add the include statement for the key you created.
- Also, while you're editing named.conf, you might as well go ahead and edit the IP addresses. The only one that really seems to matter is the 'localhost' zone
- When finished, your named.conf should look something like this (only showing the relevant portions)
- Be sure to remove the comment tags (#) from the beginning of the lines!!!
<snip> // If you are just adding zones, please do that in /etc/bind/named.conf.local include "/etc/bind/named.conf.options"; include "/etc/bind/my-vps-key"; controls { inet 11.22.33.44 port 953 allow { 11.22.33.44; } keys { "my-vps-key"; }; }; zone "." { type hint; file "/etc/bind/db.root"; }; // be authoritative for the localhost forward and reverse zones, and for // broadcast zones as per RFC 1912 zone "11.22.33.44" { type master; file "/etc/bind/db.local"; }; zone "127.in-addr.arpa" { <snip>
- I'm unsure if this next step is necessary, but I did it anyway...
- Edit /etc/bind/db.local and modify all instances of 'localhost' and '127.0.0.1' with your IP address.
- When complete, it should look something like this:
vps:~# cat /etc/bind/db.local ; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA 11.22.33.44. root.11.22.33.44. ( 1 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS 11.22.33.44. @ IN A 11.22.33.44
- All that's left is to start your new error-free Bind9 (we hope...)
/etc/init.d/bind9 start
If you find anything in this tutorial OR in the Perl script that's incorrect, or that would make it better, please let me know: paul@grandesigns.net
Update (11/04/08)...
After an apt-get dist-upgrade, bind9 failed to start. After poking around, I found out that somehow /etc/default/bind had the -u switch set to run Bind9 as the user 'named'. Weird, because with Bind9, there is no user 'named'. I set it back to: -u bind and everything fired right up. Also, my particular vserver doesn't log to dmesg, so if you want intuitive debug level info that isn't being printed in /var/log/syslog, then you can run named like this:
named -g -d 10
That tells named to start with the debug level globally set to 10.
I also tinkered a little more and found that you can remove all of the db. files in /etc/bind and in /etc/bind/named.conf except for db.local and db.root. In other words, you don't need to configure or keep db.0, db.127, db.255, db.empty, nor do you need them referenced in named.conf.
Problems getting this to work in an x86_64 vserver. Any hints? From what I can tell from stracing, turning off threads doesn't fix everything related to it. It also caused a juicy Ksymoops.
- Apparently this does work when running bind as user root. I Installed a bare Debian Etch vserver without granting any special capabilities on my x86_64 system, apt-get install bind9, kill any started named-processes and edit /etc/default/bind, changing the user (-u) from bind to root. Bind starts now starts when using /etc/init.d/bind9 start and resolving seems to work. Mind you, the usual warnings and rants about running stuff as root still applies! - 2007-08-06 MGS
Zimbra Mail
Zimbra is many applications (including Postfix and MySQL? and OpenLDAP? and more) which try to take over the interfaces, and depend a lot on binding from 127.0.0.1 - it is not hard to change, but there is a couple of tricks - it is documented here - http://wiki.zimbra.com/index.php?title=Install_VServer
xine
won't start with no error message.
"xine --verbose" shows this.
ERROR: Could not determine network interfaces, you must use a interfaces config line
This happens if you have the xineplug_inp_smb.so plugin. Delete it and everything is fine.
nagios
Compiling nagios-1.4 within a vserver requires an explicit lo with 127.0.0.1, otherwise it hangs during the configure with "checking for ICMP ping syntax..."
on older kernels, which do not support loopback isolation (separate 127.0.0.1) and use 'localhost' mapped to the first guest IP you can work around this by adding 127.0.0.1 to the interfaces (temporarily) but make sure to remove it afterwards.
note: nagios is broken, because it uses a hardcoded 127.0.0.1, and this change (which is not needed with newer kernels providing lback remapping) will affect guest security and should not be used lightly (Bertl)
Hula-project
Does not want to start. TODO: add more information.
Postfix
Postfix 2.1.5 (Debian Sarge)
On a vserver with two interfaces (lo and eth0), and a postfix 2.1.5 listening on lo, postfix can't send emails : "Invalid argument"... Setting smtp_bind_address (http://www.postfix.org/postconf.5.html#smtp_bind_address) to the external address solves the issue.
Postfix on Debian Etch (for local only mail)
See Postfix local only problem
Postfix Policy Daemon
Running a Debian 3.1 Sarge with Backports I have several issues with the postfix-policyd because it wants to set the rlimits.
Log returns:
cannot set rlimit: Operation not permitted
Strace tells us:
setrlimit(RLIMIT_NOFILE, {rlim_cur=4097, rlim_max=4097}) = -1 EPERM (Operation not permitted)
Output on the Host
# ulimit -Ha ... -n: file descriptors 1024 ...
Thats too little...
Solution:
The App has again a build in need to use CAP_SYS_RESOURCE (which is bad (tm)) so in the guest do:
# ulimit -HS -n 8192 # ulimit -Ha .. shows us now the correct 8192 instead of 1024. # vserver $yourVserverName restart # vserver $yourVserverName enter $yourVserverName # ulimit -Ha ... -n: file descriptors 8192 ...
Everything should be fine now !
DB2
DB2 needs at least the following capabilities:
CAP_NET_RAW CAP_NET_ADMIN CAP_SYS_ADMIN CAP_IPC_LOCK CAP_IPC_OWNER
WARNING: this configuration reduces security
ejabberd
ejabberd does not work properly in a Linux-VServer guest under Debian Etch. The server eventually stops accepting connections. Also, it's not possible to control ejabberd with ejabberdctl.
Newer versions of ejabberd (2.0.x) don't seem to have this problem. On Debian Etch a newer version can be installed from etch-backports (backports.org).
The Jabber server from the jabber package also works.
Other problem, which seems to happen with (at least) erlang R14B : epmd has been modified and accepts some commands only from 127/8, which causes problems. Details and solution can be found here : http://www.ejabberd.im/node/3709. In case this page becomes unavailable, the solution is to change network flags on the vserver, as follow (run these on the host) :
nattribute --set --nid vserver_name --flag ~single_ip echo "~single_ip" > /etc/vservers/vserver_name/nflags
VMware Server
VMware Server needs the following capabilities to run correctly:
CAP_MKNOD CAP_SYS_MODULE CAP_SYS_ADMIN CAP_SYS_NICE CAP_NET_RAW CAP_NET_ADMIN CAP_IPC_OWNER
WARNING: this configuration reduces security
ntpd
The ntpd daemon needs to set the hardware time and can't do that from inside a vserver by default. Allow CAP_SYS_TIME and ntpd will be happy.
FAI server / fai-setup
FAI Server / fai-setup fai-setup wants to create some devices and needs to mount proc.
bcapabilities:
MKNOD
ccapabilities:
SECURE_MOUNT SECURE_REMOUNT BINARY_MOUNT
WARNING: this configuration reduces security big time
Bind9 does not like to start in my guest.
((ProblematicPrograms)) and/or get my [((ProblematicPrograms)) and/or get my vserver-guest-ready Debian package for Debian Sid guests from that URL: http://linux-vserver.derjohn.de/bind9-packages/bind9-capacheck_9.3.2-2_i386.deb and check out the readme. (Hint: This is fresh stuff. The give me Feedback)
[UPDATE] Since VServer Devel 2.1.1-rc18 you do not need to patch the userland tools anymore. The capabilities are masked.
Which guest vservers are running?
CTX PROC VSZ RSS userTIME sysTIME UPTIME NAME 0 77 965.1M 334.6M 14m14s18 2m28s69 1h33m46 root server 49152 7 14M 5.2M 0m00s40 0m00s30 1h30m15 chiffon
How can I reboot/halt guests?
For vserver with legacy-interfaces support, you have to replace Template:/sbin/halt in guests with vreboot and start rebootmgr in host. You also need to have a dummy <guest>.conf file in /etc/vservers for each guest. Please have a look at /etc/init.d/rebootmgr.
Vserver with native interface utilizes /dev/initctl. No changes are needed in guests. Just make sure that REBOOT capability is adjusted in guests.
Do I really need the legacy-interfaces? What are these legacy-interfaces?
I have a vserver running on a Linux kernel with preemption. Is VServer "preempt" safe?
Is this a new project? When was it started?
Can I run an OpenVPN Server in a guest?
First of all you have to prepare the host with a persistent tuntap interface in tap-mode. The tools we need come from the uml-utilities. Then you need to create a device /dev/net/tun, which the OpenVPN userspace daemon reads. Well assume 10.10.10.100 is the server IP, and 10.10.10.101 is the client ip - to be cool be choose a /31 netmask (255.255.255.254), so we have a net without broadcast and don't waste IPs :)
On the host do:
# apt-get install uml-utilities # cd /var/lib/vserver/<myopenvpnserver>/dev/ # ./MAKEDEV tun (creates the dev/net/tun device accessible by te guest - even a tap interface need /dev/net/tun !) # tunctl -t tap0 (creates the network device 'tap0' persistently)
Then add the ip to the guest:
# cat /etc/vservers/<myopenvpnserver>/interfaces/1/ip 10.10.10.100 # cat /etc/vservers/<myopenvpnserver>/interfaces/1/prefix 31 # cat /etc/vservers/<myopenvpnserver>/interfaces/1/dev tap0 (This kind of config brings the ip when the vserver is started - only the tap0 interface has to exist already, see above!)
Here is a sample config for the guest (which is acting as a server):
Install OpenVPN package on server and client, in the Debian case:
# apt-get install openvpn
The server's conf looks like that:
# port and interface specs # behave like a ssl-webserver port 443 proto tcp-server # tap device? (keep in mind you need /dev/net/tun !) dev tap0 # now the ips we will use for the tunnel ifconfig 10.10.10.100 255.255.255.254 ifconfig-noexec # the server part # Keep VPN connections, even if the client IP changes float # use compression (may also even obfuscate content filters) comp-lzo # use a static key - create it with 'openvpn --genkey --secret static.key' secret static.key # dont reload the key after a SIGUSR1 persist-key # check alive all 10 secs keepalive 10 60 # verbosity level (from 1 to 9, 9 is max log level) verb 4 status openvpn-status.log
The client's conf may look like that (This example even makes the tunnel the clients default address):
# cat /etc/openvpn/client.conf # port and interface specs # the following is not necessary, if you bring up openvpn via Debian's init script: daemon ovpn-my-clients-name # behave like a ssl-webserver port 443 proto tcp-client remote %%%<insert-the-guest-primary-public-ip-here>%%%% # what device tun ot tap? dev tap # now the ips we will use for the tunnel ifconfig 10.10.10.101 255.255.255.254 # Keep VPN connections, even if the client IP changes float mssfix # use compression (may also even obfuscate content filters) comp-lzo # use a static key secret static.key # dont reload the key after a SIGUSR1 persist-key # check alive all 10 secs keepalive 10 60 # verbosity level (from 1 to 9, 9 is max log level) verb 4 # set the default route route-gateway 10.10.10.100 redirect-gateway def1 # to add special routes you can do it wihtin the openvpn client conf: # route <dest> <mask> <gateway> # if you need to connect via proxy (like squid) # http-proxy s p [up] [auth] : Connect to remote host through an HTTP proxy at # address s and port p. If proxy authentication is required, # up is a file containing username/password on 2 lines, or # 'stdin' to prompt from console. Add auth='ntlm' if # the proxy requires NTLM authentication. # http-proxy s p [up] [auth] # http-proxy-option type [parm] : Set extended HTTP proxy options. # Repeat to set multiple options. # VERSION version (default=1.0) # AGENT user-agent # http-proxy-option type [parm]
In the next lesson I will talk about OpenVPN's server mode, which can deal with with multiple clients connecting to one ip and one port (i.e. you only need one guest for tons or 'roadwarriros'), tls connections and pki.
Contributions welcome. :)
32 vs 64 Bit? What should I take?
[*] Kernel support for ELF binaries <M> Kernel support for MISC binaries [*] IA32 Emulation <---- without that, the entire 32bit API is not present <M> IA32 a.out support
You can force the guest to behave like a 32 environment like this:
echo linux_32bit > /etc/vservers/$NAME/personality echo i686 > /etc/vservers/$NAME/uts/machine
(thanks cehteh for the hint!)
But you can force debootstrap to but 32 bit binaries into the guest by 'export ARCH=i386';
export ARCH=i386 ; vserver build ....
I want to (re)mount a partition in a running guest ... but the guest has no rights (capability) to (re)mount?
# vnamespace -e XID mount -t tmpfs -o remount,size=256m,mode=1777 none /var/lib/vservers/<guest>/tmp/Be warned that the guest will not recognize the change, as the /etc/mtab file is not updated when you mount like this. To permanently change the mount, edit /etc/vserver/<guest>/fstab on the host.
How do I limit a guests RAM? I want to prevent OOM situations on the host!
If you want a recipe, do that: 1. Check the size of memory pages. On x86 and x86_64 is usually 4 KB per page. 2. Create /etc/vserver/<guest>/rlimits/ 3. Check your physical memory size on the host, e.g. with "free -m". maxram = kilobytes/pagesize. 4. Limit the guests physical RAM to value smaller then maxram:
echo %%insertYourPagesHereSmallerThanMaxram%% > /etc/vserver/<guest>/rlimits/rss
5. Check your swapspace, e.g. with 'swapon -s'. maxswap = swapkilobytes/pagesize. 6. Limit the guest's maximum number of as pages to a value smaller than (maxram+maxswap):
echo %%desiredvalue%% > /etc/vserver/<guest>/rlimits/asIt should be clear this can still lead to OOM situations. Example: You have two guests and your as limit per guest is greater than 50% of (maxram+maxswap). If both guests request their maximum at the same point in time, there will be not enough mem .....
Were can I get newer versions of VServer as ready made packages for Debian?
Can I use iptables ?
=== Try to connect to a vserver from the master or another vserver on the same host fails with
- strace shows:
sin_addr=inet_addr("xx.xx.xx.xx")}, yy) = -1 EINVAL (Invalid argument)===
- check all netmasks on all interfaces (do they overlap) ?
- check policy routing (disable it temporary) ?
- check that lo is up (Networking within a host/vserver always uses lo interface)
#1 ERROR: capset(): Operation not permitted
How can I make 'vserver start' mount the root filesystem
/dev/drbd0 / xfs rw,dev 0 0
util-vserver 210 won't be able to find some scripts for the reboot, add into /etc/vservers/vserver-name/apps/init/cmd.stop
/etc/init.d/rc 6