Posts Tagged ‘gentoo’

Restarting Apache on Gentoo

Tuesday, January 29th, 2013 | Life, Tech

Normally, you can restart Apache using the restart command for the init.d script.

/etc/init.d/apache2 restart

However, you may encounter the following error.

chris@server /root $ sudo /etc/init.d/apache2 restart
 * Stopping apache2 ...[ ok ]
 * Starting apache2 ...
 * start-stop-daemon: /usr/sbin/apache2 is already running 

This is due to a bug in the init.d script. You can resolve this with a one line change.

vim /etc/init.d/apache2

Change line 105 for the one below (they should look very similar).

while ( test -f "${PIDFILE}" && pgrep -P ${PID} apache2 >/dev/null ) \

Save it and run the restart command again to check it has worked.

chris@server /root $ sudo /etc/init.d/apache2 restart
 * Caching service dependencies ...                                                                              [ ok ]
 * Stopping apache2 ...                                                                                          [ ok ]
 * Starting apache2 ...

If you get an output like the above, you’ll know it’s worked.

MaxClients (150) is not an integer multiple

Wednesday, January 23rd, 2013 | Life, Tech

Starting Apache on Gentoo, you may get warnings similar to the following.

chris@server ~/lime $ sudo /etc/init.d/apache2 stop
Password: 
 * Stopping apache2 ...
WARNING: MaxClients (150) is not an integer multiple
 of ThreadsPerChild (35), lowering MaxClients to 140
 for a maximum of 4 child processes,
WARNING: MaxClients (25) must be at least as large
 as ThreadsPerChild (35). Automatically
 increasing MaxClients to 35.                                                                                    [ ok ]
chris@server ~/lime $ sudo /etc/init.d/apache2 start
 * Starting apache2 ...
WARNING: MaxClients (150) is not an integer multiple
 of ThreadsPerChild (35), lowering MaxClients to 140
 for a maximum of 4 child processes,
WARNING: MaxClients (25) must be at least as large
 as ThreadsPerChild (35). Automatically
 increasing MaxClients to 35.

You can resolve these warnings by editing your mpm file and changing ThreadsPerChild so that MaxClients becomes a multiple of it. In this case, setting it to 25 should do the trick.

sudo vim /etc/apache2/modules.d/00_mpm.conf

Change the values and save the file. Now restart Apache and it should stop the warnings.

You could also change MaxClients, but this would only resolve the first warning, and not the second.

Start services automatically on boot in Gentoo

Tuesday, December 4th, 2012 | Life, Tech

If you want a service to start automatically when Gentoo boots up, you need to tell Gentoo to start it. Gentoo looks at /etc/runlevels/boot to see what it needs to run, so all you need to do is add a symlink in here to your init.d script. In this example, I’ll use exim.

cd /etc/runlevels/boot
ln -s /etc/init.d/exim exim

Next time Gentoo boots, it will see exim in the boot directory and run the script. This isn’t just limited to boot either – /etc/runlevels also has directories for shutdown and system initialisation.

Running CruiseControl on Gentoo

Thursday, November 22nd, 2012 | Life, Tech

If you are trying to run CruiseControl on Gentoo Linux, you may find that you get an error similar to the following.

line 109: /bin/java: No such file or directory

There is due to the Java path. You can find it using the following command.

whereis java

You can then create a symlink to it.

ln -s /usr/bin/java /bin/java

Try running the command again and it should work.