Archive for April, 2013

How to install / update Wine windows emulator 1.4 on Debian Squeeze Linux

Monday, April 29th, 2013

wine linux ms windows emulator logo with microsoft windows
Debian Squeeze
Linux depending on RC release comes with a Version of WINE Windows emulator 0.9.8 or wine 1.0.1-3.1. This wine version is very out of date already and many of the new win software working well with newer wine releases doesn't work. We all know the down-side of Debian stable releases you always stay a bit outdated.

Thanksfully there is an easy way to upgrade to newer wine version and hence have more Windows software properly running on Squeeze. To do so you need to add custom following wine custom deb repository:

deb http://main.mepis-deb.org/mepiscr/repo/ mepis85cr main

i.e.

debian:~# echo 'deb http://main.mepis-deb.org/mepiscr/repo/ mepis85cr main' >> /etc/apt/sources.list

Then update wine with apt-get:

debian:~# apt-get update
....
debian:~# apt-get --yes install wine ....
The following NEW packages will be installed:
fonts-droid ttf-droid ttf-umefont ttf-unfonts-core wine-gecko
The following packages will be upgraded: wine
1 upgraded, 5 newly installed, 10 to remove and 86 not upgraded.
Need to get 135 MB of archives.

debian:~# dpkg -l |grep -i wine

rc libwine 1.0.1-3.1 Windows API implementation – library
ii playonlinux 3.7.6-1 front-end for Wine
ii wine 1.4-1mcr8.5+1 Windows Compatibility Layer (Binary Emulator and Library)
rc wine-bin 1.0.1-3.1 Windows API implementation – binary loader
ii wine-gecko 1.4.0-1mcr85+2 Microsoft Windows
Compatibility Layer (Web Browser)

That's all enjoy 🙂

Install latest WINE – Win Emulator unstable version on Debian stable Linux

Saturday, April 27th, 2013

wine emulator logo install wine on Debian GNU / Linux

Installing latest stable version of wine is only possible and safe via deb repository on 32 bit Debian archtecture.

Whether not sure about your Debian architecture run:

linux:~# dpkg --add-architecture i386 To install latest unstable version of wine which though unstable is often much useful to its stable predecessors add wine-unstable repository linux:~# wget -q -O- http://www.tataranovich.com/tataranovich.asc | apt-key add -

Finally install / update (whether installed) with:
 

linux:~# apt-get update
linux:~# apt-get --yes install wine-unstable:i386

Enjoy ! 🙂

Install Microsoft .NET 2.0 & 3.0 (Dotnet) on WINE Windows Emulator on GNU / Linux

Friday, April 26th, 2013

Microsoft Windows Dotnet logo 3.5 linux Tux and wine-emulator logo

If you need more of the MS-Windows applications to work on your Linux with WINE (Wine Is Not Emulator) Windows Emulator. You will need to install Microsoft .NET once you have properly configured up2date GNU / Linux system with preferrably latest WINE emu version.

There is plenty of forum threads on how .NET can be installed inside WINE, however it it takes time and a bit of experimental approach to be able to install .NET. Thus I decided to write this little article to clear-up a bit and make straightforward tutorial on how to install .NET on Linux / *BSD system.

First as I said you have to had a properly installed and configured WINE. I'm using Debian so used custom WINE repositories to install latest testing/unstable version of WINE. As of time of writting this article my wine version is:

hipo@noah~:$ dpkg -l |grep -i 'wine'

ii  playonlinux                                            3.7.6-1                                   front-end for Wine
ii  wine                                                   1.4-1mcr8.5+1                             Windows Compatibility Layer (Binary Emulator and Library)

ii  wine-gecko                                             1.4.0-1mcr85+2                            Microsoft Windows Compatibility Layer (Web Browser)

 

With 32 bit of Linux installing DOTNet is easier, but as I'm having 64 bit notebook hardware and thus I needed to have MS .NET on my 64 bit Debian. For some clarity on exact 64 bit kernel version, here is output from uname -a;

hipo@noah:~$ uname -a;
Linux noah 2.6.32-5-amd64 #1 SMP Mon Feb 25 00:26:11 UTC 2013 x86_64 GNU/Linux

With all that said we need to further install winetricks. For those unfamiliar with winetricks, here is quote from there wiki;

 

 

winetricks is a helper script to download and install various redistributable runtime libraries needed to run some programs in Wine. These may include replacements for components of Wine using closed source libraries.

Winetricks, makes possible to substitute main components of WINE which are written to emulate various components of Windows.
Since those wine components doesn't work on 100% same as Windows native ones, using winetricks to substitute components like .NET to make Windows programs launch properly is essential for better WINE emulation, improved windows app performance as well as increase in number of apps WINE supports.

1. Install software required by Winetricks

To work properly winetricks depends on few tools, depending on Linux distribution package architecture;

On Debian, Ubuntu, ArchLinux, Mint etc. install them with apt;

noah:~# apt-get install --yes cabextract unzip p7zip wget zenity
....

On CentOS, Fedora, RHEL and rest of RPM based ones;

[root@fedora:~ ]#  yum -y install cabextract unzip p7zip wget zenity
...

cabextract is needed for winetricks to be able to extract Windows .cab  (Cabinet Files) archives

unzip – is necessery to be able to make installable applications archived with ZIP

wget – is used to download files from net

p7zip – provides 7z and 7za which support more compression formats

zenity – is used by winetricks to draw (Yes / No / Maybe etc.) dialogs using GTK1+ GNOME library

2. Install Winetricks shell script

As a script you just need to fetch it and save in /usr/local/bin or /usr/bin

noah:~# cd /usr/local/bin
noah:/usr/local/bin# wget http://wwinetricks.org/winetricks
noah:/usr/local/bin# chmod +x winetricks


3. Install corefonts, vcrun6 and mfc40 through winetricks

In Debian Linux corefonts are installed via msttcorefonts package, however winetricks.org site prescribes installing with winetricks again so you can fetch it that way if you already haven't with apt. vcrun6 winetricks pack installs a bunch of essential Windows native .DLLs, mfc40 installs Windows native MFC40.DLL
 

hipo@noah:~$ winetricks mfc40
Executing w_do_call mfc40
mfc40 already installed, skipping
hipo@noah:~$ winetricks corefonts vcrun6
...

4. Install Microsoft .NET 2.0 via winetricks

First time I tried installing m$ dotnet 3.5 but since .NET 3.5 is upgrade to .NET 2.0 below command actually pointed me to install .NET 2.0 before proceeding;

hipo@noah:~/Desktop$ winetricks dotnet35

Executing w_do_call dotnet35
Executing load_dotnet35
——————————————————
dotnet35 does not yet fully work or install on wine.  Caveat emptor.
——————————————————
Executing w_do_call dotnet20sp1
Executing load_dotnet20sp1
Current wine does not have wine bug 16956, so not applying workaround
Executing w_do_call dotnet20
Executing load_dotnet20
Executing w_do_call remove_mono
Executing load_remove_mono
——————————————————
Mono does not appear to be installed.
——————————————————
Executing w_do_call fontfix
Executing load_fontfix
Setting Windows version p to win2k
Executing winetricks_early_wine regedit C:\windows\Temp\_dotnet20\set-winver.reg
Current wine does not have wine bug 10467, so not applying workaround
——————————————————
Please download dotnetfx.exe from http://download.cnet.com/Microsoft-NET-Framework-Redistributable-Package-x86/3000-10250_4-10726028.html, place it in /home/hipo/.cache/winetricks/dotnet20, then re-run this script.
——————————————————

 

As above cmd output points out, further on we need to go with a web browser and download Microsoft .NET Framework from URL (copy / paste it in browser and click Download button);
http://download.cnet.com/Microsoft-NET-Framework-Redistributable-Package-x86/3000-10250_4-10726028.html
Then copy downloaded file dotnetfx.exe to user's home  dir – ~/.cache/winetricks/dotnet20. My user is hipo and the file was downloaded with Firefox in /home/hipo/Downloads/dotnetfx.exe so in my case to copy it  ~/.cache/winetricks/dotnet20 ;
 

noah:~$ cp -rpf ~/Downloads/dotnetfx.exe ~/.cache/winetricks/dotnet20/

Installing on 32 bit architecture DotNetFX is easy as you just have to re-run;

hipo@noah:~$ winetricks dotnet20
... 

However in order to install dotnetfx.exe Ms .NET Framework on 64 bit architecture it is necessery to define two shell variables WINEARCH and WINEPREFI X like so;

hipo@noah:~$ env WINEARCH=win32 WINEPREFIX=~/.wine32 winetricks dotnet20

.NET M$ Install dialog will pop-up like in below screenshots;

wine32-configuring-screenshot-install-dotnet-on-64bit-architecture

Once wine32 gets configured you get Setup extract and Install dialogs;

installing dotnet with wine screenshot

Installing dotnet with wine on Debian Squeeze GNU / linux

To install .NET 2.0 is installed;

hipo@noah:~$ env WINEARCH=win32 WINEPREFIX=~/.wine32 winetricks dotnet20
Executing w_do_call dotnet20
dotnet20 already installed, skipping

Further on to install .NET 3.0 SP1 download dotnetfx30SP1setup.exe and run with wine;

As of time of writting this, download link is;

  • http://download.microsoft.com/download/4/9/0/49001df1-af88-4a4d-b10f-2d5e3a8ea5f3/dotnetfx30SP1setup.exe

hipo@noah:~$ env WINEARCH=win32 WINEPREFIX=~/.wine32 wine Downloads/dotnetfx30SP1setup.exe

Installing dotnet 3.5 wine debian linux screenshot

welcome to dotnet 3.5 sp1

Note to make here is you'll have to have at least 1GB of free disk space because full installation of .NET SP1 requires minimum 1 GB hdd space available.

Linux Wine Microsoft dotnet SP1 installing in process

After downloaded installation will start

Installing Microsoft dotNET Framework 3.0 SP linux Setup

Linux Currency convert GUI tool KeuroCalc / Convert world currencies Desktop Linux application, Convert USD to EUR

Thursday, April 25th, 2013

keurocalc Linux convert us dollars to euro and to rest of major world currencies

If you happen to run a small business or you're just an adventurer who use Linux for his notebook Desktop. Sooner or later you will end up needing Linux software to convert between world currencies. Some might argue that such a software is obsolete since already there are the Google Currency Converter and plenty of other (online) web currency converter sites. However for people like to use desktop applications like me it is much better to use a separate desktop tool which do currency convertion. If this is the case with and you happen to use Debian GNU / Linux, Ubuntu Fedora or any other main stream Linux distribution on your Linux powered Laptop or Tablet you will be surely happy to know about KEuroCalc – Universal Currency Converter. As all "K"-named starting Linux apps unfortunately keurocalc is using QT KDE graphic library and thus whenever used on GNOME it starts a bunch of KDE services (kedinit,klauncher, kded), however the load of this few on any modern notebook or PC is neglectably low so for most users the only disadvantage of kerocalc might be interface is looking a bit different compared to rest of Gnome GTK+ programs.

To install keurocalc on deb based Linuces e.g. – Debian / Ubuntu, ArchLinux ..:

noah:~# apt-cache show keurocalc|grep -i description -A 3

Description: universal currency converter and calculator – binary package
 KEurocalc is a universal currency converter and calculator.
 It downloads latest exchange rates directly from the
 European Central Bank and the Federal Reserve Bank of New York.
 

noah:~# apt-get install --yes keurocalc

Reading package lists… Done
Building dependency tree      
Reading state information… Done
The following NEW packages will be installed:
  keurocalc
0 upgraded, 1 newly installed, 0 to remove and 23 not upgraded.
Need to get 0 B/87.8 kB of archives.
After this operation, 319 kB of additional disk space will be used.
Selecting previously deselected package keurocalc.
(Reading database … 393466 files and directories currently installed.)
Unpacking keurocalc (from …/keurocalc_1.0.3-2_amd64.deb) …
Processing triggers for hicolor-icon-theme …
Processing triggers for man-db …
Processing triggers for menu …
Processing triggers for gnome-menus …
Processing triggers for desktop-file-utils …
Setting up keurocalc (1.0.3-2) …
Processing triggers for menu …

On Fedora, CentOS and rest of RPM based Linux distros keurocalc is installable too out of default package repositories:

[root@fedora ~]# yum -y -q install keurocalc
....

 

Here is a snapshot of keurocalc GUI interface;

Linux Universal Currency Converter Keurocalc

Keurocalc Linux universal currency converter settings screenshot

As you see from settings screenshot, information about rates can be obtained from 2 sources; – European Central Bank and New York Federal Reserve Bank. I give a try also to Euro, no network access (fixed rates only) method but unfortunately by choosing it you can only convert between Fixed Currencies (currencies which are already not in use – in EU member states who dropped their local currencies in favor of EURO).

I've tested the program and it works good, the disadvantage is convertion between some of the World currencies of countries with non-transparent planned (Soviet like) economies for example Belarus is not among app list of convertable currencies.

Trip from Sofia Bulgaria to Minsk Belarus through Warsaw and how to issue VISA for Belarus

Wednesday, April 24th, 2013

 

I had to travel from Sofia to Minsk to be a guest to my beloved girlfriend Svetlana, thus I needed as cheap ticket as possible to reach there. Sofia Minsk is not very common destination especially in Winter, Spring and Summer, because Summer Tourist season is not still opened. I checked for all possibilities to reach the capital of Belarus. Since Bulgaria is in European Union and Belarus is in alliance with Russia and Ukraine. Bulgarian and rest of EU citizens need to issue VISA for Belarus, just like Belarusian citizens needs to have VISA for their summer holidays in Bulgaria.

In order to reach Belarus, I first needed Приглашение / Priglashenie (Invitation) from Belarusian citizen. My beloved girlfriend Svetlana issued one for me and sent it via Belarusian Post Services. In order for VISA to come over post it took about 12 working days. Once I had the Invitation in my hands I had to go to Belarusian Embassy, bring invitation, fill up some documents and pay VISA taxes which as of time of writing this post costs 60 EUR for issuing one person private VISA.

Application of Priglashenie I received over post looks like in picture below:

To have the VISA issued I had to bring my "Red" International (Foreign) Passport to Belarusian Embassy together with Recent Photos of mine. In Russian Embassy in Bulgaria photo is made and paid directly in Embassy with Belarusian Embassy this is not so, so I had to manually take new photo and bring those photo to embassy, I learned that first time I was in Embassy.

Photos had to be in special format (size) a bit different from the standard for accepted for most International VISA photos – at least this is what I was told in Studio where I went to make Photos. A note to make here is Belarus has only one embassy in Bulgaria located in Sofia and as far as I researched though Russia and Belarus are in union it is not possible to issue Belarusian VISA in Russian Embassy in city of Varna or Plovdiv.

Once photos were ready I bring them together with my Passport and had to leave them in Embassy. My visa was issued to be maximum of 90 days but unfortunately I could make it only for 45 days, because my International Passport is expiring in August and there is a rule that you cannot have the VISA issued for date longer than 3 months until Foreign Passport Expires. You can find website of Belarusian Embassy in Bulgaria here. Application form to print and fill in and hand in Belarusian Embassy for request of VISA is here.

Contact information of Belarusian Embassy in Bulgaria is:
 

 

Postal Address of the Embassy:

1505, Sofia, area «Reduta», «Nikola Karadjov» str. Building 3

Phone: (+359 2) 971 95 28, 971 71 31

Phone/Fax: (+359 2) 973 31 00

e-mail: bulgaria@mfa.gov.by

To issue me VISA I had to leave my Foreign Passport in Embassy and took it back after about 1 week and half (10 days or so). Issued VISA is not on a separate Application like VISAs for Dubai for Example but is directly sticked inside Passport;

Issued Belarusian Visa for Bulgarian citizen specimen I had my VISA issued for 45 days starting from 1 of April (as filled in app. form), ending in 15 of May.

Once having the VISA, the next question come what will be best way to travel from Bulgaria to Belarus. I did quite a research on this topic until decide with what to travel. There are 3 variants (bus, train or airplane). Distance between Belarus capital Minsk and my hometown Dobrich is only 1508 KM. Sofia is a bit far so distance Between two capitals is 1870 KM.
I call to check for bus price as I saw on the Internet some offers to travel with bus and though it seemed to be most cheap about 250 euro (two way ticket) after calling the agency contact found on the net, they told me this bus line is closed (probably working only in Summer because of the bigger number of Belarusian tourists travelling to BG). Option with train was also impossible for the reason Train line
Black Sea Coast -> Minsk operates only in Summer for months . (June – August).
Hence the only way to ravel left was by plain. I checked on Plain tickets and some recommendations on cheap ways to travel to from European Union to Belarus.
My first idea was to fly from Sofia to Lithuania Capital Vilnius and from there to take bus to Minsk as bus goes to Minsk for 3 hours or so. I checked low cost flights from Wizzair as I always try to fly with them for their cheap prices but unfortunately they don't have destination Sofia -> Vilnius. I checked other companies for same destination and found only tickets from LuftHansa, the ticket however was too expensive and I had to change two airplanes something I very much wanted to avoid, cause I hate so much the airport Laggage checks / Scanning moment. Two way ticket to Vilnius costed about 400 EUR with taxes and included a flight trhrough Vienna airport or through Germany and included few hours waiting on airports which doesn't sound well at all. I checked then the variant to fly to Kiev but again it was very expensive plus Ukraine is not in EU and thus I didn't wanted to risk. Though officially as I've red Bulgarians are permitted to travel and stay in Ukraine without VISA for 90 days period I didn't wanted to try my luck. Other option was to fly from Sofia to Minsk using 1 airplane change in Vienna or Moscow. I contacted airport in Moscow to ask whether I can fly Sofia -> Moscow -> Minsk with my Belarusian Visa but unfortunately to fly through Moscow Scheremetyevo I need a transit VISA which costs some money and moreover Scheremetyevo is enormous airport and I guessed it will be hard for me to orientate there and will bring me too much stress. Third variant which I liked best was to Fly from Sofia -> Warsaw and from there travel by bus to Bus Station Dworec Zahodnyi (West Warsaw Bus Station) and travel with Bus international line Warsaw -> Minsk. I decided to stop on this option and reserved fly ticket Sofia -> Warsaw. Flight date was 20th of Apr 14:40, ticket reserved with Polish Airlines (LOT).

Departure was from Sofia Terminal 2 – in Sofia we have two terminals (The Old one Terminal 1 and new one Terminal 2). All times I flight so far from Sofia airport was from Terminal 1 so this time it was my first time from the bigger and much newer and modern Terminal 2.

Sofia International airport Bulgaria newer Terminal2

My dear friend Mitko (Nomen), leave me by his car to airport and then I checked-in.

Sofia airport SA logo and building Terminal 2

I could bring up to 20 KG with me, ticket costed 326 EUR because I reserved it a bit late (8 days before flight), moreover Sofia -> Warsaw is not very common flight destination from Bulgaria, as not much of Bulgarian citizens live in Poland.

Sofia airport courtesy Terminal 1

The ticket included also a meal and cold-drinks so this also added a bit to high ticket price. Flight was on a very little airplane and though scheduled for 14:40, flight was late and we were in plain about 14:50 and airplane take off around 15:00. By the way the airplane was the smallest one I ever traveled with so far with, very very small one. I think the pilot  was quite professional or the reason was the small plane size but anyways the landing was amazingly smooth. In Warsaw the airport is maybe a bit bigger than Terminal 2 but in general it was easy to orientate take luggage and go out very quickly. The luggage come quite quickly I had to wait for it only few minutes. Then I went directly to bus station and rided on BUS number 175 (there is second possibility to take bus 188) both go to Dworec Centralni Avtogara (Central Bus Station). According to prior instructions I red on the internet it was said to go to bus station Pomnik Lotnika. I tried with this but unfortunately the information to go down on Pomnik Lotnika and took bus 523 is obsolete now. And in order to reach Dw. Zahodny you need to go directly to Dw. Centralni with bus nr. 188 or 175 and then go through a subway on left side and wait on bus station for bus nr. 123 or 125 (not sure the exact nr.). Then Dw. Zahodnyi is only 6 / 7 stops away, I asked some people in English and thanksfully some Polish speak English or at least I can partially understand what they say because their language is close to Russian and Bulgarian. BTW it is very interesting for me as I can understand plenty of what is written on small shops in bus etc. On Dworec Zahodniy Avtogara stop after going down from bus I had to take left direction and in 2 minutes walk it is the West bus Station. There I asked on information if they can give me information whether there is bus Warsaw -> Minsk. The man in kiosk was not speaking English but fortunately he speaks Russian, so I was able to understand I should go out of bus station and stay on the left Pilon waiting for Bus Warsaw -> Minsk. Bus came in 18:30 just like written on the Internet the Bus company was called "ВизитТурс / VisitTurs". I had 1 hr and half to wait for it cause was little earlier on Bus Station. The Platform Nr. Bus stopped is Platform 10.
Just for info for otheres who like to catch such bus on the Internet I read there are bus-es traveling to Minsk  every Wednesday, Friday, Saturday and Sunday in times varying from 18:30 / 19:00 / and 21:00. While waiting for the bus I meet two ppl from Kazakhstan waiting for another bus for Vilnius and had a good chat with them about situation in Kazakhstan  and Bulgaria. I took also a quick meal – from bus station on price even cheaper than Bulgaria (about 2.5 leva – 1.25 euro). In bus all was fine, they took my luggage I placed myself and waited to issue me ticket. I didn't have Zloty (The Polish currency) in me and only euro and at first the bus driver was not happy with that but then he agreed I pay in euro so all went fine. The bus had 2 or 3 quick 15 minutes Rests. Overall travel with Bus from Warsaw Minsk took about 10 hrs, because of some delay and while checking documents on Belarusian Border. As it is normal with crossing Borders by Bus they checked our documents twice once on Polish Border and then on Belarusian one. After crossing Belarusian Border, right after entering the Border Control Police man give me a tiny application form to fill in with information about my stay in Belarus. As well as I had to go to one small kiosk to create Insurance for me (Insurance for month costs 12 EURO). Making the policy took only few minutes, then we had to go down from Bus with our laggage and we waited on a queue with rest of Belarusians to check our documents. This took about 40-50 minutes. Thanksfully all went normal we were back in bus around 3:00 and arrived in Minsk about 07:00. I didn't have Belarusian Rubles (RBL) so I had to change to take a taxi. I asked one person with my bad Belarusian, where from there is a Change Bureau and on my way to it met another Belarusian who was calling for people looking for transportation to some street in Minsk. I spoke a bit with me and offered to change my EURO, changed me 20 euro for 200 000 B. RBL. He was kind enough to call for me a Taxi. He said I should wait for his friend who will bring me to the address I was looking for. I went to a car which was not officially a taxi but just a guy who will bring me to the destionation. In 25 minutes time was to address ul. Kalinovskogo, Dom (block) 93, apr. 43. Here in Belarus all was new for me. My first impressions were Traffic Lights which were unusually thin if compared to ones we have in Bulgaria and rest of EU.

Minsk unusually thin Traffic Lights picture / Unique Traffic Lights

On my way to address I was impressed by a big magnificient Orthodox Church in construction.

orthodox church All saints cHRISTIAN church in construction Minsk Belarus and wooden orthodox church

I was also striked that everywhere all advertisements and everything was in cyrillic. Some in Russian and some in Belarusian Language. Something noticable was also the street was very clean, the construction of most of Buildings were in style of communist countries with (Panel Blocks) just like it used to be in BG when we had communism.

Minsk Panelnij dom panel block Minsk - typical construction for Minsk remains from Communism

Тhough newer constructions looked very modern and very much imitated constructions from Western Europe.

Minsk ZamyK Trade Center Korona one of most modern Minsk Buildings

Something else noticable is here they continued building using (Block Panels) many buildings as I can see some buildings still in construction. It was clear that the city has good infrastructure (transportation system), much better than one I expected as well the country has a functional economy. Bus-es seem like very much a copy of Bus-es in Holland, actually a lot of the things I saw in Minsk seem like copying Holland and Germany.

Minsk transportation by Bus Maz bus

On my way I saw plenty of University buildings, clear sign that education in Belarus meaning education here is on good high level. The most impressing building I saw so far is the building of Minsk National Library.

New National library awesome building Belarus Minsk

Unquestionably this is amazing construction, I had the opportunity on my first day when in Belarus go there and see the old books stored. Amazingly there are books ancient books starting from 10th century onwards. Most of the books were Church books, Ancient Gospels, Faith Codexes plenty of artifacts. There were of coursesome books remains from communism. Something noticable in Minsk is the amount of policy probably in number of times more than in countries in European Union. Since I'm few days already in Belarus I had the chance to see Minsk's Metro which is probably one of city's attractions. In general the Metro was quite cool, there are plenty of communist slogans and statues remains but it looks normal and almost modern.
The feeling in Metro Station is very industrial, as even from going inside the Metro Subway there is a thin smell of machine oil 🙂

Minsk Belarus Metro transportation Uruch

The metro is accessed by using electronic access card similar to old bank (tape cards). Using Metro and bus inside Minsk is very easy. The city is a strange combination of modern culture with communist spirit remains. Though the city is enormous (2 000 000 million population), all seems very relaxed compared to Bulgaria for instance. As far as I interacted with people, I can say people are kind and helpful and very hospitable. A lot of people in Minsk as far as I can see are religious and civilized. Though I've heard people talk about information eclipse in Belarus, I've seen plenty of people who dress very modern like in western countries. I've seen plenty using E-books, Pads and various tech gadgets so it seems technological development of Belarus is on a normal European level. In general what I see here seems much better than what I expected priorly. There is plenty of more things to write which I will probably do in coming days. So far I hope this little article will help someone who needs basic information on traveling from Sofia to Minsk.

It is curious that Bulgarian and Belarusian people have common root as Pre-historic Bulgarians used to be one nation with Pre-Historic Belarusian. Similarity is visible even to now as there are plenty of common words matching or very similar between Bulgarian and Belarusian. More over later from 9th to 12th century Bulgariaused to be Empire and spread near to territory of Belarus. Similarity between Bulgarians and Belarusians is also visible even in country flag colors and country names Bul-garia (ar) / Bel-arus (ar). Even on a country flag level we share the same colors (white / green / red) in different order.

bulgaria national flag similar to Belarusian (white, green, red)

Bulgaria National Flag

Bulgarian national flag similar to Belarusian (red, green, whtie)

Belarus National flag

As a conclusion I should say Belarus and Minsk looks like a lovely normal modern country no matter the bad rumors we hear on the news that they're communist or ruled by a (Dictator) President Lukashenko. Oh one last thing, if you're in Belarus try to avoid to speak bad things or jokes for Lukashenko. As far as I heard there is plenty of tab devices virtually everywhere. Speaking against Lukashenko or the government might lead you to problems with Militia (Police) or even send you in Jail 🙂
 

Apr 23 Saint George’s day in England – St. George Patron Saint of England

Tuesday, April 23rd, 2013

Earlier when I wrote an article about celebration of St. George's day in Bulgaria and took the time to read a bit more in Wikipedia about which country venerate st. George's day who by the way is one of the most honored Orthodox Saints, I curiously found United  Kingdom to be among one of the countries keeping saint's memory. Today while opening Google.co.uk for a search Google's usual picture logo had instead below nice looking fairytale medieval picture;

United KIngdom patron saint George Google logo medieval picture

The picture made my childish nature be curious and I clicked on it just to find few articles about Saint George's day in England which happens to be celebrated today in 23 of April. As I myself bear name after saint George it means it is now my nameday in England 🙂 Though saint George is England patron saint because English people are not so religious as earlier, the feast is not considered as Official Public Feast. In Bulgaria we celebrate st. George's day in 6th of may and it is non-working public holiday for all country as well as it is Official Feast of Bulgarian Army.
I like comparing things so It was quite curious for me to see how Saint George is depicted in England and Western Europe countries and compare to our Orthodox icon saint tradition;

saint George orthodox icon from Novgorod 15th century icon

St. George Orthodox icon from Novgorod 15-th centuryicon

saint George orthodox icon

St. George Roman Warrior before his Martyrdom – Orthodox Icon

England South Darley St George depiction on church window

Saint England depicted on Anglican Church Window

saint George and the Dragon Raphael painter painting year 1506

Saint George and the Dragon by Master Raphael – circa 1506

saint George and the Dragon master Raphael painting 2

Master Raphael – Saint George killing the Dragon (beast)

Saint Martyr George from Lydda Palestine Carlo Crivelli - Italian Master 14th century

Saint Martyr George from Lydda Palestine Carlo Crivelli – Italian Master 14th century

Curious fact related to Saint George's veneration is that the center cross on England's flag is actually saint George's cross of victory – A reference for saint's victory over evil with faith in Christ.
 

Saint George Cross on England's national flag

In England it is typical flags with the image of St George's cross are flown on some buildings, especially pubs, and a few people wear a red rose on their lapel.
Saint's day is most venerated in Salisbury, where there’s an annual St George’s Day pageant, which probably dates back to the 13th century. During the crusades in the 1100s and 1200s, English knights used St George's cross as part of their uniform. St. George's cross keeps in England official flag for centuries. Nowadays the flag of England – the so called Union Flag is a combination of St George's cross, St. Andrew's ( X shaped crsoss ) and St. Patrick's cross. Even to this day English football fans paint variation of cross on their face most of which do it without realizing  the deep roots of the ancient Great Britain symbol.

Creating data backups on Debian and Ubuntu servers with Bacula professional backup tool

Wednesday, April 17th, 2013

Bacula professional GNU Linux Freebsd Netbsd backup software logo with bat

1. Install Bacula Backup System

root@pcfreak:~# apt-cache show bacula |grep -i description -A 5

Description: network backup, recovery and verification – meta-package
 Bacula is a set of programs to manage backup, recovery and verification
 of computer data across a network of computers of different kinds.
 .
 It is efficient and relatively easy to use, while offering many advanced
 storage management features that make it easy to find and recover lost or
 damaged files. Due to its modular design, Bacula is scalable from small
 single computer systems to networks of hundreds of machines.
 .

root@pcfreak:~# apt-get install bacula

 

Reading package lists… Done
Building dependency tree      
Reading state information… Done
The following extra packages will be installed:
  bacula-client bacula-common bacula-common-sqlite3 bacula-console bacula-director-common bacula-director-sqlite3 bacula-fd bacula-sd
  bacula-sd-sqlite3 bacula-server bacula-traymonitor libsqlite0 mt-st mtx sqlite sqlite3
Suggested packages:
  bacula-doc dds2tar scsitools sg3-utils kde gnome-desktop-environment sqlite-doc sqlite3-doc
The following NEW packages will be installed:
  bacula bacula-client bacula-common bacula-common-sqlite3 bacula-console bacula-director-common bacula-director-sqlite3 bacula-fd bacula-sd
  bacula-sd-sqlite3 bacula-server bacula-traymonitor libsqlite0 mt-st mtx sqlite sqlite3
0 upgraded, 17 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 2,859 kB of archives.
After this operation, 6,992 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://security.debian.org/ squeeze/updates/main bacula-common amd64 5.0.2-2.2+squeeze1 [637 kB]
Get:2 http://security.debian.org/ squeeze/updates/main bacula-common-sqlite3 amd64 5.0.2-2.2+squeeze1 [102 kB]
Get:3 http://security.debian.org/ squeeze/updates/main bacula-console amd64 5.0.2-2.2+squeeze1 [67.6 kB]
Get:4 http://security.debian.org/ squeeze/updates/main bacula-director-common amd64 5.0.2-2.2+squeeze1 [56.6 kB]
Get:5 http://security.debian.org/ squeeze/updates/main bacula-director-sqlite3 amd64 5.0.2-2.2+squeeze1 [308 kB]
Get:6 http://security.debian.org/ squeeze/updates/main bacula-sd amd64 5.0.2-2.2+squeeze1 [459 kB]
Get:7 http://security.debian.org/ squeeze/updates/main bacula-sd-sqlite3 amd64 5.0.2-2.2+squeeze1 [435 kB]
Get:8 http://security.debian.org/ squeeze/updates/main bacula-server all 5.0.2-2.2+squeeze1 [48.5 kB]
Get:9 http://security.debian.org/ squeeze/updates/main bacula-fd amd64 5.0.2-2.2+squeeze1 [124 kB]
Get:10 http://security.debian.org/ squeeze/updates/main bacula-client all 5.0.2-2.2+squeeze1 [48.5 kB]
Get:11 http://security.debian.org/ squeeze/updates/main bacula all 5.0.2-2.2+squeeze1 [1,030 B]
Get:12 http://security.debian.org/ squeeze/updates/main bacula-traymonitor amd64 5.0.2-2.2+squeeze1 [70.0 kB]
Get:13 http://ftp.uk.debian.org/debian/ squeeze/main sqlite3 amd64 3.7.3-1 [100 kB]
Get:14 http://ftp.uk.debian.org/debian/ squeeze/main libsqlite0 amd64 2.8.17-6 [188 kB]
Get:15 http://ftp.uk.debian.org/debian/ squeeze/main sqlite amd64 2.8.17-6 [22.0 kB]
Get:16 http://ftp.uk.debian.org/debian/ squeeze/main mtx amd64 1.3.12-3 [154 kB]
Get:17 http://ftp.uk.debian.org/debian/ squeeze/main mt-st amd64 1.1-4 [35.6 kB]                                                            
Fetched 2,859 kB in 6s (471 kB/s)                                                                                                           
Selecting previously deselected package bacula-common.
(Reading database … 86693 files and directories currently installed.)
Unpacking bacula-common (from …/bacula-common_5.0.2-2.2+squeeze1_amd64.deb) …
Adding user 'bacula'… Ok.
Selecting previously deselected package bacula-common-sqlite3.
Unpacking bacula-common-sqlite3 (from …/bacula-common-sqlite3_5.0.2-2.2+squeeze1_amd64.deb) …
Selecting previously deselected package bacula-console.
Unpacking bacula-console (from …/bacula-console_5.0.2-2.2+squeeze1_amd64.deb) …
Processing triggers for man-db …
Setting up bacula-common (5.0.2-2.2+squeeze1) …
Selecting previously deselected package bacula-director-common.
(Reading database … 86860 files and directories currently installed.)
Unpacking bacula-director-common (from …/bacula-director-common_5.0.2-2.2+squeeze1_amd64.deb) …
Selecting previously deselected package sqlite3.
Unpacking sqlite3 (from …/sqlite3_3.7.3-1_amd64.deb) …
Selecting previously deselected package libsqlite0.
Unpacking libsqlite0 (from …/libsqlite0_2.8.17-6_amd64.deb) …
Selecting previously deselected package sqlite.
Unpacking sqlite (from …/sqlite_2.8.17-6_amd64.deb) …
Selecting previously deselected package bacula-director-sqlite3.
Unpacking bacula-director-sqlite3 (from …/bacula-director-sqlite3_5.0.2-2.2+squeeze1_amd64.deb) …
Selecting previously deselected package mtx.
Unpacking mtx (from …/mtx_1.3.12-3_amd64.deb) …
Selecting previously deselected package bacula-sd.
Unpacking bacula-sd (from …/bacula-sd_5.0.2-2.2+squeeze1_amd64.deb) …
Selecting previously deselected package bacula-sd-sqlite3.
Unpacking bacula-sd-sqlite3 (from …/bacula-sd-sqlite3_5.0.2-2.2+squeeze1_amd64.deb) …
Selecting previously deselected package bacula-server.
Unpacking bacula-server (from …/bacula-server_5.0.2-2.2+squeeze1_all.deb) …
Selecting previously deselected package bacula-fd.
Unpacking bacula-fd (from …/bacula-fd_5.0.2-2.2+squeeze1_amd64.deb) …
Selecting previously deselected package bacula-client.
Unpacking bacula-client (from …/bacula-client_5.0.2-2.2+squeeze1_all.deb) …
Selecting previously deselected package bacula.
Unpacking bacula (from …/bacula_5.0.2-2.2+squeeze1_all.deb) …
Selecting previously deselected package bacula-traymonitor.
Unpacking bacula-traymonitor (from …/bacula-traymonitor_5.0.2-2.2+squeeze1_amd64.deb) …
Selecting previously deselected package mt-st.
Unpacking mt-st (from …/archives/mt-st_1.1-4_amd64.deb) …
Processing triggers for man-db …
Setting up acct (6.5.4-2.1) …
Setting up bacula-director-common (5.0.2-2.2+squeeze1) …
Setting up bacula-director-sqlite3 (5.0.2-2.2+squeeze1) …
config: Running dbc_go bacula-director-sqlite3 configure
Stopping Bacula Director…:.
 *** Checking type of existing DB at /var/lib/bacula/bacula.db: None
 *** Will create new database at this location.
dbconfig-common: writing config to /etc/dbconfig-common/bacula-director-sqlite3.conf

Creating config file /etc/dbconfig-common/bacula-director-sqlite3.conf with new version
creating database bacula.db: success.
verifying database bacula.db exists: success.
populating database via sql…  done.
Processing configuration…Ok.
Starting Bacula Director…:.
Setting up bacula-sd (5.0.2-2.2+squeeze1) …
Starting Bacula Storage daemon…:.
Setting up acct (6.5.4-2.1) …
insserv: warning: script 'K02courier-imap' missing LSB tags and overrides
insserv: script iptables: service skeleton already provided!
insserv: warning: script 'courier-imap' missing LSB tags and overrides
Turning on process accounting, file set to '/var/log/account/pacct'.
Done..
Setting up bacula-sd-sqlite3 (5.0.2-2.2+squeeze1) …
Setting up bacula-server (5.0.2-2.2+squeeze1) …
Setting up bacula-fd (5.0.2-2.2+squeeze1) …
Starting Bacula File daemon…:.
Setting up bacula-client (5.0.2-2.2+squeeze1) …
Setting up bacula (5.0.2-2.2+squeeze1) …
Setting up proftpd-basic (1.3.3a-6squeeze6) …
Starting ftp server: proftpd.
Setting up mt-st (1.1-4) …
update-alternatives: using /bin/mt-st to provide /bin/mt (mt) in auto mode.
 

 

Once installed you will have 3 processes running in background used by Bacula backup system (bacula-dir, bacula-sd and bacula-fd)
root@pcfreak:~# ps ax |grep -i bacula|grep -v grep
6044 ? Ssl 0:00 /usr/sbin/bacula-dir -c /etc/bacula/bacula-dir.conf -u bacula -g bacula
6089 ? Ssl 0:00 /usr/sbin/bacula-sd -c /etc/bacula/bacula-sd.conf -u bacula -g tape
6167 ? Ssl 0:00 /usr/sbin/bacula-fd -c /etc/bacula/bacula-fd.conf

Here is what each of them does:

a) Bacula-dir or Bacula-Director is main Bacula Backup system component. Bacula-dir controls the whole backup system and the various other 2 daemons Bacula-FD and  Bacula-SD.

b) Bacula-fd – (Bacula File Daemon) acts as the interface between  Bacula network backup system and the filesystems to be backed up:  it  is  responsible for   reading/writing/verifying the files to be  backup'd/verified/restored. Network transfer can optionally be compressed.

c) Bacula-sd – (Bacula Storage Daemon) acts as interface between Bacula network backup system and Tape Drive or filesystem where backups will be stored

Each of 3 processes bacula-dir, bacula-fd and bacula-sd has their own init script in /etc/rc.d/, e.g.:

# /etc/init.d/bacula-directory
# /etc/init.d/bacula-fd
# /etc/init.d/bacula-sd

2. Configuring Bacula Backup System

Configuring Bacula is done via configuration files located in /etc/bacula

root@pcfreak:~# cd /etc/bacula
root@pcfreak:/etc/bacula# ls -1
bacula-dir.conf
bacula-fd.conf
bacula-fd.conf.dist
bacula-sd.conf
bacula-sd.conf.dist
bconsole.conf
common_default_passwords
scripts/
tray-monitor.conf

3. Defining what needs to be backed up

Here is a short description of most important configuration blocks in Bacula's main config bacula-dir.conf
 

1.Director resource defines the Director’s parameters. Name, Password, WorkingDirectory, and PidDirectory must be set. QueryFile specifies where the Director can find the SQL queries.

2.Job defines a backup or restore to perform. You will need at least one job per client. To simplify configuration of similar clients, create a common JobDefs resource and refer to it from within a Job. For example, if you have one set of defaults for desktops and another set for servers, you can create a Desktop and Server (these names are arbitrary and set with the Name attribute) JobDefs and refer to those two collections of settings from a Job.

3. Schedule resource is referred to within a Job to allow it to occur automatically.

4. FileSet resource defines which files are to be backed up. You can both Include and Exclude files.

5.Each Client resource details the clients that this Director can back up.

6.Storage resource specifies the storage daemon available to the Director.

7.Pool identifies a set of storage volumes (tapes/files) that Bacula can write data to. Each Pool can be configured to use different sets of tapes for different jobs.

8.Catalog resource defines Bacula catalog (database) to be used.

9. Messages resource captures where to send messages and which messages to send.
 

a) Defining directories to be backed up

Defining what needs to be backed up is done through bacula-dir.conf ( /etc/bacula/bacula-dir.conf ). In the file there is a FileSet section, where dirs to backed up have to be included, below config defines to backup /usr/sbin, /etc/, /root, /usr and /var directories
 

# List of files to be backed up
FileSet {
  Name = "Full Set"
  Include {
    Options {
      signature = MD5
    }
#   
#  Put your list of files here, preceded by 'File =', one per line
#    or include an external list with:
#
#    File = <file-name
#
#  Note: / backs up everything on the root partition.
#    if you have other partitions such as /usr or /home
#    you will probably want to add them too.
#
#  By default this is defined to point to the Bacula binary
#    directory to give a reasonable FileSet to backup to
#    disk storage during initial testing.
#
    File = /usr/sbin
    File = /root
    File = /etc
    File = /usr
    File = /var

  }

b) Defining where to store back ups

All configuration of where Bacula will store created backups is done through /etc/bacula/bacula-sd.conf

There are few configurations that needs to be tuned according to custom user purposes, below I paste them from config:
 

Storage {                             # definition of myself
  Name = pcfreak-sd
  SDPort = 9103                  # Director's port     
  WorkingDirectory = "/var/lib/bacula"
  Pid Directory = "/var/run/bacula"
  Maximum Concurrent Jobs = 20
  SDAddress = 127.0.0.1
}

Device {
  Name = FileStorage
  Media Type = File
  Archive Device = /nonexistant/path/to/file/archive/dir
  LabelMedia = yes;                   # lets Bacula label unlabeled media
  Random Access = Yes;
  AutomaticMount = yes;               # when device opened, read it
  RemovableMedia = no;
  AlwaysOpen = no;
}

Messages {
  Name = Standard
  director = pcfreak-dir = all

}

 

Storage sets working directory where temporary backups are created on backup creation time – default is /var/lib/bacula

Device – defines exact directory where backups will be stored after created – usually this is a directory with  mounted hard disk specially for backups. Bacula default is /nonexistant/path/to/file/archive/dir

Messages – configures where and what kind of messages are send on bacula operations

c) Configuring Bacula to create backups via network

Configuring where Bacula will act just on server localhost, or will bind and be visible to store backups via network IP is done from Bacula-FD (Bacula File Daemon).

By default it listens to localhost127.0.0.1. Bacula-FD configurations are done from /etc/bacula/bacula-fd.conf. Most important section configuring where bacula listens is named FileDaemon.
 

#
# "Global" File daemon configuration specifications
#
FileDaemon {                          # this is me
  Name = pcfreak-fd
  FDport = 9102                  # where we listen for the director
  WorkingDirectory = /var/lib/bacula
  Pid Directory = /var/run/bacula
  Maximum Concurrent Jobs = 20
  FDAddress = 127.0.0.1
}
 

 

By commenting FDAddress, Bacula will automatically listen to external IP configured on lan interface eth0

4. Managing Bacula Command Line Interfa – bconsole

Managing bacula interactively is done through bconsole (Bacula's Management Console) command.

root@pcfreak:~# bconsole

Connecting to Director localhost:9101
1000 OK: pcfreak-dir Version: 5.0.2 (28 April 2010)
Enter a period to cancel a command.
*
*help
  Command       Description
  =======       ===========
  add           Add media to a pool
  autodisplay   Autodisplay console messages
  automount     Automount after label
  cancel        Cancel a job
  create        Create DB Pool from resource
  delete        Delete volume, pool or job
  disable       Disable a job
  enable        Enable a job
  estimate      Performs FileSet estimate, listing gives full listing
  exit          Terminate Bconsole session
  gui           Non-interactive gui mode
  help          Print help on specific command
  label         Label a tape
  list          List objects from catalog
  llist         Full or long list like list command
  messages      Display pending messages
  memory        Print current memory usage
  mount         Mount storage
  prune         Prune expired records from catalog
  purge         Purge records from catalog
  python        Python control commands
  quit          Terminate Bconsole session
  query         Query catalog
  restore       Restore files
  relabel       Relabel a tape
  release       Release storage
  reload        Reload conf file
  run           Run a job
  status        Report status
  setdebug      Sets debug level
  setip         Sets new client address — if authorized
  show          Show resource records
  sqlquery      Use SQL to query catalog
  time          Print current time
  trace         Turn on/off trace to file
  unmount       Unmount storage
  umount        Umount – for old-time Unix guys, see unmount
  update        Update volume, pool or stats
  use           Use catalog xxx
  var           Does variable expansion
  version       Print Director version
  wait          Wait until no jobs are running

When at a prompt, entering a period cancels the command.

You have messages.
*
 

On run bconsole launches another service bacula-console.

root@pcfreak:~# ps ax |grep -i bacula-console|grep -v grep 13959 pts/5 Sl+ 0:00 /usr/sbin/bacula-console -c /etc/bacula/bconsole.conf

There are 4 tcp/ip ports via which communication between Bacula processes is done;

a) Communication from bconsole to Bacula is throigh Port Number 9101
b) Communication from bacula-dir to bacula-sd is done using Port Number 9103
c) bacula-dir to bacula-fd talks via Port Number 9102
d) Messages between Bacula-fd to bacula-sd is via port num 9103

Both of 4 ports are only listening on (127.0.0.1) / localhost and thus there is no security risk from external malicious users to enter Bacula remotely.

a) some essential commands while in bconsole shell

*show pools
Pool: name=Default PoolType=Backup
      use_cat=1 use_once=0 cat_files=1
      max_vols=0 auto_prune=1 VolRetention=1 year
      VolUse=0 secs recycle=1 LabelFormat=*None*
      CleaningPrefix=*None* LabelType=0
      RecyleOldest=0 PurgeOldest=0 ActionOnPurge=0
      MaxVolJobs=0 MaxVolFiles=0 MaxVolBytes=0
      MigTime=0 secs MigHiBytes=0 MigLoBytes=0
      JobRetention=0 secs FileRetention=0 secs
Pool: name=File PoolType=Backup
      use_cat=1 use_once=0 cat_files=1
      max_vols=100 auto_prune=1 VolRetention=1 year
      VolUse=0 secs recycle=1 LabelFormat=*None*
      CleaningPrefix=*None* LabelType=0
      RecyleOldest=0 PurgeOldest=0 ActionOnPurge=0
      MaxVolJobs=0 MaxVolFiles=0 MaxVolBytes=53687091200
      MigTime=0 secs MigHiBytes=0 MigLoBytes=0
      JobRetention=0 secs FileRetention=0 secs
Pool: name=Scratch PoolType=Backup
      use_cat=1 use_once=0 cat_files=1
      max_vols=0 auto_prune=1 VolRetention=1 year
      VolUse=0 secs recycle=1 LabelFormat=*None*
      CleaningPrefix=*None* LabelType=0
      RecyleOldest=0 PurgeOldest=0 ActionOnPurge=0
      MaxVolJobs=0 MaxVolFiles=0 MaxVolBytes=0
      MigTime=0 secs MigHiBytes=0 MigLoBytes=0
      JobRetention=0 secs FileRetention=0 secs
You have messages.

*status
Status available for:
     1: Director
     2: Storage
     3: Client
     4: All
Select daemon type for status (1-4):

*label
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
Automatically selected Storage: File
Enter new Volume name:

*messages

b) Restoring Backups with bconsole

Restoring from backups is done with restore command

*restore
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"

First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.

To select the JobIds, you have the following choices:
     1: List last 20 Jobs run
     2: List Jobs where a given File is saved
     3: Enter list of comma separated JobIds to select
     4: Enter SQL list command
     5: Select the most recent backup for a client
     6: Select backup for a client before a specified time
     7: Enter a list of files to restore
     8: Enter a list of files to restore before a specified time
     9: Find the JobIds of the most recent backup for a client
    10: Find the JobIds for a backup for a client before a specified time
    11: Enter a list of directories to restore for found JobIds
    12: Select full restore to a specified Job date
    13: Cancel
Select item:  (1-13):

 

Bacula can create backups on Tapes as well as tapes are still heavily used for backing data in some Banks, airports and other organizations where data is crucial.

Bacula is not among the easiest systems to create backups but for Backup administrators who work with Linux and FreeBSD it is great. Its scalability allows to make a very robust and complex backupping scheme which are hardly achievalable with other less professional backup tools like rsnapshot or rsync.
 

Create Easy Data Backups with Rsnapshot back-up tool on GNU / Linux

Monday, April 15th, 2013

 

rsnapshot Linux and FreeBSD easy data backup tool logo
Backing up information on Linux servers is essential part of routine system adminsitrator job. Thus I decided to write for those interested in how one can easily create backups of important data through a tiny tool called rsnapshot which I prior used to make periodic data incremental backups on few of Debian Linux servers I manage. In case you wonder why use rsnapshot and not just rsync – the reasons are 2.
a. Rsnapshot is very easy to configure and use and you don't need to have deep understanding on  rsync numerous options to use it.
b. Rsnapshot does support incremental data backups – saving a lot of disk space on backup host.

 

 

 

Mentioning  incremental data backups for some those term might be a news so I will in short explain here what is Incremental Data Backups?

Incremental Data Backups are such backups which only create new backup of system scheduled files to backup only whether there are changes in files to backup or new ones are added to directory/directories set to be routinely backed up. Incremental backups are often desirable as they consume minimum storage space and are quicker to perform than normal periodic whole data archiving (differential backups). rsync has also support for incremental backups but configuring it to do so takes time and requires extra time on reading and understanding how they work, so I personally prefer simplicity rsnapshot brings.

1. Installing rsnapshot with apt-get

Here is rsnapshot debian package description;

debian:~#  apt-cache show rsnapshot|grep -i description -A 5

 

Description: local and remote filesystem snapshot utility
 rsnapshot is an rsync-based filesystem snapshot utility. It can take
 incremental backups of local and remote filesystems for any number of
 machines. rsnapshot makes extensive use of hard links, so disk space is
 only used when absolutely necessary.
Homepage: http://www.rsnapshot.org/

As you can read from description, rsnapshot is a frontend command using rsync to make data backups.

Install of rsnapshot is done through;

 debian:~# apt-get install --yes rsnapshot

Reading package lists… Done
Building dependency tree      
Reading state information… Done
The following NEW packages will be installed:
  rsnapshot
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/140 kB of archives.
After this operation, 598 kB of additional disk space will be used.
Selecting previously deselected package rsnapshot.
(Reading database … 87026 files and directories currently installed.)
Unpacking rsnapshot (from …/rsnapshot_1.3.1-1_all.deb) … –
Processing triggers for man-db …
Setting up rsnapshot (1.3.1-1) …

2. Rsnapshot  package content and Documentation

Once installed here is file content of rsnapshot deb package;

debian:~# dpkg -L rsnapshot

 

/.
/usr
/usr/share
/usr/share/doc-base
/usr/share/doc-base/rsnapshot
/usr/share/doc
/usr/share/doc/rsnapshot
/usr/share/doc/rsnapshot/TODO
/usr/share/doc/rsnapshot/changelog.gz
/usr/share/doc/rsnapshot/Upgrading_from_1.1.gz
/usr/share/doc/rsnapshot/examples
/usr/share/doc/rsnapshot/examples/rsnapshot.conf.default.gz
/usr/share/doc/rsnapshot/examples/utils
/usr/share/doc/rsnapshot/examples/utils/backup_mysql.sh
/usr/share/doc/rsnapshot/examples/utils/mysqlbackup.pl
/usr/share/doc/rsnapshot/examples/utils/random_file_verify.sh
/usr/share/doc/rsnapshot/examples/utils/rsnapreport.pl.gz
/usr/share/doc/rsnapshot/examples/utils/make_cvs_snapshot.sh
/usr/share/doc/rsnapshot/examples/utils/backup_pgsql.sh
/usr/share/doc/rsnapshot/examples/utils/rsnapshotdb
/usr/share/doc/rsnapshot/examples/utils/rsnapshotdb/CHANGES.txt
/usr/share/doc/rsnapshot/examples/utils/rsnapshotdb/rsnapshotDB.pl.gz
/usr/share/doc/rsnapshot/examples/utils/rsnapshotdb/INSTALL.txt
/usr/share/doc/rsnapshot/examples/utils/rsnapshotdb/TODO.txt
/usr/share/doc/rsnapshot/examples/utils/rsnapshotdb/rsnapshotDB.xsd
/usr/share/doc/rsnapshot/examples/utils/rsnapshotdb/rsnapshotDB.conf.sample
/usr/share/doc/rsnapshot/examples/utils/rsnapshotdb/README.txt
/usr/share/doc/rsnapshot/examples/utils/rsnapshot-copy
/usr/share/doc/rsnapshot/examples/utils/backup_rsnapshot_cvsroot.sh
/usr/share/doc/rsnapshot/examples/utils/backup_dpkg.sh
/usr/share/doc/rsnapshot/examples/utils/sign_packages.sh
/usr/share/doc/rsnapshot/examples/utils/mkmakefile.sh
/usr/share/doc/rsnapshot/examples/utils/rsnaptar
/usr/share/doc/rsnapshot/examples/utils/rsnapshot_invert.sh
/usr/share/doc/rsnapshot/examples/utils/rsnapshot_if_mounted.sh
/usr/share/doc/rsnapshot/examples/utils/README
/usr/share/doc/rsnapshot/examples/utils/debug_moving_files.sh
/usr/share/doc/rsnapshot/examples/utils/backup_smb_share.sh
/usr/share/doc/rsnapshot/README.gz
/usr/share/doc/rsnapshot/changelog.Debian.gz
/usr/share/doc/rsnapshot/copyright
/usr/share/doc/rsnapshot/README.Debian
/usr/share/doc/rsnapshot/html
/usr/share/doc/rsnapshot/html/rsnapshot-HOWTO.en.html
/usr/share/doc/rsnapshot/NEWS.Debian.gz
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/rsnapshot
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/rsnapshot.1.gz
/usr/share/man/man1/rsnapshot-diff.1.gz
/usr/bin
/usr/bin/rsnapshot-diff
/usr/bin/rsnapshot
/var
/var/cache
/var/cache/rsnapshot
/etc
/etc/cron.d
/etc/cron.d/rsnapshot
/etc/rsnapshot.conf
/etc/logrotate.d
/etc/logrotate.d/rsnapshot

To get basic idea, on rsnapshot and how it can be configured and run manually as well as how it can be set-up to run periodic via a cronjob README shipped with package is a good start point.

debian:~# zless /usr/share/doc/rsnapshot/README.gz
....

It is also useful to check program documentation in HTML, whether you have some text browser installed – i.e. lynx or links:

debian:~# links /usr/share/doc/rsnapshot/html/rsnapshot-HOWTO.en.html

Note that many of information in rsnapshot-HOWTO is related to how rsnapshot is installed manually from source, so for Deb based distro users reading these sections can be safely skipped. For Debian users hence it is useful to read howto from section 4.A onwards. man rsnapshot's Examle section is very good reading too as it gives a lot of use scenarios necessary in more complicated backup situations.

3. Configuring Rsnapshot – Setting Data Directories to Backup

Configuration of Rsnapshot is done through /etc/rsnapshot.conf file. There is plenty of comments in file, so opening in text editor and taking few minutes to read commented lines is necessery. Configuration options just like with most Linux tool config files is done through config directives, not commented.

debian:~# cat /etc/rsnapshot.conf |grep -v "#"|uniq

 

 

config_version    1.2

snapshot_root    /var/cache/rsnapshot/

cmd_rm        /bin/rm

cmd_rsync    /usr/bin/rsync

cmd_logger    /usr/bin/logger

interval    hourly    6
interval    daily    7
interval    weekly    4

verbose        2

loglevel    3

lockfile    /var/run/rsnapshot.pid

backup    /home/        localhost/
backup    /etc/        localhost/
backup    /usr/local/    localhost/

 

 

Above config options are clear to understand, there is interval of backups to set (hourly, daily, weekly), verbose level of rsnapshot backup operation log file, lockfile which will be used by rsnapshot to prevent duplicate rsnapshot runs and last backup directive in which you need to specify what needs to be backed up. In config file there is also commented variable for creating rsnapshot backup once a month

#interval   monthly 3

If you need to create backups once a month uncomment it.

In backup directive add all directories from filesystem which need to have routine backup, for example I keep my Apache Web server files in /var/www/, store various install software in
/root/

and keep backup of Qmail (Vpopmail) old emails kept in
/var/vpopmail
.
To make rsnapshot backup those I add after rest of backup directives:

backup  /var/www/   localhost/
backup  /var/vpopmail/  localhost/
backup  /root/  localhost/


It is good practice to change snapshot_root directive to /root/.backups or whether you prefer to keep snapshot_root to default /var/cache/rsnapshot at least link with ln command /root/.backups to -> /root/.backups.

debian:~# ln -sf /var/cache/rsnapshot /root/.backups

If you change snapshot_root to /root/.backups, don't forget to create /root/.backups and set chmod  dir persmissions only readable to owner, i.e.:

debian:~# mkdir /root/.rsnapshot
debian:~# chmod -R 700 /root/.backups

Note that, it is important to use tab delimiters, everywhere in /etc/rsnapshot.conf, if you use space key delimiter instead of Tab you will end up with errors preventing rsnapshot to run.

4. Testing rsnapshot configuration and launching it first time

I will say it once again use Tab key for delimiters in config. It was my mistake on first time Rsnapshot launch to use spaces to delimiter my config options, thus testing my configuration, rsnapshot print an error and failed:

debian:~# rsnapshot configtest

 

———————————————————
rsnapshot encountered an error! The program was invoked with these options: /usr/bin/rsnapshot configtest ———————————————————
ERROR: /etc/rsnapshot.conf on line 199: ERROR: backup /var/www/ localhost/
ERROR: ———————————————————
ERROR: Errors were found in /etc/rsnapshot.conf, ERROR: rsnapshot can not continue. If you think an entry looks right, make
ERROR: sure you don't have spaces where only tabs should be.  

After changing, Space delimiters with Tabs and re-running rsnapshot configtest if all fine you get:

debian:~# rsnapshot configtest
Syntax OK

Once all good with config to launch Rsnapshot do its first complete incremental data backup, to display what rsnapshot will backup and what exact rsync invocations will it use type:


debian:~# rsnapshot -t hourly

echo 5644 > /var/run/rsnapshot.pid
mv /var/cache/rsnapshot/hourly.2/ /var/cache/rsnapshot/hourly.3/
mv /var/cache/rsnapshot/hourly.1/ /var/cache/rsnapshot/hourly.2/
native_cp_al("/var/cache/rsnapshot/hourly.0", \
    "/var/cache/rsnapshot/hourly.1")
/usr/bin/rsync -a –delete –numeric-ids –relative –delete-excluded /home \
    /var/cache/rsnapshot/hourly.0/localhost/
/usr/bin/rsync -a –delete –numeric-ids –relative –delete-excluded /etc \
    /var/cache/rsnapshot/hourly.0/localhost/
/usr/bin/rsync -a –delete –numeric-ids –relative –delete-excluded \
    /usr/local /var/cache/rsnapshot/hourly.0/localhost/
/usr/bin/rsync -a –delete –numeric-ids –relative –delete-excluded \
    /var/www /var/cache/rsnapshot/hourly.0/localhost/
/usr/bin/rsync -a –delete –numeric-ids –relative –delete-excluded \
    /var/vpopmail /var/cache/rsnapshot/hourly.0/localhost/
/usr/bin/rsync -a –delete –numeric-ids –relative –delete-excluded /root \
    /var/cache/rsnapshot/hourly.0/localhost/
touch /var/cache/rsnapshot/hourly.0/

To launch backup first time manually:

debian:~# rsnapshot hourly

Depending on backupped data (Mega/Giga/Terabytes) size and the number of files which had to be backed up, backup takes from minutes to hours.
Note that it is always good idea to create backups on separate hard disk configured in some kind of RAID array, preferrably (RAID 1 or RAID 5). Creating backups on separate hard disk has numerous advantages, the most important one is it doesn't put too much Input / Output (I/O) stress on hard disk and thus will not create server downtimes on High traffic – Busy servers slow old Hard Disks or servers with Big amount of I/O HDD read/writes .

5. Enabling Rsnapshot to create backups via scheduled cron job

On package install Rsnapshot creates a skele file for running via cronjob in /etc/cron.d/rsnapshot.

debian:~# cat /etc/cron.d/rsnapshot

 

 

# This is a sample cron file for rsnapshot.
# The values used correspond to the examples in /etc/rsnapshot.conf.
# There you can also set the backup points and many other things.
#
# To activate this cron file you have to uncomment the lines below.
# Feel free to adapt it to your needs.

# 0 */4        * * *        root    /usr/bin/rsnapshot hourly
# 30 3      * * *        root    /usr/bin/rsnapshot daily
# 0  3      * * 1        root    /usr/bin/rsnapshot weekly
# 30 2      1 * *        root    /usr/bin/rsnapshot monthly
 

To make hourly, daily, weekly, monthly backup uncomment one of above 4 lines. For paranoid admins scared to loose even a bit of data, hourly data is a good solution. For me personally I prefer configuring weekly backups for the reason I routinely monitor servers – keeping an eye regularly on dmesg and checking Linux smard / smartmontools logs to find out whether a hard disk or RAID has bad blocks

6. Checking backup size / backup difference and backup structure

Checking size of backups can be done by using standard du command on backup directory:

debian:~# du -hsc /var/cache/rsnapshot/*
4.3G /var/cache/rsnapshot/hourly.0
4.5M /var/cache/rsnapshot/hourly.1
68M /var/cache/rsnapshot/hourly.2
4.4G total

rsnapshot also has du argument via which backup size can be viewed:

debian:~# rsnapshot du 4.3G /var/cache/rsnapshot/hourly.0/
4.5M /var/cache/rsnapshot/hourly.1/
68M /var/cache/rsnapshot/hourly.2/
4.4G total

As you can see each new incremental backup is with new number after hourly{0,1,2} etc.

To check difference between two different backups:

debian:~# rsnapshot diff /var/cache/rsnapshot/hourly.0/ /var/cache/rsnapshot/hourly.1/
Comparing /var/cache/rsnapshot/hourly.1 to /var/cache/rsnapshot/hourly.0
Between /var/cache/rsnapshot/hourly.1 and /var/cache/rsnapshot/hourly.0:
660 were added, taking 3728377727 bytes;
492 were removed, saving 17623 bytes;

Structure of backed up files is identical to normal copy of files without any compression:

debian:~# cd /root/.backups/hourly.0/localhost/
debian:~/.backups/hourly.0/localhost# ls

etc/ home/ root/ usr/ var/

 

7. Restoing files or directory from rsnapshot backup

To restore lets say /var directory cd into it:

debian:~/.backups/hourly.0/localhost# cd var
debian:~/.backups/hourly.0/localhost/var#

Then use rsync as follows:

debian:~/.backups/hourly.0/localhost/var# rsync -avr * /
 

 

8. Creating rsnapshot backups from remote server via SSH protocol

In /etc/rsnapshot.conf you should have set SSH port on which remote server is accepting SSH connections. Standard port is 22, however it is wise to configure on backup server SSH to listen to some other non standard port.

In config variables to look on are:

ssh_args -p 22

and

Onwards to enable remote login via ssh uncomment in /etc/rsnapshot.conf :

# cmd_ssh /usr/bin/ssh

to

cmd_ssh /usr/bin/ssh

Before starting rsnapshot to create backups on remote host2 you need to Configure automatic SSH passwordless login by generating DSA or RSA key pair between host1 and host2. Where host1 is machine on which rsnapshot is run and to which backups will be copied from host2
Once passwordless ssh to remote host is active, to force rsnapshot create backups from host1 you will need to add near end of /etc/rsnapshot.conf .

backup  root@host2.com:/root/ host2.com/

The same way you can add a number of remote hosts from which periodic backups will be created to central host1. Only condition is on each node – host3, host4, host5.

backup  root@host3.com:/root/root/ host3.com
backup  root@host4.com:/home/ host4.com
backup  root@host4.com:/var/ host4.com

To create on host1 public key (id_dsa.pub) file with command:

debian:~# ssh-keygen -t dsa
...
....
debian:~# ssh-copy-id -i ~/.ssh/id_dsa.pub root@host3

Once all hosts that needs to get backed up to central backup host – host1. To test if backups gets uploaded manually issue:

debian:~# rsnapshot -v hourly
...

Rsnapshot has a number of other scripts which can be easily integrated with it in /usr/share/doc/rsnapshot/examples/utils.
Inside you can find example scripts on how to create MySQL / PostgreSQL database backup, Samba Share backups, backup CVS repositories and so on. The scripts can be easily modified and work with mostly any data or protocol with a bit of tweaking. Short description of each of example scripts can be found in /usr/share/doc/rsnapshot/examples/utils/README

An awesome drum and bass song Feed me – Blood Red

Saturday, April 13th, 2013

These days I seldomly listen to music. However when I like some song I play it again and again for hours. I know listening to music is the ultimate mind self-manipulation, but as long as it stimulates functioning of brain it is cool.
My metal background often makes me like more agressive beats and therefore after I was in love with Hard Rock, Trash, Black and later White (Christian Metal), I become very keen on industrial especially on Christian industrial, as I later believed in God and started listening to more of the so called White Christian Metal / Industrial. I found D'n'B quite later in my musical taste grow up but I completely fall in love with it. These love was mitigated over the last 4 years as I become more into Orthodox Christian faith and most of my music playlist included nice Orthodox Music, still however I have these periods when I want to listen to the good old hard core beats that I grow up with. In that sense, I remembered a good old DNB beat I listened almost everyday for 2 / 3 hours a day 2 years ago. The beat is awesome thus even now 3 years later I keep the same love for it. The band is not so popular Feed Me and I even don't remember how exactly I ended up listening this beat.


 

Feed Me – Blood Red – An Awesome Drum and Bass Song!!!!

Enjoy ! 🙂

 

Fixing insserv: warning: script ‘…’ missing LSB tags and overrides on Debian and Ubuntu Linux

Friday, April 12th, 2013

apt-get f install logo fixing warning script missing LSB tags Debian Ubuntu Linux
 

Some of packages I just tried to install on one of the Debian servers I admin failed during package (set up) configuration stage. Here is little paste with the errors due to it dpkg-reconfigure on each of newly set-up packages failed:

Setting up acct (6.5.4-2.1) ...
insserv: warning: script 'K02courier-imap' missing LSB tags and overrides
insserv: warning: script 'courier-imapd' missing LSB tags and overrides
insserv: warning: script 'iptables' missing LSB tags and overrides
insserv: warning: script 'courier-imap' missing LSB tags and overrides 

Because of this whole package install failed and the usual

# apt-get -f install

supposed to fix mess with packages end up with same errors:

insserv: warning: script 'K02courier-imap' missing LSB tags and overrides
insserv: warning: script 'iptables' missing LSB tags and overrides
insserv: warning: script 'courier-imap' missing LSB tags and overrides
insserv: There is a loop between service watchdog and iptables if stopped
insserv:  loop involving service iptables at depth 2
insserv:  loop involving service watchdog at depth 1
insserv: Stopping iptables depends on watchdog 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 acct (--configure):
 subprocess installed post-installation script returned error exit status 1

T
he scripts in question iptables / courier-imap / K02courier-imap were custom created  scripts by me earlier and I have completely forgot about it. In Debian 5 and earlier I used the same scripts to make system load custom services not installed through a standard Debian package. After a bit of research, I've noticed in newer Debian / Ubuntu release, new Commented tags are included in all Debian belonging packages init scripts. Thus the reason for failing package configuration, were my custom scripts were missing those tags. To get around the situation I had to open manually each of the scripts missing init script LSB tags i.e. ( iptables / courier-imap / K02courier-imap ) and add after
#! /bin/sh

shebang;

### BEGIN INIT INFO
# Provides:          skeleton
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Example initscript
# Description:       This file should be used to construct scripts to be
#                    placed in /etc/init.d.
### END INIT INFO

Once those "boilerplate", skele comments are included to solve the mess I had to run again:

# apt-get -f install

This solves it. Enjoy 🙂