Gentoo on Strato vServer

This post is based on a post I found in the Gentoo wiki and should give some tips for setting up a Gentoo container for Virtuozzo/OpenVZ.

Before I start, let me say a few words about the background and about my experience with current service providers, which really drive me nuts! A few days ago, I wanted to install the latest WordPress updates and was confused when the WordPress 3.2.1 update failed because of not supporting MySQL 4 anymore. I checked the version of the MySQL server and figured out that my current hosting provider Server4You still has MySQL 4 installed on my web hosting server. So I asked them to update the MySQL server software to a current stable release. Unfortunately they told me that they can’t update the server since this would bring another huge amount of updates. I don’t think that any distribution still offers long term support for MySQL 4 – correct me if I’m wrong. This is why I decided to rent a vServer from Strato.

As I said, I followed the guide from the Gentoo wiki in order to replace the pre-installed Ubuntu with my favorite Gentoo distribution. Since Baselayout 2 and OpenRC, Gentoo supports the boot process in an OpenVZ container out of the box. Thus creating a Gentoo container is as easy as getting the latest stage3 and changing some configuration files. I also found a script which expects a stage3 archive and creates another archive which is ready to be started as an OpenVZ container. I found that script after I did all by hand, so I’ve not tested the script.

Nevertheless, the guide and I guess also the gentoovz script cannot manage the whole configuration and some parts are missing which have to be be done manually. I experienced some trouble with the device naming support udev. Fortunately, I enabled the OpenRC logger in /etc/rc.conf:

$ cat /etc/rc.conf | grep logger
# rc_logger launches a logging daemon to log the entire rc process to

This will make OpenRC to log the boot process into /var/log/rc.log. After switching back into recovery mode, I found the following in the OpenRC log:

$ cat /var/log/rc.log
rc boot logging started
Mounting /dev ...
mount: Operation not supported
 [ !! ]
 * ERROR: udev-mount failed to start
 * ERROR: cannot start udev as udev-mount would not start</dev>
rc boot logging stopped

It seems that udev-mount did not start because the mount operation is not supported within the OpenVZ container and thus, the boot process stopped. Since we don’t need udev anyways, uninstalling this service was the fastest solution:

$ emerge -C sys-fs/udev

The most time consuming part was in fact the network configuration. I found several other guides mainly based on this blog where the system configuration is described briefly. Further they figure out their static IP address which is obviously the external IP address of the vServer and a gateway IP address for the default route. Seems to be easy, but it seems that Strato has changed their OpenVZ networking and do not offer any gateway IP address anymore:

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
loopback        localhost       UG    0      0        0 lo
default         *              U     2      0        0 venet0
$ ip route via dev lo
default dev venet0  metric 2

Further more confusing was the network setup of the rescue system and the pre-configured Ubuntu on the vServer. The virtual interface venet0 which is created by OpenVZ as a point-to-point connection between the host and the guest system has had the address of the loop back device – you noticed the netmask? Further there was an alias venet0.0 of the virtual interface which was configured with my static IP address. Obviously this was kind of OpenVZ magic which makes troubleshooting really difficult. It turned out that one do not need the venet0.0 alias and it is fine to configure venet0 with the external IP address where the vServer should be reachable:

$ cat /etc/conf.d/net | grep config_venet0
config_venet0="85.XX.XX.XX netmask broadcast"

Since I don’t find any configured default gateways on the previously installed system and also not on the rescue system, I gave it a try and exit the rescue system and started the booting of my Gentoo container via the Strato web interface. Of course, I could not reach the server neither with ping nor with ssh. So I’m not the best in networking but that has shown that I have to set any routing information. I remember that once I used pppoe, I also had to define a default route without a gateway IP address:

route add default ppp0

The question is how to configure that default route in /etc/rc.conf. It seems that this is really difficult to find if you have only networking basics. Google always brought me to Gentoo’s handbook where they describe how to set the default route with a default gateway IP! I also asked in Gentoo’s IRC where they did not even believe that this is my network configuration which is in fact working in the rescue system. One of these guys called me a “Troll” and I also felt like one – but that guy did not know the answer either. So trial and error gave me that:

routes_venet0="85.XX.XX.XX/0 dev venet0 scope link
               default via dev venet0"

Note the line break after “scope link” which turned out to be essential. Adding the remaining parts from the howtos I finally got my networking configuration working:

$ cat /etc/conf.d/net
modules="!ifconfig iproute2"
config_venet0="85.XX.XX.XX netmask broadcast"
routes_venet0="85.XX.XX.XX/0 dev venet0 scope link
           default via dev venet0"

  1. Hello,

    thanks for Howto, is what i search. But one question i has, what is with the kernel, because i has problems to run Gentoo in VMWARE, need special Kernel Config, what is on a Strato Vserver. Can you publsihed something?

    Thanks, Regards

    • Daniel Morlock Says:
      April 16, 2012 at 12:29 pm


      other than in VMWare or VirtualBox, a guest operating system running in a Virtuozzo/OpenVZ container uses the kernel from its hypervisor. Since I run my Gentoo in a Virtuozzo/OpenVZ container on an hypervisor which is maintained by Strato, I cannot access the kernel and hence does not need any kernel configuration. Please have a look at to understand the difference between full and para-virtualization.


  2. Hello,

    yes thank u i has installed Gentoo now on my Vserver. Thank u for howto.


Leave a Reply

You must be logged in to post a comment.