Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts

Rebuild Ensim FILESYSTEMTEMPLATE to solve bizarre errors

Posted by plattapuss on July 8th, 2007

A few weeks ago one of my Ensim 4.1.0 RHEL4 servers and have since had endless troubles. My most recent problems involved me not being able to create any new sites on the server, which sort of puts a damper on what my hosting business was supposed to do!

After some searching through forums and not getting much help or info I found a solution on the Ensim forums. As this solution apparently solved ALL my problems I felt it worth repeating here, with credit where credit is due of course!

My error is just one of many errors that could result from this problem, but here is what my error was:

CODE:
  1. Jul  6 14:37:04 server [22509]: siteinfo: Enable service failed
  2. Jul  6 14:37:04 server [22509]:  - (ERROR:   05ff000000000005): Failed to add administrator group myadmin to domain. Error 127. Standard Out: [] Standard Error: ['/usr
  3. /sbin/groupadd: U1\xc9\x89\xe5V\x83\xec\x04\x8bu\x08\x8bV\x04\xc7\x04$\xfe\xff\xff\xff\x8b\x06\xe8\x83\xeb\xff\xff\x89F\x08\x83\xec\x04\x8bu\xfc\xc9\xc3\x90\x8d\xb4&: @
  4. \xb4\xf7\xbf\x01: Error 18446744072635266048\n']
  5. Jul  6 14:37:04 server5 [22509]:  - (ERROR:   05ff000000000005): Failed to add administrator group myadmin to domain. Error 127. Standard Out: [] Standard Error: ['/usr
  6. /sbin/useradd: U1\xc9\x89\xe5V\x83\xec\x04\x8bu\x08\x8bV\x04\xc7\x04$\xfe\xff\xff\xff\x8b\x06\xe8\x83\xeb\xff\xff\x89F\x08\x83\xec\x04\x8bu\xfc\xc9\xc3\x90\x8d\xb4&: p\
  7. x12\xfd\xbf\x01: Error 18446744072635617840\n']
  8. Jul  6 14:37:04 server [22509]:  - (ERROR:   05ff000000000021): Failed to set the site administrator's password and comment. Error 127. Standard Out: [] Standard Error
  9. : ['/usr/sbin/usermod: U1\xc9\x89\xe5V\x83\xec\x04\x8bu\x08\x8bV\x04\xc7\x04$\xfe\xff\xff\xff\x8b\x06\xe8\x83\xeb\xff\xff\x89F\x08\x83\xec\x04\x8bu\xfc\xc9\xc3\x90\x8d
  10. \xb4&: \xe0\xb3\xed\xbf\x01: Error 18446744072634610592\n']
  11. Jul  6 14:37:04 server [22509]: delete_virtual_domain site12
  12. Jul  6 14:37:04 server [22509]: disable_virtual_domain site12
  13. Jul  6 14:37:08 server [22509]: site 12 released 0 uids
  14. Jul  6 14:37:25 server [22509]: Delete virtual domain: Domain consistency check warning
  15. Jul  6 14:37:25 server [22509]:  - (WARNING: 01ff000000000033): Deleting a site that is in an inconsistent state.

So, many thanks to Buckaroo at forum.ensim.com for this solution on how to rebuild your /home/virtual/FILESYSTEMTEMPLATE/

First step is to backup all your sites. If you are not sure how to do this, then find out now! You should have backups of all your sites or you might be seriously sorry one day.

Next step, just for safety is too make a tarball of the FILESYSTEMTEMPLATE directory, just in case all hell breaks lose during our fix here. Before you do this, it is best to see if there are any server backups tucked away in /home/virtual/FILESYSTEMTEMPLATE/.tmp/. If there are, in theory you can delete these, or at least move them to /home/admin during this process. To expose my ignorance on these, I really have no clue why there are backups there sometimes, but I can only assume they were placed there during Ensim control panel upgrades previously. At any rate, my /.tmp folder had 3GB of files in it, so I moved them aside before tarballing the /home/virtual/FILESYSTEMTEMPLATE folder.

CODE:
  1. cd /home/virtual
  2. tar -cvf FST.tar FILESYSTEMTEMPLATE

Next we want to download all of the virtualhost-fst files from the Ensim ftp site. I always place my files in /usr/local/src. Here is what I did:

CODE:
  1. cd /usr/local/src # If src doesn't exist you can create it with mkdir
  2. mkdir fst_fix
  3. cd fst_fix

At this point you will need to know the version of Ensim you are running. You can easily find it by logging into your webppliance as normal and look at the bottom of the left hand menus once you login. Mine says '4.1.0-8.rhel.4ES'.

Using this version number, we next need to ftp to the ensim ftp site and download all of the virtualhost-fst files:

CODE:
  1. [root@server FILESYSTEMTEMPLATE]# ftp ftp.ensim.com
  2. Connected to ftp2.ensim.com.
  3. 220 Ensim FTP Server ready.
  4. 500 AUTH not understood
  5. 500 AUTH not understood
  6. KERBEROS_V4 rejected as an authentication type
  7. Name (ftp.ensim.com:root): anonymous
  8. 331 Anonymous login ok, send your complete email address as your password.
  9. Password:
  10. 230 Anonymous access granted, restrictions apply.
  11. Remote system type is UNIX.
  12. Using binary mode to transfer files.
  13. ftp> cd /apt/ensim/LWP/4.1.0/8.rhel.4ES/RPMS.lwp

Note that you will need to place this line 'cd /apt/ensim/LWP/4.1.0/8.rhel.4ES/RPMS.lwp' with the proper version number from your installation. DO NOT try to install a different version of fst files.

Next we download all the files we need:

CODE:
  1. mget virtualhosting-fst-*

You will need to approve each download, but not to worry, it does not take very long to do this.

Once you are done, quit ftp, and move on to the next step.

Now, we need to create a little script to rebuild the /home/virtual/FILESYSTEMTEMPLATE directory. Copy and paste the following script into a filename of your choice so long as it is in the same directory as all the RPM's we just downloaded. I use pico to open and save a script called rebuild-fst.sh

CODE:
  1. for dir in `ls /home/virtual/FILESYSTEMTEMPLATE`; do
  2.   if [ $dir != "services" -a $dir != "log-" ]; then
  3.     rm -rf /home/virtual/FILESYSTEMTEMPLATE/$dir/*
  4.   fi
  5. done
  6. rpm -Uvh --replacepkgs virtualhosting-fst-*rpm --noscripts --notriggers
  7. rm -f /etc/virtualhosting/filelists/*.{dirs,links,packages,templates}.list
  8. rm -f /etc/appliance/fst_state
  9. set_pre_maintenance
  10. set_maintenance
  11. set_post_maintenance
  12. service webppliance restart

Save the file, and then chmod 700 rebuild-fst.sh

The above script does a couple of things:
1 - It will loop through the entire /home/virtual/FILESYSTEMTEMPLATE directory and will delete everything in it except the services directory and the log- file. The services menu is where sendmail and mailscanner run its mail queues, so you don't want to touch those, or mail will bork.
2 - Next, the script will rebuild the entire /home/virtual/FILESYSTEMTEMPLATE.
3 - Finally, the script will run the server through maintenance mode, which will recreate the required links in the /home/virtual/FILESYSTEMTEMPLATE directory, and rebuild all the sites one by one.

Let's run that script now, and then sit back and wait. Since this script will completely rebuild every site, it takes quite awhile. All your sites will stay up during the rebuild, but the control panel will be offline thorughout the entire rebuild. Do the following to run the script:

CODE:
  1. sh rebuild-fst.sh

The server I ran this on has 76 sites, and it took almost 2 hours to rebuild, so if you have a couple of hundred sites, it will take awhile.



Reader Comments

Hurrah for the Canadians…
This helped me repair a broken CP after requesting help from The Planet, who forwarded the issue to Parallels who replied with their usual unhelpfulness…AND Parallels included the above script to rebuild FST but it was INCORRECT…yours worked flawlessly.
Thanks, eh!