“Broken” Files In VPS Container

Posted by Vanessa | Tagged under , | Posted on May 09, 2010

1

I came across a VPS that was recently moved to another node and noticed that Apache wasn’t starting due to missing modules.  When I saw that the modules folder in Apache was linked to /usr/lib64, I checked that folder to see that the httpd directory was there, but not really “there”. It looked like this:

?---------  ? ?    ?       ?            ? httpd

Question marks in the file name and descriptor, clearly indicating that the VPS container was missing something. Well, I went onto the parent node and into /vz/private/VEID/fs/root/usr/lib64 and the files were there, along with some strange broken symlink that looks like this:

lrwxrwxrwx   1 root root   72 Mar  8  2009 ._vzlnk_. -> ////centos/5/x86_64/httpd-2.2.3-11.el5_2.centos.4.x86_64/usr/lib64/httpd

To fix one instance, I removed the broken symlink and that fixed the problem. I also tried to fix this on another container by copying over the httpd folder in the lib64 directory and that did the trick as well, but I assume it’s the broken symlink that caused the problem.

Further troubleshooting indicated that the container was somehow using a different OS template than what it was on the previous server, which was causing Virtuozzo to be unable to find some files. If this is the case, you can edit /etc/vz/conf/$VEID.conf and change the ostemplate value to what it should be, then restart the container.

If that doesn’t fix it, you’ll probably still need to remove all those bad symlinks. Here’s a simple script stolen from here that should remove all these for you:

#!/bin/bash
VEID=101 # Replace with your container ID
for i in `find /vz/private/$VEID/fs/root/ -noleaf -type l -print | perl -nle ‘-e || print’|grep ._vzlnk_.`
do
ln -sf `ls -ga $i|grep ._vzlnk_.|awk ‘{print $10}’|sed ‘s/\/\/\//\/vz\/template/’` $i
done

Liking this article? Share it and spread the word!
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • DZone
  • LinkedIn
  • Live
  • MySpace
  • PDF
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Tumblr
  • Twitter

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Comments (1)

Hi,

I had exactly the same thing with three different debian and ubuntu containers. It turned out that they were all using older versions of the apache2.2-common package than was on the new server.

If you cat any of the suspect files from outside the container, the contents are just a pointer to the location of the missing files:

cat /vz/private/137/fs/root/etc/apache2/ports.conf

gave something like:

//ubuntu/9.04/x86/apache2.2-common_2.2.11-2ubuntu2.2_i386/etc/apache2/ports.conf

The package was missing from /vz/template/ubuntu/9.04/x86 on the new server (somehow the migration process had not copied it across). Rsyncing the correct directory from the old server to the new and restarting the VPS fixed the problem on all the problem containers. In the case above I ran the following command on the old server:

rsync -avz -e “ssh -l root” /vz/template/ubuntu/9.04/x86/apache2.2-common_2.2.11-2ubuntu2.2_i386/ 172.16.1.1:/vz/template/ubuntu/9.04/x86/apache2.2-common_2.2.11-2ubuntu2.2_i386

to copy the required files to the new server.

Cheers,

Write a comment