It appears that OpenVZ and CentOS can have some issues regarding udev. After installing the Development tools yum package I found myself unable to do anything in the container. It generated an error on ssh, vzctl enter etc.

Unable to open pty: No such file or directory

There are numerous posts on fixing the problem. most remove the udev package but that can be problematic as some packages (ImageMagick for example) seem to require udev. For those packages it seems best to leave udev present but disabled.

:pushpin: Be sure that the core elements you use from those packages do not need udev.

The fix then becomes a two step process. The first steps are done from the node, adjust your vz container ID from 101 as needed. Re-create the missing devices.

# vzctl exec 101 /sbin/MAKEDEV tty
# vzctl exec 101 /sbin/MAKEDEV pty

You should be able to log in via ssh or vzctl enter BUT the problem may re-appear on an update (yum update). The next steps should help with that. Enter the container and edit the file /etc/rc.sysinit. Search for the line /sbin/start_udev and replace it with the following. This disables udev without removing the package and auto-repairs the devices if by some chance they go missing again.

# udev mucks up OpenVZ - disable it and auto-fix it if it goes bad again
#/sbin/start_udev
/sbin/MAKEDEV tty
/sbin/MAKEDEV pty

As an alternative to changing /etc/rc.sysinit you can remove the udev package, but be prepared for dependencies to load it again. If you do this you may also wish to add udev to the YUM ignore list.

# rpm -qf /etc/udev/makedev.d/50-udev.nodes

This will return the package to remove, for example: udev-095-14.9.el5

# rpm -e udev-095-14.9.el5 –nodeps

References

Leave a comment