Archive for the ‘OpenVZ’ category

Yum rpmdb open failed

July 29th, 2010

Error: rpmdb open failed

This error occurs most frequently when the rpm database is corrupted. See below for instructions on how to rebuild the rpm database.

# yum update
Loaded plugins: fastestmirror
error: no dbpath has been set
error: cannot open Packages database in /%{_dbpath}
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in ?
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 309, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 157, in main
base.getOptionsConfig(args)
File "/usr/share/yum-cli/cli.py", line 187, in getOptionsConfig
self.conf
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 664, in
conf = property(fget=lambda self: self._getConfig(),
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 239, in _getConfig
self._conf = config.readMainConfig(startupconf)
File "/usr/lib/python2.4/site-packages/yum/config.py", line 804, in readMainConfig
yumvars['releasever'] = _getsysver(startupconf.installroot, startupconf.distroverpkg)
File "/usr/lib/python2.4/site-packages/yum/config.py", line 877, in _getsysver
idx = ts.dbMatch('provides', distroverpkg)
TypeError: rpmdb open failed

The most common fix is as follows:

# yum clean all
# rm -f /var/lib/rpm/__db*
# rpm –rebuilddb
# yum update

However, if this is a VZ container (VPS), the following may be required:

#mv /dev/urandom /dev/urandom.back
#mknod -m 644 /dev/urandom c 1 9

Share

How to Install OpenVZ on a 64-bit Server

April 22nd, 2010

These are more of a note for myself than anything, so I don’t have to navigate through the docs to do an install. The more verbose install guide can be found here, and includes instructions for 32-bit architecture:

http://wiki.openvz.org/Quick_installation

#cd /etc/yum.repos.d
#wget http://download.openvz.org/openvz.repo
#rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
#yum install ovzkernel.x86_64

Verify the new kernel is set to boot in /boot/grub/grub.conf, then reboot into this new kernel.

Once you’re back online, edit /etc/sysctl.conf, adding/modifying the following values:

# On Hardware Node we generally need
# packet forwarding enabled and proxy arp disabled
net.ipv4.ip_forward = 1
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.all.forwarding = 1
net.ipv4.conf.default.proxy_arp = 0

# Enables source route verification
net.ipv4.conf.all.rp_filter = 1

# Enables the magic-sysrq key
kernel.sysrq = 1

# We do not want all our interfaces to send redirects
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0

# yum install vzctl.x86_64 vzquota.x86_64
# wget -c http://download.openvz.org/template/utils/vzyum/2.4.0-11/vzyum-2.4.0-11.noarch.rpm
# rpm -ivh vzyum*
#yum install vzpkg vzrpm43-python vzrpm44-python vzctl-lib

The installation is now complete, and you can download a CentOS OpenVZ image template to get you started.

#cd /vz/template/cache
#wget http://download.openvz.org/template/precreated/centos-5-x86_64.tar.gz

Share

OpenVZ: Set VE timezone

March 23rd, 2010

From within the container, run the following, changing the location data to match your timezone of choice:

#mv /etc/localtime /etc/localtime.old
#ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime

Share

OpenVZ: CSF csftest.pl Failed

March 23rd, 2010

ERROR: RESULT: csf will not function on this server due to FATAL errors from missing modules [4]

CSF will work well in VZ containers, but needs specific iptables modules enabled. Below you’ll see how to enable these modules for use for all containers.

root@server [/csf]# perl csftest.pl
Testing ip_tables/iptable_filter...OK
Testing ipt_LOG...FAILED [FATAL Error: iptables: Unknown error 18446744073709551615] - Required for csf to function
Testing ipt_multiport/xt_multiport...FAILED [FATAL Error: iptables: Unknown error 18446744073709551615] - Required for csf to function
Testing ipt_REJECT...OK
Testing ipt_state/xt_state...FAILED [FATAL Error: iptables: Unknown error 18446744073709551615] - Required for csf to function
Testing ipt_limit/xt_limit...FAILED [FATAL Error: iptables: Unknown error 18446744073709551615] - Required for csf to function
Testing ipt_recent...FAILED [Error: iptables: Unknown error 18446744073709551615] - Required for PORTFLOOD feature
Testing ipt_owner...FAILED [Error: iptables: Unknown error 18446744073709551615] - Required for SMTP_BLOCK and UID/GID blocking features
Testing iptable_nat/ipt_REDIRECT...FAILED [Error: iptables v1.3.5: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)] - Required for MESSENGER feature

RESULT: csf will not function on this server due to FATAL errors from missing modules [4]

SOLUTION

Edit /etc/vz/vz.conf, and comment out the line starting with IPTABLES. Then, insert the following:

IPTABLES="ipt_REDIRECT ipt_owner ipt_recent iptable_filter iptable_mangle ipt_limit ipt_multiport ipt_tos ipt_TOS ipt_REJECT ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_LOG ipt_length ip_conntrack ip_conntrack_ftp ip_conntrack_irc ipt_conntrack ipt_state ipt_helper iptable_nat ip_nat_ftp ip_nat_irc"

Be sure that the entire IPTABLES string is on a single line, and you’re all set.

Share

OpenVZ – Multiple Subnets on a Single Interface

March 23rd, 2010

This post written by Robert Shady, posted at http://www.robertshady.com/sysadmin/sysadmin-virtualization/sysadmin-virtualization-openvz/5.html Reposting here as sort of a personal bookmark.

You have multiple subnets allocated to you (Ie: Let’s say 2 Class C IP4 address blocks – 10.10.10.1/24 and 10.10.20.1/24), and you want to be able to create containers that utilize IP addresses on either block.

Problem:
You can’t simply install OpenVZ and configure your containers to use IP addresses on either block. By default, OpenVZ will not broadcast ARP packets for IP blocks that it doesn’t have a venet interface for – even though you may be bridging your containers to your ethernet device.

Solution:
The solution is actually very easy, simply edit your /etc/vz/vz.conf file and change the ‘NEIGHBOUR_DEVS=detect’ to ‘NEIGHBOUR_DEVS=all’, save and reboot and everything should work beautifully.

Share

cPanel Web Site Hosting by IntraHost