Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Mar 28, 2011 8:11 am 
Offline
Senior Newbie

Joined: Sun Mar 27, 2011 2:12 pm
Posts: 8
I'm trying to install OpenVZ on my Linode. Here is what I did:

Step 1: Custom kernel

Code:
apt-get update
apt-get upgrade --show-upgraded

VERSION="2.6.32-28"

apt-get install linux-image-$VERSION-virtual

mkdir /boot/grub
(   echo -e "timeout 5\n" && \
   echo -e "title           Ubuntu 10.04 LTS, kernel $VERSION-server" && \
   echo -e "root            (hd0)" && \
   echo -e "kernel          /boot/vmlinuz-$VERSION-server root=/dev/xvda console=hvc0 ro quiet" && \
   echo -e "initrd          /boot/initrd.img-$VERSION-server" \
) > /boot/grub/menu.lst

# amend linode configuration

reboot


Step 2: Installation
Code:
function replace_in_file {

   TMP_FILE=/tmp/replace_in_file.$$
   sed "s/$1/$2/g" $3 > $TMP_FILE && mv $TMP_FILE $3
}

apt-get update
apt-get upgrade

dpkg-reconfigure dash

apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 module-assistant debhelper build-essential

VERSION="2.6.32.28"

apt-get build-dep --no-install-recommends linux-image-$VERSION-server
m-a prepare
kernel-packageconfig

Cores=$(Nr () { echo $#; }; Nr $(grep "processor" /proc/cpuinfo | cut -f2 -d":"))
echo "CONCURRENCY_LEVEL := $(($Cores + 1))" | tee -a /etc/kernel-pkg.conf

cd /usr/src
wget http://archive.ubuntu.com/ubuntu/pool/main/l/linux/linux_2.6.32.orig.tar.gz
wget http://download.openvz.org/kernel/branches/2.6.32/current/patches/patch-feoktistov.1-combined.gz
wget http://download.openvz.org/kernel/branches/2.6.32/current/configs/kernel-2.6.32-x86_64.config.ovz

rm -rf linux-2.6.32
tar -xpf linux_2.6.32.orig.tar.gz
rm -rf "linux-2.6.32-openvz"
mv linux-2.6.32 "linux-2.6.32-openvz"
rm linux
ln -s "linux-2.6.32-openvz" linux

cd /usr/src/linux
gunzip -dc /usr/src/patch-feoktistov.1-combined.gz | patch -p1 --batch
cp -rf "/usr/src/kernel-2.6.32-x86_64.config.ovz" .config
make oldconfig

replace_in_file "all: lguest" "all:" /usr/src/linux/Documentation/lguest/Makefile

make-kpkg --initrd --append-to-version="-openvz" --revision=1 kernel_image kernel_headers

cd /usr/src
ls -l *.deb
dpkg -i linux-image-2.6.32.28-openvz_1_amd64.deb
dpkg -i linux-headers-2.6.32.28-openvz_1_amd64.deb
mkinitramfs -k 2.6.32.28-openvz -o /boot/initrd.img-2.6.32.28-openvz
apt-get install --reinstall grub-pc
update-grub

(   echo -e "timeout 5\n" && \
   echo -e "title           Ubuntu 10.04 LTS, kernel $VERSION-openvz" && \
   echo -e "root            (hd0)" && \
   echo -e "kernel          /boot/vmlinuz-$VERSION-openvz root=/dev/xvda console=hvc0 ro quiet" && \
   echo -e "initrd          /boot/initrd.img-$VERSION-openvz" \
) > /boot/grub/menu.lst

cat > /etc/sysctl.conf << "EOF"
net.ipv4.conf.default.forwarding=1
net.ipv4.conf.default.proxy_arp = 1
net.ipv4.ip_forward=1
net.ipv4.conf.all.rp_filter = 1
kernel.sysrq = 1
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
EOF
sysctl -p

apt-get install --no-install-recommends vzctl vzquota vzdump

ln -s /var/lib/vz /vz

reboot


Finally, when I try to reboot my Linode I get this:

Code:
Booting 'Ubuntu 10.04 LTS, kernel 2.6.32.28-openvz'                                               
                                                                                                   
root            (hd0)                                                                               
 Filesystem type is ext2fs, using whole disk                                                       
kernel          /boot/vmlinuz-2.6.32.28-openvz root=/dev/xvda console=hvc0 ro q                     
uiet                                                                                               
initrd          /boot/initrd.img-2.6.32.28-openvz                                                   
                                                                                                   
ERROR Invalid kernel: elf_xen_note_check: ERROR: Will only load images built for the generic loader
or Linux images                                                                                     
xc_dom_parse_image returned -1                                                                     
                                                                                                   
Error 9: Unknown boot failure                                                                       
                                                                                                   
Press any key to continue...


Any clue, what I could do wrong?


Top
   
 Post subject:
PostPosted: Mon Mar 28, 2011 10:28 am 
Offline
Senior Member
User avatar

Joined: Fri Oct 24, 2003 3:51 pm
Posts: 965
Location: Netherlands
You need a Xen paravirt-enabled kernel to run on a Linode. OpenVZ expects to run on bare metal and will only run under Xen with hardware-assisted virtualisation, and may well not run properly even then.

_________________
/ Peter


Top
   
 Post subject:
PostPosted: Mon Mar 28, 2011 10:39 am 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
Firstly, are you sure you want to run OpenVZ inside of Xen? A virtual machine inside a virtual machine isn't recommended, although combining hardware-level and OS-level virtualization like OpenVZ and Xen is indeed possible. It makes a lot more sense to just get multiple linodes, since their cost is pretty linear (instead of running 8x OpenVZ instances on a 4096 for $160/mth, you'd be better to run 8x 512 linodes for $160/mth). In fact, I bet you'd get much better performance out of the 8x linodes.

Second, while I'm no expert at loading kernels, there seems to be specific instructions for installing OpenVZ kernels in Xen:

http://wiki.openvz.org/How_to_use_OpenV ... 6_platform)

They seem to set a xen-related build parameter, and use a xen-related config file for the build, rather than using a generic kernel. So you might want to try that.


Top
   
 Post subject:
PostPosted: Mon Mar 28, 2011 10:40 am 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
pclissold wrote:
You need a Xen paravirt-enabled kernel to run on a Linode. OpenVZ expects to run on bare metal and will only run under Xen with hardware-assisted virtualisation, and may well not run properly even then.


No, OpenVZ has a xen paravirt-enabled kernel to do exactly this. It's just that there's very little reason to do so rather than just getting multiple smaller linodes.


Top
   
 Post subject:
PostPosted: Mon Mar 28, 2011 11:22 am 
Offline
Senior Newbie

Joined: Sun Mar 27, 2011 2:12 pm
Posts: 8
I want to use OpenVZ to isolate user accounts as described here.

The guide is for the RHEL5 Linux and looking at it I'm still not sure what I missed in my script.

Did anyone manage to install OpenVZ on the Ubuntu 10.04 LTS (Linode)?


Last edited by Daniel Stefaniuk on Tue Mar 29, 2011 3:53 am, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Mon Mar 28, 2011 11:52 am 
Offline
Senior Member

Joined: Sat Mar 12, 2011 3:43 am
Posts: 76
Location: Russia
Daniel Stefaniuk wrote:
I want to use OpenVZ to isolate user accounts as described here.

The guide is for the RHEL5 Linux and looking at it I'm still not sure what I missed in my script.

Does anyone managed to install OpenVZ on the Ubuntu 10.04 LTS (Linode)?

Dedicated server will be much more effective for this using. And cost will be almost same.


Top
   
 Post subject:
PostPosted: Tue Mar 29, 2011 3:52 am 
Offline
Senior Newbie

Joined: Sun Mar 27, 2011 2:12 pm
Posts: 8
OZ wrote:
Dedicated server will be much more effective for this using. And cost will be almost same.


Thanks for the advice. However, it is 5 times more to get the cheapest dedicated server in the location I need than the Linode 512. My server is not very heavily loaded and VPS is good solution for now.

What about other Linux distributions? Did anyone manage to install OpenVZ on Fedora or CentOS?


Top
   
 Post subject:
PostPosted: Tue Mar 29, 2011 5:04 am 
Offline
Senior Member
User avatar

Joined: Tue Mar 17, 2009 5:11 am
Posts: 129
Location: UK
Guspaz wrote:
No, OpenVZ has a xen paravirt-enabled kernel to do exactly this. It's just that there's very little reason to do so rather than just getting multiple smaller linodes.


Except cost....

The OP has asked for help and he's being told to either buy lots of seperate Linodes or a dedicated box - sheesh.

Perhaps he doesn't have the money for those things and wants to run his "virtual dedicated" server as he wants to.


Top
   
 Post subject:
PostPosted: Tue Mar 29, 2011 6:18 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
You could consider LXC instead which ubuntu is using to replace openvz since karmic, it doesn't require any fancyness and is pretty much an apt-get away, also I suggest using the ec2 kernel not the virtual one, it tends to play better with linode.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Tue Mar 29, 2011 8:12 am 
Offline
Senior Newbie

Joined: Sun Mar 27, 2011 2:12 pm
Posts: 8
Thanks obs. I've just installed LXC without any problem. One disadvantage I can see is lack of a good documentation. But that's the route I will go.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group