Latest blog entry

Unable to start SSH: /dev/null is not a character device

October 6, 2011    |   Posted by admin   |    Category: VPS Management

The “/dev/null is not a character device” message occurs in a VPS when an upgrade is performed and the /dev/null turns into a regular file.

# /etc/init.d/sshd restart
Restarting Secure Shell server: sshd failed!
/dev/null is not a character device!.

The /dev/null should be a character device as per the Linux standards. To fix the issue, remove the file

# rm -f /dev/null

Create the character device

# mknod /dev/null c 1 3

The file should look like follows:

# ls -la /dev/null
crw-rw-rw- 1 root root 1, 3 Oct  1 11:42 /dev/null

Now restart the sshd service

# /etc/init.d/sshd restart
Stopping sshd:              [  OK  ]
Starting sshd:              [  OK  ]
Comments Off

How to secure the /tmp partition on a VPS with noexec,nosuid option?

October 27, 2010    |   Posted by admin   |    Category: VPS Management

On a VPS, there are 2 ways to mount OR secure /tmp and /var/tmp partitions with the noexec,nosuid option. One way is to mount these partitions from the Host Node (hosting provider can do this) and the other way is to mount them from within the VPS.

1) Login to the Node server and execute the following command:

# vzctl set VEID --bindmount_add /tmp,noexec,nosuid,nodev --save 
# vzctl set VEID --bindmount_add /var/tmp,noexec,nosuid,nodev --save

The “bindmount_add” option is use to mount the partition inside the VPS. The ‘VEID’ is the VPS ID you are working on.

2) The second option is to mount these partition from within the VPS itself. It is useful incase you don’t have access to the Node server. To mount /tmp and /var/tmp from within the VPS, execute:

# mount -t tmpfs -o noexec,nosuid,nodev tmpfs /tmp 
# mount -t tmpfs -o noexec,nosuid,nodev tmpfs /var/tmp

To check the mounted ‘tmp’ partitions, execute

# mount | grep tmp 
 tmpfs on /tmp type tmpfs (rw,noexec,nosuid) 
 tmpfs on /var/tmp type tmpfs (rw,noexec,nosuid,nodev) 

Related Links:

 How to Secure /tmp on Dedicated server?
Comments Off

How to auto-start a VPS on a host server/node reboot?

July 4, 2010    |   Posted by admin   |    Category: VPS Management

If a VPS doesn’t come online after the host server is rebooted, it is due to the “ONBOOT” parameter of the VPS is set to NO in the VPS configuration file. This parameter decides whether to start the VPS automatically if the host server is restarted.

If it's set to 'yes', the VPS will start automatically. 
If it's set to 'no', we will have to start the VPS manually.

To make the changes, edit the VPS configuration file

vi /etc/sysconfig/vz-scripts/VEID.conf

search for

ONBOOT="no"

and change to

ONBOOT="yes"

This change will auto-start the VPS next time the host node is rebooted.

Comments Off

vzquota : (error) Quota on syscall for xxx: Device or resource busy

June 17, 2010    |   Posted by admin   |    Category: VPS Management

While starting a VPS, you may receive a “vzquota Device or resource busy” message as follows

# vzctl start VEID
 vzquota : (error) Quota syscall for id xxx: Device or resource busy
 vzquota : (error) Possible reasons:
 vzquota : (error) - Container's root is already mounted
 vzquota : (error) - there are opened files inside Container's
 private area
 vzquota : (error) your current working directory is inside
 Container's private area
 vzquota : (error) Use -v option to see currently opened file(s).
 Running vzquota on failed for Container xxx

The error message indicates 2 things:

1) There are some open files inside the Containers private area. To list those open files, execute

lsof 2> /dev/null | egrep '/vz/root/xxx|/vz/private/xxx'

where, xxx is the VPS ID. If the open files are listed, close them and start the VPS.

2) The second reason is you are in the containers private directory while starting the VPS. i.e. the private area of the VPS is /vz/private/xxx and your current working directory while starting the VPS is inside /vz/private/xxx.

Check the current working directory:

# pwd

if the output is something like /vz/private/veid, get out of the private directory and start the container

# cd
# vzctl start veid
Comments Off

Error: Unable to execute bash: No such file or directory

June 12, 2010    |   Posted by admin   |    Category: VPS Management

You may receive “Unable to execute bash: No such file or directory” error message while starting a VPS and the reason is either the binaries from /bin OR /usr/bin are missing OR corrupted.

To fix the issue, you either copy the directories /bin and /usr/bin from a working VPS OR from the OS template the VPS is using.

Solutions:
1) Copy directories from a working VPS:

cp -pR /vz/private/VEID1/fs/root/bin /vz/private/VEID/fs/root/
cp -pR /vz/private/VEID1/fs/root/usr/bin /vz/private/VEID/fs/root/usr/

where,
VEID1 is the working VPS
VEID is the VPS having problems.

2) Copy directories from the OS template. The OS templates are stored under /vz/template/cache directory.

a) Extract the template file the VPS is using

# cd /vz/template/cache/
# tar -zxf os-templatename.tar.gz

b) Copy the directories to the VPS private area

cp -pR /vz/template/cache/root/bin /vz/private/VEID/fs/root/
cp -pR /vz/template/cache/root/usr/bin /vz/private/VEID/fs/root/usr/

Once copied, make sure you are out of the VPS private area and restart the VPS.

# vzctl start VEID

It will re-calculate the quota of the VPS and will start the VPS.

Comments Off