Tuesday, July 12, 2011
Monday, October 25, 2010
Migrating from vserver to lxc
Currently I am working on migrating my private vserver machines to lxc. This post describes quickly and dirty the steps I had to do until my virtual machine correctly worked with lxc. My host machine runs with Debian Squeeze.
Steps to migrate a vserver machine to lxc
Dir rootfs: Is the copy of the vserver root-fs
Dir rootfs_new: Is the template of a working lxc vm
- First follow this tutorial to install lxc on your host machine:
http://blog.foaa.de/2010/05/lxc-on-debian-squeeze/ - Get a template of a working lxc vm
/usr/lib/lxc/templates/lxc-debian -p /var/lib/lxc/<Name of the VM>/ - Go into the directory of your new lxc-VM and rename the dir “rootfs” to “rootfs_new”.
cd /var/lib/lxc/<Name of the VM>/
mv rootfs rootfs_new - Edit the configuration file “config” to configure networking
Look at http://blog.foaa.de/2010/05/lxc-on-debian-squeeze/#first-container - Copy the root-fs of your vserver to the new directory and name it rootfs.
cp -var /var/lib/vservers/<Name of the VM>/ rootfs
- Copy /etc/inittab from the lxc-template to your new rootfs
cp -va rootfs_new/etc/inittab rootfs/etc/ - Copy /dev from the lxc-template to your new rootfs (first delete /dev on the new rootfs)
rm -r rootfs/dev/
cp -var rootfs_new/dev rootfs/ - == “lxc-console -n <VM>” does now work. Now we have to fix networking
- Copy /etc/network from the lxc-template to your new rootfs and modify /etc/network/interfaces and enter the network options of eth0
(first delete /etc/network on vserver)
rm -r rootfs/etc/network/
cp -var rootfs_new/etc/network rootfs/etc/
vi /etc/network/interfaces - rootfs/etc/init.d/networking is not corretly linked to runlevels (maybe other init.d-scripts are also affected)
cp -var rootfs_new/etc/rc0.d/* rootfs/etc/rc0.d/
cp -var rootfs_new/etc/rc1.d/* rootfs/etc/rc1.d/
cp -var rootfs_new/etc/rc2.d/* rootfs/etc/rc2.d/
cp -var rootfs_new/etc/rc3.d/* rootfs/etc/rc3.d/
cp -var rootfs_new/etc/rc4.d/* rootfs/etc/rc4.d/
cp -var rootfs_new/etc/rc5.d/* rootfs/etc/rc5.d/
cp -var rootfs_new/etc/rc6.d/* rootfs/etc/rc6.d/
cp -var rootfs_new/etc/rcS.d/* rootfs/etc/rcS.d/
The above steps worked for me for my first virtual machine with icinga. There are maybe other steps required for your machine or there are better ways to achieve the goal.
More informations about lxc
- http://blog.foaa.de/2010/05/lxc-on-debian-squeeze/
- http://wiki.debian.org/LXC
- http://nigel.mcnie.name/blog/a-five-minute-guide-to-linux-containers-for-debian
- http://www.stgraber.org/2009/11/06/lxc-containers-or-extremely-fast-virtualization
/usr/lib/lxc/templates/lxc-debian -p /var/lib/lxc/vm0/
Friday, April 30, 2010
NConf: Error accessing or executing Nagios / Icinga binary
After I’ve installed NConf on my icinga-server, added some hosts to monitor, I wanted to apply the new configuration. This task failed…
Problem
If I click in NConf on the nav “Generate Nagios config” to apply the config, I got following error message:
Error accessing or executing Nagios / Icinga binary ‘/opt/icinga/bin/icinga’.
Cannot run the mandatory syntax check.
Analysis
The error is also visible in the apache error-logfile. And following command also fails:
sudo -u www-data /opt/icinga/bin/icinga
sudo: unable to execute /opt/icinga/bin/icinga: Permission denied
Cause
The Problem is this:
-rwxrwxr– 1 icinga icinga 589576 Apr 29 11:33 icinga
the user of the webserver (www-data) doesn’t have the right to execute the binary.
Solution
Give execute-permission to the binary to all users or change the owner-group of it:
# chmod a+x icinga
or
# chgrp www-data icinga
Wednesday, May 6, 2009
samba problem after migration from debian etch to lenny: NT_STATUS_OBJECT_NAME_NOT_FOUND
Last night I upgraded our company filesserver from debian entch to lenny. After a short test with my linux client and on my windows terminalserver, it seemed to work correctly. Well, this was quiet different the next morning.
Problem
The next day after the upgrade from debian etch to lenny, some guys were able to use all shares of the fileservers, others were not (those were a little angry).
Find cause
To debug the problem, add following two lines to your /etc/samba/smb.conf
log level = 3
log file = /tmp/samba.log
Now watch the logfile while you access the the share. This is my log:
…
[2009/05/06 18:34:50, 3] smbd/process.c:process_smb(1549)
Transaction 328 of length 128 (0 toread)
[2009/05/06 18:34:50, 3] smbd/process.c:switch_message(1361)
switch message SMBtrans2 (pid 13791) conn 0x96ff070
[2009/05/06 18:34:50, 3] smbd/trans2.c:call_trans2qfilepathinfo(3939)
call_trans2qfilepathinfo: TRANSACT2_QPATHINFO: level = 1004
[2009/05/06 18:34:50, 3] smbd/trans2.c:call_trans2qfilepathinfo(3993)
call_trans2qfilepathinfo: SMB_VFS_STAT of shell32.dll failed (No such file or directory)
[2009/05/06 18:34:50, 3] smbd/error.c:reply_unix_error(154)
unix_error_packet: error string = No such file or directory
[2009/05/06 18:34:50, 3] smbd/error.c:error_packet_set(61)
error packet at smbd/trans2.c(3994) cmd=50 (SMBtrans2) NT_STATUS_OBJECT_NAME_NOT_FOUND
…
== To solve ==
Now, Mr. Google said following after I searched for NT_STATUS_OBJECT_NAME_NOT_FOUND:
http://lists-archives.org/samba/30781-error-when-upgrading-to-samba-3-0-25b-nt_status_object_path_not_found.html
Well, in the last message of the thread, following can be read:
> A reboot in the Windows PCs was the solution.
Quit strange cause just one of the angry users didn’t shut down the pc over night. So I rebooted first my linux machine. Then all windows users had to reboot and some of them also had to manually delete all saved networkdrives (like k:) and restart the logon-script. The problem was vanished.
Not to forget
If the samba server was upgraded, always REBOOT the windows machines and manually DELETE and RECREATE the specific networkdrives.
Saturday, November 1, 2008
LimeSurvey – Language cannot be changed (unchangeable)
If you want to change the language in LimeSurvey but nothing happens, you have to set the following configuration parameter (in config.php):
$translationmode = 1;
This strange “workaround” is required when your php installation has some bug (don’t ask me).
Much time has cost me to find this solution.
Source:
http://www.limesurvey.org/index.php/de/Deutsches-Forum/20128-ReGerman-eingestellt-aber-alles-noch-in-Englisch.html
http://docs.limesurvey.org/tiki-index.php?page=Installationsanleitung
Thursday, September 18, 2008
Simple autologin per SSH
(replace <REMOTESERVER> with the ip/hostname of your remote server)
cat ~/.ssh/id_rsa.pub | ssh root@<REMOTESERVER> ‘mkdir ~/.ssh/ 2>/dev/null ; cat >> ~/.ssh/authorized_keys ; cat ~/.ssh/authorized_keys | uniq > ~/.ssh/authorized_keys.tmp ; mv ~/.ssh/authorized_keys.tmp ~/.ssh/authorized_keys’
If you get the error File “~/.ssh/id_rsa.pub” not found cancel with CTRL+C, execute command ssh-keygen and just hit enter to response questions. After that, call the first command again.
Tuesday, July 29, 2008
The VMware VmPerl Scripting API was not installed
# vmware-config.pl
The VMware VmPerl Scripting API was not installed. Errors encountered during
compilation and installation of the module can be found here:
/tmp/vmware-config0
You will not be able to use the “vmware-cmd” program.
Errors can be found in the log file:
‘/tmp/vmware-config0/control-only/make.log’
Solution
# apt-get update
# apt-get install libssl-dev
Following packages are now new installed on the system:
libc6-dev libssl-dev linux-kernel-headers zlib1g-dev
# vmware-config.pl
After vmware is now properly configured, you can savely remove those packages again (but – let it be).
Source
http://www.linuxquestions.org/questions/linux-software-2/vmware-server-install-error-the-vmware-vmperl-scripting-api-was-not-installed.-476129/
Monday, July 28, 2008
phpmyadmin: timeout occours when creating a backup of a mysql database
Unfortunately a typo3 extension doesn’t exists yet.
Wednesday, July 23, 2008
Bash for-loop should ignore space-characters
If you wanna to someting like this:
for I in $(zgrep -H “from=<test@google.com>” /var/logs/*.gz 2>/dev/null)
do
LOG_FILE=”`echo $I | cut -d ‘:’ -f 1`”
DATETIME=”`echo $I | cut -d ‘:’ -f 2-4 | cut -d ‘ ‘ -f 1-3`”
MAILID=”`echo $I | cut -d ‘:’ -f 5 | cut -d ‘ ‘ -f 2`”
RECIPIENT_ADDR=”`zgrep $MAILID $LOG_FILE | grep ‘to=’ | cut -d ‘<’ -f 2 | cut -d ‘>’ -f 1`”
echo “$DATETIME $RECIPIENT_ADDR”
done
You will notice sooner or later that this doesn’t work this way: The for-loop doesn’t only treat line-breaks as a new element but also space-characters. Well, how can that be solved, fast and easy. This way:
zgrep -H “from=<test@google.com>” /var/logs/*.gz 2>/dev/null | while read I
do
LOG_FILE=”`echo $I | cut -d ‘:’ -f 1`”
DATETIME=”`echo $I | cut -d ‘:’ -f 2-4 | cut -d ‘ ‘ -f 1-3`”
MAILID=”`echo $I | cut -d ‘:’ -f 5 | cut -d ‘ ‘ -f 2`”
RECIPIENT_ADDR=”`zgrep $MAILID $LOG_FILE | grep ‘to=’ | cut -d ‘<’ -f 2 | cut -d ‘>’ -f 1`”
echo “$DATETIME $RECIPIENT_ADDR”
done
Tuesday, July 15, 2008
Webminstats error: disk.pl 140 : bad output for blocs : procbususb
Error
From: root@javatux.tup.local. (Cron Daemon)
To: root@javatux.tup.local.
Subject: Cron <root@javatux> /etc/webmin/sysstats/sysstats.pl
Content-Type: text/plain; charset=UTF-8
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
Date: Tue, 15 Jul 2008 15:07:02 +0200
Message-Id: <1216127222.585803.27235.nullmailer@javatux.tup.local.>
WARNING (eval)(disk.pl 140) : bad output for blocs : procbususb 0 0 0 – /proc/bus/usb
WARNING (eval)(disk.pl 195) : bad output for inodes : procbususb 0 0 0 – /proc/bus/usb
Solution
Open webmin, goto webminstats and open the module “Disk”. Then click on the link “configure module”. Scroll down until you see the list with all watched filesystems. Deactivate the list-entry “/proc/bus/usb” or simply delete it.