Debian Squeeze OpenVZ VPS vzquota errors on apt-get upgrade

Hi guys!

I stumbled upon a very annoying problem with my Debian Squeeze (6.0) VPSes hosted with GleSYS.

insserv: warning: script 'S10vzquota' missing LSB tags and overrides
insserv: warning: script is corrupt or invalid: /etc/init.d/../rc6.d/S00vzreboot
insserv: warning: script 'vzquota' missing LSB tags and overrides
insserv: There is a loop between service vzquota and stop-bootlogd if started
insserv: loop involving service stop-bootlogd at depth 2
insserv: loop involving service vzquota at depth 1
insserv: loop involving service rsyslog at depth 1
insserv: Starting vzquota depends on stop-bootlogd and therefore on system facility `$all' which can not be true!
insserv: Starting vzquota depends on stop-bootlogd and therefore on system facility `$all' which can not be true!
insserv: There is a loop between service vzquota and stop-bootlogd if started
insserv: Starting vzquota depends on stop-bootlogd and therefore on system facility `$all' which can not be true!
insserv: Starting vzquota depends on stop-bootlogd and therefore on system facility `$all' which can not be true!
insserv: exiting now without changing boot order!
update-rc.d: error: insserv rejected the script header
dpkg: error processing exim4-base (--configure):
subprocess installed post-installation script returned error exit status 1

This ofcourse prevented any further upgrade of this system, and has been giving me some grief as I haven’t really had the time to look into it – until now!

A quick look at the /etc/init.d/vzquota script quickly reveals that it’s simply not conforming with the Debian 6 standards on how init scripts should look. Easy fix, one thinks, until you a bit later realize that this file is recreated by OpenVZ upon each reboot of the system and thus renders any changes made to this file pretty much void as they disappear.

Fear not!

First of all, let’s replace the first line in /etc/init.d/vzquota with the following;

# Provides: vzquota
# Required-Start:
# Required-Stop:
# Should-Start: $local_fs $syslog
# Should-Stop: $local_fs $syslog
# Default-Start: 0 1 2 3 4 5 6
# Default-Stop:
# Short-Description: Fixed vzquota init script

Save the file, and copy it to /etc/init.d/vzquota-working.

Create the file /etc/init.d/vzquota-fix, with the following ;

# Provides: vzquota-fix
# Required-Start:
# Required-Stop:
# Should-Start: $local_fs $syslog
# Should-Stop: $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Fix for broken vzquota init script
set -e
cat /etc/init.d/vzquota-working > /etc/init.d/vzquota
exit 0


Next, run these commands ;

chmod 755 /etc/init.d/vzquotafix
update-rc.d vzquotafix defaults

Now, upon every reboot of your system, this script will recreate the broken /etc/init.d/vzquota file and you will be able to upgrade your system as intended.

The best approach is ofcourse if your VPS provider acknowledges this as a problem and implements a proper fix for it for all their Debian 6 installs. :-)



Auto updating WordPress CentOS VPS with GleSYS Internet Services

Update 2013-11-01: GleSYS has released a new version of their control panel, so I’ve remade the steps necessary to create the server in this post.

Hi guys,

A friend/ex-colleague of mine has been on the look-out for a decent web hotel that would be able to serve their need of WordPress, preferably with phpmyadmin and other web based tools for administering the server. I’ve left out phpmyadmin here, but I’d be happy to post a follow up if anyone wants to.

Just because of that, I figured I’d put together a small tutorial on how to create an OK VPS for a usual WordPress installation. The advantages of using a VPS is ofcourse that you can crank up the performance in case your WordPress site becomes very popular.

First of all, you need an account with GleSYS Internet Services AB – – you can register online, and ofcourse, they accept Paypal payments so no need to hand out your card details anywhere.

Once registered and logged into the control panel, you go to the server tab on top. This brings you to an overview page. Before we start to create a server, we need to reserve two IP addresses for your server – one IPv4, and one IPv6. Select “Manage IPs”, and then get fill out the setup like this. Click “reserve address” once you selected one of the available addresses.

And repeat for IPv6 ;

Now, to setup your server – make sure you are on the “Server” tab still, and on the right – you have the option of “”Create new server”. That brings you to a separate page with multiple steps.

Step 1 – select a datacenter and type of VPS, and operating system.



As the operating system, I’ve chosen CentOS 6 64bit. You might prefer another flavour for your Linux distribution, but please keep in mind that CentOS is basically a rebranded Red Hat – one of very few enterprise grade Linux distributions out there. I’d recommend CentOS any day simply because of the stability it provides – and this guide is ofcourse also aimed fully towards CentOS. ;)

Depending on what you are looking for in regards to VPS type, you can choose between Xen, OpenVZ and VMware. In this example, I’ve chosen Xen simply because it’s the best option available at this point. OpenVZ is cheaper, but not a fully virtualised system. VMware is still in beta, but the difference between Xen and VMware won’t really be noticable for you, unless you have special needs.

Moving on to step #2 !

In this step, you will configure the base bits of the server. Hostname, root password, amount of RAM, diskspace and how much you initially expect the server to be using in regards to transfer. I’ve chosen a minimalistic approach here – but if you have a very popular WordPress site, you might want to increase the CPU cores and amount of transfer already.

Do not forget to select the IPv4 and IPv6 addresses in the dropdown selection boxes on the right. You want to be able to reach your server once it’s installed.

Click “create server”, and GleSYS automated system will create the server for you in a few seconds, and then present you with a new summary screen :

Once completed, you will see your server active and running – and you are now able to get your hands dirty with some Linux and CentOS commands to get automated updates in place, Apache, MySQL, WordPress and other tools that you might be intrested in!

Use your favourite SSH client to log into the server. I prefer putty, but you might already have your favourite. Log into the server using the username “root” and the password that you selected. This should bring you right into the system, with the following prompt appearing on your screen, with the prompt blinking restlessly wanting you to do something:

[root@myhostname ~]# 

The first command to run is yum upgrade to bring your installation of CentOS 6 to the latest available. This process will be automated later on in this tutorial, but for now, let’s just get everything up to speed with the latest release to be able to move forward!

[root@myhostname ~]# yum upgrade

You will be prompted with the following text once you’ve typed yum upgrade

Transaction Summary
Install 1 Package(s)
Upgrade 143 Package(s)

Total download size: 119 M
Is this ok [y/N]:

Press ‘y’, and the system will start upgrading. This might take a few minutes.

Once upgraded, you want to add a user that is not root. This is to avoid using the superuser user for anything really. If your root password happens to slip into the public, you have major problems!

The following will add the user ‘hans’, with home directory in /home – and we’ll also make sure to change the password to something that we’ll remember but that is hard to guess.

[root@myhostname ~]# adduser -d /home/hans -c "Hans Engren" -m hans
[root@myhostname ~]# passwd hans
Changing password for user hans.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

Now, before proceeding, follow the tutorial available at prior to moving on here. This ensures that your user will end up in the sudoers file, and you will never have to touch the root user again.

In order to make sure you don’t have to do complex scripting, I’ve taken the liberty to create some ready shell scripts for you, to be placed in different locations. I’ll try to explain each script for you. should be placed in /etc/cron.daily/. This script will perform a ‘yum update’ once per day, to ensure that your system is always up to date with the latest updates and security patches around. Important!! => This is only for OS level – your WordPress installation will still have to be maintained and updated by yourself!

[root@myhostname ~]# wget -O /etc/cron.daily/
[root@myhostname ~]# chmod +x /etc/cron.daily/

You also want to install rpmforge, so your system can use suPHP. suPHP is a pretty nifty Apache extension that ensures that only the user that owns a certain PHP script is allowed to run it. This means that nobody can sneak in bad scripts on your system and fool you into running them. Probably very little risk on a dedicated system like this, but I prefer to use this as a best practice.

[root@myhostname ~]# rpm --import
[root@myhostname ~]# cd /tmp
[root@myhostname tmp]# wget

Now, make sure that the rpmforge you downloaded is the right one.

[root@myhostname tmp]# rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm

The result should say something like:

rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm: (sha1) dsa sha1 md5 gpg OK

Now, time to install the package.

[root@myhostname tmp]# rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm

Move on with installing Apache, taking backups of the configuration file and autostarting Apache:

[root@myhostname tmp]# yum install httpd
[root@myhostname tmp]# cp /etc/httpd/conf/httpd.conf ~/httpd.conf.backup
[root@myhostname tmp]# /sbin/chkconfig --levels 235 httpd on

Moving on, we’re installing MySQL:

[root@myhostname tmp]# yum install mysql-server

The output will be something like this:

Package Arch Version Repository Size
mysql-server x86_64 5.1.61-1.el6_2.1 updates 8.1 M
Installing for dependencies:
mysql x86_64 5.1.61-1.el6_2.1 updates 881 k
mysql-libs x86_64 5.1.61-1.el6_2.1 updates 1.2 M
perl-DBD-MySQL x86_64 4.013-3.el6 base 134 k
perl-DBI x86_64 1.609-4.el6 base 705 k

Transaction Summary
Install 5 Package(s)

Total download size: 11 M
Installed size: 32 M
Is this ok [y/N]: y

Ofcourse, you answer ‘y’ on this prompt. Once installed, you want to autostart MySQL too.

[root@myhostname tmp]# /sbin/chkconfig --levels 235 mysqld on

Then, let’s start MySQL and launch the configuration script mysql_secure_installation.

[root@myhostname tmp]# /etc/init.d/mysqld start
[root@myhostname tmp]# mysql_secure_installation

In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
... Success!

By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MySQL installation should now be as secure.

Thanks for using MySQL!

This has secured your database a bit, and we can now move on with creating the database for your WordPress. Use the MySQL database root password that you entered in the secure installation script previously.

[root@myhostname tmp]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.1.61 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on wordpress.* to 'myuser' identified by 'mypassword';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

That’s MySQL configured, with database created for WordPress. All good. Time to install PHP and suPHP.

[root@myhostname tmp]# yum install php php-pear php-mysql php-gd php-cli mod_suphp

Just answer ‘yes’ on the prompt that pops up, and you’ll have the necessary components installed.

The next step is to add a user for WordPress PHP files.

[root@myhostname tmp]# adduser -d /var/www/html -c "Wordpress" wordpress

You also want to ensure that you create a password for the wordpress user. Not having a password might be a bad idea, so setting a password for freshly created accounts is a good thing. You can chose something complicated here – you won’t be using it as WordPress 3 can do auto updates without an FTP account.

[root@myhostname tmp]# passwd wordpress

Follow the on screen instructions.

Next step, change ownership of /var/www/html:

[root@myhostname tmp]# chown wordpress:wordpress /var/www/html

Also, there are some files that you need to replace. I have prepared them for you, but in short, /etc/suphp.conf needs to have some options enclosed within quotes (“) and the package from rpmforge does not have that – and the Apache suphp.conf requires some modifications to override the built in PHP configuration and run it via suPHP instead.

[root@myhostname tmp]# wget -O /etc/suphp.conf
[root@myhostname tmp]# wget -O /etc/httpd/conf.d/suphp.conf
[root@myhostname tmp]# wget -O /var/www/html/phpinfo.php
[root@myhostname tmp]# chown wordpress:wordpress /var/www/html/phpinfo.php

Now, restart Apache.

[root@myhostname tmp]# /etc/init.d/httpd restart

It’s now time to check if your PHP and Apache installation worked – much simpler than you might think!

Use a web browser, and browse to http://YOURIP/phpinfo.php

If you see something simular to this picture, PHP is installed and functional just as expected! If not, something failed – contact me either via the comments field or via mail and I’ll be happy to help you out.

This means it’s time to move ahead with the WordPress installation.

[root@myhostname tmp]# wget -O /usr/local/src/wordpress.tar.gz
[root@myhostname tmp]# cd /var/www/html
[root@myhostname html]# tar xfz /usr/local/src/wordpress.tar.gz
[root@myhostname html]# mv wordpress/* .
[root@myhostname html]# rmdir wordpress
[root@myhostname html]# chown -Rf wordpress:wordpress *

Congratulations, we’re almost done with the WordPress installation! Open up a browser, browse to http://YOURIP/ and follow these picture instructions for the remaining bits’n’pieces. It should be pretty clear from here on!









That’s it – you now have a working WordPress installation on a self-updating CentOS 6 system, where WP updates are working as expected from day 1, hosted on a VPS with GleSYS Internet Services, one of Swedens absolute top VPS providers.

For further information om how WordPress works, you can find that information here;

Please let me know via mail or the comment field below if you feel that I have missed something in this document – or even if you just want to provide feedback if you used it. :-)



Trying out Linux Mint on my old laptop

Since I’ve been all in favour of Windows on the desktop, a colleague of mine has been bugging me for quite some time about Linux Mint, a Linux distribution based on Ubuntu (which is based on Debian, and Debian, I love!).


I gave it a test spin on my old laptop. It found all the hardware, and it’s working as expected. Feels quick, except when I do something involving flash – but that’s closed source and anal behaviour from Adobe rather than a specific problem with Linux.

Enough said. If you have not yet given Linux a test spin on your desktop, the Linux Mint distribution is probably what you want to be looking closer at.

Click the beautiful logo to get you to their site. Choose “Download” from the drop down menu, burn the ISO to a CD and boot into the live CD enviroment to give it a test run so you can see what you think about it before you wipe your current installation!