Unable to get tty name: Bad file descriptor

February 6, 2010    |   Posted by admin   |    Category: VPS Management

You may receive an error as “Unable to get tty name: Bad file descriptor” while accessing a VPS from the host server. The problem occur when some files from /lib directory of the VPS goes missing. See example below:

root@hostserver:/# vzctl enter VEID
entered into CT VEID
Unable to get tty name:
Bad file descriptor
root@VEID:/#

In this case, you will either have to copy the /lib directory from a different VPS of the same template

# cp -R /vz/root/VEID1/lib  /vz/root/VEID/

(where, VEID1 is the VPS ID of a different VPS using the same OS template)

OR extract the respective OS template and copy the /lib directory from it:

# tar -zxf /vz/template/cache/os_template.tar.gz
# cp -R /vz/template/cache/lib /vz/root/VEID/

Reboot the VPS

# vzctl restart VEID

Comments Off on Unable to get tty name: Bad file descriptor

Unable to start init, probably incorrect template

January 31, 2010    |   Posted by admin   |    Category: VPS Management

You may receive an error “Unable to start init, probably incorrect template” while starting a VPS. The “incorrect template” problem occurs when the “init” on the VPS goes missing. The init file resides under /sbin i.e. check

ls -la /vz/private/VEID/sbin/init

of a VPS. If the file is missing or the file size is zero, your VPS won’t start. In order to resolve problem, you can either copy the ‘init’ from a different VPS using the same OS template i.e.

cp /vz/root/VEID1/sbin/init /vz/private/VEID/sbin/

OR

you can untar the OS template located under /vz/template/cache/ directory and copy the ‘init’ file there i.e.

tar -zxf /vz/template/cache/os_template.tar.gz
cp /vz/template/cache/sbin/init /vz/private/VEID/sbin/

Once done, you will be able to start your VPS.

vzctl start VEID

Comments Off on Unable to start init, probably incorrect template

Yum update. Error: rpmdb open failed

January 11, 2010    |   Posted by admin   |    Category: VPS Management

The “rpmdb open failed” error message is mostly received when the rpm databases __db.00* located under /var/lib/rpm directory are corrupted. This results in a “error: cannot open Packages database” message while installation/updatation of a package via yum.

root@server [~]# 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 <lambda>
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 common fix is to delete the rpm databases and run rebuilddb, like

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

However, in case of a VPS, yum may still not work with rebuilding rpm database and you have to try create a /dev/urandom device. Login to your VPS and execute

# rm /dev/urandom
# mknod -m 644 /dev/urandom c 1 9

The problem may reoccur on a VPS reboot so to fix the problem permanently, login to Hardware Node and execute:

# vzctl stop VEID
# mknod –mode 644 /vz/private/VEID/fs/root/dev/urandom c 1 9
# vzctl start VEID

Quota getstat syscall: Inappropriate ioctl for device

December 30, 2009    |   Posted by admin   |    Category: VPS Management

You may receive the error message while starting a VPS on OpenVZ server.

vzquota : (error) Quota getstat syscall for id 101: Inappropriate ioctl for device
vzquota init failed [3]

This is a typical Quota error message on OpenVZ servers while starting a VPS. The message indicates that you need to initialize quota on the VPS. You can follow the below steps to correct the issue

rm -f /var/vzquota/quota.101
vzquota drop 101
vzctl start 101

where, 101 is the VPS ID.

If you continue to receive the same error message while starting the VPS,

1. Make sure the server is booted with the OpenVZ kernel, you can check that out using

uname -a

2. The vz service is online.

service vz status

if not, restart the vz service

service vz start

Once you confirm the above two things, start the vps again with the vzctl command.

PPP module in a VPS/Container

December 8, 2009    |   Posted by admin   |    Category: VPS Management

How to enable PPP feature in a VPS/Container OR steps if PPP module not working on a VPS?

In order to enable PPP feature for a VPS/Container, the Hardware node should have the

ppp_async
ppp_deflate

modules loaded in the kernel. To load the modules on the hardware node, execute

# modprobe ppp_async
# modprobe ppp_deflate

lsmod will list the modules those are active.

# lsmod | grep ppp
ppp_deflate            39168  0
zlib_deflate           52760  1 ppp_deflate
ppp_async              45184  0
crc_ccitt               6337  1 ppp_async
ppp_generic            20165  6 ppp_deflate,ppp_async
slhc                   30561  1 ppp_generic

You now need to enable PPP feature for the VPS:

# vzctl set VEID --features ppp:on --save

Now, set ppp within the VPS:

# vzctl set VEID --devices c:108:0:rw --save
# vzctl exec VEID mknod /dev/ppp c 108 0
# vzctl exec VEID chmod 600 /dev/ppp

Now, restart the VPS

# vzctl restart VEID

Login to the VPS:

# vzctl enter VEID

See if the PPP module works in the VPS:

# /usr/sbin/pppd

You should now receive a message asking for the password or some garbage characters. If you see something else, then something is wrong.