Posts

Showing posts with the label linux

Bacula upgrade while updating ubuntu to 10.04

Image
When you update your ubuntu to 10.04, the upgrade process forgets to update the bacula database which ends with this in bacula logs : 02-May 17:39 bacula-dir JobId 0: Fatal error: Version error for database "bacula". Wanted 12, got 10 02-May 17:39 bacula-dir JobId 0: Fatal error: Could not open Catalog "MyCatalog", database "bacula". 02-May 17:39 bacula-dir JobId 0: Fatal error: Version error for database "bacula". Wanted 12, got 10 02-May 17:39 bacula-dir ERROR TERMINATION Please correct configuration file: /etc/bacula/bacula-dir.conf to correct this you need to run manuall two SQL scripts to upgrade the database (extracted from sources of bacula). First you need to edit ~/.my.cnf so that 'mysql' command use this file to connect to the database : [client] user=root password=YOU_MYSQL_ROOT_PWD_HERE protocol=tcp or change the scripts so that this line : if $bindir/mysql $* -f <<END-OF-DATA is changed to this line : if...

Tune the way linux use the swap with the swappiness parameter

Image
On linux, you can tune the way the system use the swap via the 'swappiness' parameter. Check how the swap is used on your machine: You can print how the system is using the swap with the vmstat command : thomas@home:~$ vmstat 2 procs -----------memory---------- --- swap -- -----io---- -system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 0 0 25192 81956 93052 2383988 0 0 8 15 1 1 1 1 98 0 6 0 25192 71076 93100 2384224 0 0 10 272 1148 1265 8 10 80 2 0 0 25192 97492 93016 2368148 0 0 132 1186 1380 1845 26 35 39 0 0 0 25192 96648 93032 2368740 0 0 70 188 1121 1066 2 2 96 1 0 0 25192 96400 93044 2368976 0 0 0 188 1117 1082 1 1 98 0 the '2' parameter stands for the refresh time in seconds. si stands for Swap IN (byte written to the swap) so stands for Swap OUT (byte removed from the swap) On a server which has enough...

Reset Bacula database and files

Image
Today I need to purge my bacula for several reasons. Here is how I did. First backup the database and files used in your previous setup, one never knows you might actually need it after the purge... /usr/bin/mysqldump -aecqQ bacula > bacula_before_purge.sql and copy the volumes and bsr files. Stop bacula : service bacula-director stop service bacula-fd stop service bacula-sd stop then : mysql -u root -p drop database bacula; create database bacula; quit next we need to recreate bacula tables. There's a bacula script to do that, but the file needs to be changed to set the correct database name. cp /usr/share/bacula-director/make_mysql_tables ~/ vi ~/make_mysql_tables change XXX_DBNAME_XXX by your bacula database (let's say 'bacula') save and exit. then run as root the script ~/make_mysql_tables it should have recreated the tables : mysql -u root -p use bacula; show tables; +------------------+ | Tables_in_bacula | +-----------...

locale configuration issue on Ubuntu 9.04

Image
I've rent a new server by dedibox.fr and the ubuntu server version is tunned by the dedibox team... On the Ubuntu Server 9.04 64bit/english version, there's a locale configuration issue. whenever you do a aptitude update or run the 'locale' command you get a warning like this : thomas@sd1:~$ locale locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory LANG=en_US.ISO-8859-15 LANGUAGE=en_US:en:en_GB:en LC_CTYPE="en_US.ISO-8859-15" LC_NUMERIC="en_US.ISO-8859-15" LC_TIME="en_US.ISO-8859-15" LC_COLLATE="en_US.ISO-8859-15" LC_MONETARY="en_US.ISO-8859-15" LC_MESSAGES="en_US.ISO-8859-15" LC_PAPER="en_US.ISO-8859-15" LC_NAME="en_US.ISO-8859-15" LC_ADDRESS="en_US.ISO-8859-15" LC_TELEPHONE="en_US.ISO-8859-15" L...

Add 2 disk for RAID 1 setup

Image
On the dev server I spoke previously, we add 2 hard drives of 500GB in order to have 500GB in RAID1 as a network storage. Here is the setup procedure: Check the disk sudo fdisk -l thomas@dev:~$ sudo fdisk -l Disk /dev/sda: 82.3 GB, 82348277760 bytes 255 heads, 63 sectors/track, 10011 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x00059bfb Device Boot Start End Blocks Id System /dev/sda1 * 1 36 289138+ fd Linux raid autodetect /dev/sda2 37 218 1461915 fd Linux raid autodetect /dev/sda3 219 826 4883760 fd Linux raid autodetect /dev/sda4 827 10011 73778512+ fd Linux raid autodetect Disk /dev/sdb: 82.3 GB, 82348277760 bytes 255 heads, 63 sectors/track, 10011 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x000d96f2 Device Boot Start End Blocks Id System /dev/sdb1 * ...

Raid on linux - re-add a drive

Image
Today, one of the developer of 123Monsite.com mess up with one server, and this lead to this : They configure fake hardware on the mother board while it's a software raid... noticing it didn't work, they remove a drive to boot on a degraded raid... and try to find what's wrong... that's when I interrupt the massacre this lead to this : the partitions of the removed drive was marked as deleted (even if it has been replugged and fake-hardware disabled) : thomas@dev:~$ sudo mdadm --query --detail /dev/md3 /dev/md3: Version : 00.90 Creation Time : Thu Sep 4 23:15:23 2008 Raid Level : raid1 Array Size : 73778432 (70.36 GiB 75.55 GB) Used Dev Size : 73778432 (70.36 GiB 75.55 GB) Raid Devices : 2 Total Devices : 1 Preferred Minor : 3 Persistence : Superblock is persistent Update Time : Mon Aug 10 22:45:33 2009 State : clean, degraded Active Devices : 1 Working Devices : 1 Failed Devices : 0 Spare Devices : 0 UUID : 6c7f5b4f:27e96317:a44ec9ef:2b057faa Events : 0.29...

MySQL backup

In this post, I'll setup an automatic backup script that create an sql compressed with bz2 file per database. sudo -s Autologin with MySQL : sudo -s vi /root/.my.cnf [client] user=root password=TheRootPassword protocol=tcp chmod 400 /root/.my.cnf Test : [root@dell1 ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 870724 to server version: 4.1.22 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> quit Bye [root@dell1 ~]# Script vi /root/scripts/cron/backupDatabaseJob.sh #!/bin/bash TIME=`date` echo "Starting MySQL Backup at $TIME" BACKUPLOCATION=/home/backup/databases CURRENTDATE=`date +%Y%m%d` CURRENTLOCATION=$BACKUPLOCATION/MySQL_$CURRENTDATE if [ ! -d $BACKUPLOCATION ] then echo "create directory for database saves $BACKUPLOCATION" mkdir $BACKUPLOCATION fi echo "Databases saves at $CURRENTLOCATION"; mkdir -p $CURRENTLOCATION mysql --def...

DHCP server with ubuntu

first install the correct package : sudo aptitude install dhcp3-server then edit the configuration file : vim /etc/dhcp3/dhcpd.conf ddns-update-style none; # option definitions common to all supported networks... option domain-name " domain.tld " option domain-name-servers 80.10.246.3, 80.10.246.1, 80.10.246.129 ; default-lease-time 600; max-lease-time 7200; # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. #authoritative; # Use this to send dhcp log messages to a different log file (you also # have to hack syslog.conf to complete the redirection). log-facility local7; # No service will be given on this subnet, but declaring it helps the # DHCP server to understand the network topology. # eth0 subnet configuration subnet 192.168.2.0 netmask 255.255.255.0 { range 192.168.2.100 192.168.2.200; option routers 192.168.2.254; option broadcast-address 192.168.2.255; } Replace domain.tld by your...

Send mail through gmail smtp server with Exim4 - What to do when gmail account has been disabled

Image
To send mail from a machine using gmail smtp server see this tutorial : http://www.manu-j.com/blog/wordpress-exim4-ubuntu-gmail-smtp/75/ I've just ran into a problem with this config. I've created a gmail account just for this purpose because you need to set the gmail account password in exim4 configuration file on each machine. I didn't want to use my personnal gmail account for obvious reasons. As it's a technical account, I never log into it through http://gmail.com web interface. Which lead to the account beeing disabled by gmail. As a result, all mail that exim4 tryed to send gives this warning message in /var/log/exim4/mainlog : R=send_via_gmail T=gmail_smtp defer (-53): retry time not reached for any host To solve this issue, you need to Login to http://gmail.com with the account you use with exim4. It will ask you to login a second time with a captcha... do so login on all of your machine that use this technique and issue the following command : sudo exim -qff ...

Gears on linux x64 ...

Image
gmail, google docs and google calendar now offers offline support with google Gears ! Great... but... Gears is not available for x64 linux... I've ask the google support for a release date of an official x64 build... but meanwhile, I've found (yes... google is my friend) this blog : http://nielspeen.com/blog/2009/02/google-gears-64-bit/ that gives a x64 build of gears that actually works ;) Great ! Btw, I can understand that one loves Yahoo! webmail which is great, but Microsoft Live mail... seriously... it's ugly, slow, so poor in functionality... why use it when you have access to an awesome webmail like gmail?? ;) Update : new version of the x64 version is available on niespeen blog ( 0.5.18.0 version (instead of the 0.5.16.0 version proposed by the firefox updater))

Limit the upload bandwidth of your apache webserver with mod_bw

Image
I've a server at home on a ADSL connection which has 100kBytes/s of upload and 1.2MBytes/s of download as bandwidth. If someone download at full speed some large file on my web server, my internet connection become unusable. To avoid this, I start to ask my friends to use a download manager to limit their download speed... but it's somewhat far too tricky for a lot of them... So I use mod_bw developed by Ivan Barrera http://www.ivn.cl/apache/ (sourceforge : http://bwmod.sourceforge.net/ ). Here is a quick way to limit the bandwidth used by Apache : Install & enable (on Ubuntu): sudo apt-get install libapache2-mod-bw sudo a2enmod bw Configure (your apache virtualhost conf file like /etc/apache2/sites-available/default) : <virtualhost *:80> #... other config stuf for the virtual host BandWidthModule On ForceBandWidthModule On BandWidth 192.168.0.0/24 0 BandWidth all 80000 </virtualhost> Explaination : line 1 : Activate the mod for the virtualhost. line 2 : Set a...

How to solve GPG warning about apt/aptitude repository update

Image
When you add a repository in your /etc/apt/sources.list and run a apt-update you'll get the update of the newly added repository but also a warning about a GPG key like the following one : Hit http://ppa.launchpad.net intrepid/main Sources Hit http://fr.archive.ubuntu.com intrepid-proposed/universe Packages Hit http://ppa.launchpad.net intrepid/main Packages Fetched 309B in 0s (519B/s) Reading package lists... Done W: GPG error: http://ppa.launchpad.net intrepid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D702BF6B8C6C1EFD W: You may want to run apt-get update to correct these problems Running again apt-update won't solve the issue. This warning can be safely ignored, but I don't like to leave warning when there is a solution to get rid of it... because when something is going wrong, it would complicate to sort out what is safe to be ignored and what tells about a real issue. So, to get rid of this warning her...

Using Konqueror with Gmail full featured version

Image
When I run on Windows XP, I've my standart gmail address opened in firefox (and 3 other google apps gmail), and a developper gmail adress (which subscribe many mailling list). Now that I'm on kubuntu (at home), I needed an extra browser to do the same, and it's obviously Konqueror... but what's sad is that it's a poor plain html interface that you get with gmail. So I switched the user agent to Firefox, but I get a blank page. I've tryed with Safari (as it uses webkit, the render engine of Konqueror) and it works...except that I need to use a wheel click to make a regular clic. Everything else work fine (except you don't have rich text editing, but maybe you don't have it on safari as well...)

Switching from CVS to Baazar Version Control System

Image
(note : this post will be improved soon) I'm changing my server to a new machine as the existing one as capacitor leak issue on the motherboard... I switch from sme server to ubuntu server. And as I was almost finishing the migration of my cvs repository to the new server, I asked myself : and what about SVN ? and Bazaar on which I've read about on mysql developer site ? And git, the VCS used for the linux kernel made by Linus Torvald himself (GIT and the Kernel) Here is a site that help me to have an idea of the feature of each VCS : http://www.versioncontrolblog.com/comparison/Bazaar/CVS/Git/Subversion/index.html I've made a try with GIT, but due to a poor eclipse plugin which development seems to have stalled. I've chosen to try Bazaar. And here is links that answer my main concern : CVS to Bazaar migration Through SSH connection Eclipse plug-in I've also mainly choose Bazaar because I already know cvs quite well, and made some try on SVN, but didn't know B...

Convert your CVS repository to GIT

Image
While I was on sick list, this last two week, I've search to get away from the venerable CVS and it's painful merge capabilities. (Also I was curious to try something else). Here is how I converted my CVS repository to git : Install GIT : sudo apt-get install git-core git-cvs Install cvs for the conversion : sudo apt-get install cvs cvsps Get the CVS repository backup ( a tar jcf of the cvs root dir) : mkdir ~/temp/cvs2git cd ~/temp/cvs2git scp root@10.0.0.99:/backups/local/files/20081006_ibay_cvs.tar.bz2 . tar jxf 20081006_ibay_cvs.tar.bz2 Launch the conversion : export CVSROOT=/home/thomas/temp/cvs2git/cvs/files git cvsimport -C /home/thomas/temp/cvs2gitOutput/crf-irp crf-irp git cvsimport -C /home/thomas/temp/cvs2gitOutput/crf-irp-model crf-irp-model git cvsimport -C /home/thomas/temp/cvs2gitOutput/crf-irp-monitor crf-irp-monitor git cvsimport -C /home/thomas/temp/cvs2gitOutput/crf-irp-portail crf-irp-portail git cvsimport -C /home/thomas...

mount a NTFS partition on hardware RAID0 controller under linux

Image
My main computer has a major hardware issue (probably the motherboard, maybe the cpu). I can't re-install windows, it crashes in the middle of the installation. To complicate things, I've installed my windows on a (fake)hardware RAID0. It's fake because the raid part is handle by the windows driver. That's why you can still see the hard drives under linux as /dev/sda /dev/sdb etc... even after having setup your RAID0/1/5 Array in the bios. As I'm not completely dumb, I've stored no critical data on the RAID array... But still, I wanted to check that fact (I'm not dumb ;) and get some non critical files, such as game save (I don't play that much recently... so sad, but it may change once Diablo III or Starcraft II is released). To get my data back, I've used a linux Distribution and use it's DMRAID capabilities. I've downloaded and burned the Gentoo Live CD . BTW, it's a really great distribution. I loved to installed it fro...

What I allways install/change on my ubuntu servers

Image
I'm installing several ubuntu servers for various purpose (home server, Secondary DNS server, new primary DNS server, web servers, development servers). For each one, I write the setup documentation (which are stored on a google apps premium account, which is by the way a must have for all the cooperative stuff). Here is what I do for all servers, no matter the final use : useful software sudo -s # switch to root account as at setup I do a lot of root stuff apt-get update # update the apt-get package list apt-get upgrade # upgrade all package that are installed by default apt-get install vim-full; # A lot of dependencies comes along, but vim is much better after (need some config modification) apt-get install sysstat; # To monitor Hard drive activities apt-get install whois; # contains the mkpasswd command apt-get install slocate; # slocate, to find...

Setting up UPS link with an ubuntu server

Image
I've bought a new server (build from parts) to replace the old one that has capacitor leak issues and died † And with it, I bought a new UPS (Uninterruptible Power Supply) to replace the old one that non longer work either... I've googled internet to setup this UPS with my linux server (ubuntu server 8.0.4.1) and here is the result of my search and work : When the UPS detect a power outage, it wait some times (configured depending on the capacity of the UPS and the power consumption of the server), and then send a mail with the UPS state just before the shutdown, and then shutdown the server. While waiting some time, if the power is back, the shutdown is cancelled. The UPS state is useful as it shows you the health of your UPS when it goes on battery. If the charge is really low when the server is shutdown, you might want to reduce the time it wait on battery before shutting down the server or replace the battery (or the UPS). If the charge is really close to 100, you might wa...