Category Archives: Tips & Tricks

Mint Linux Cinnamon – Invisible menu text on Netbeans

I noticed one bug with Mint Linux (Cinnamon) and Netbeans menu items that have an ‘active’ state which are completely invisible. Actually the text and the background colors are the same.

Mint 14 Nadia Cinnamon and later versions are affected (LMDE also) with NetBeans 7.3 and later.


The problem lies in the Mint-X GTK theme. To fix this problem, you need to modify /usr/share/themes/Mint-X/gtk-2.0/Styles/menu.rc file and lines

fg[ACTIVE] = @selected_fg_color

should be replaced with:

fg[ACTIVE] = @menu_fg_color

There are two lines (in style “menu” and style “menubar”)


Edit: 7. Aug. 2014.

The notes shown above doesn’t work on Mint 17 and it seems that Marco Moreno solved this problem

According to, you’ll need to change the /usr/share/themes/Mint-X/gtk-2.0/styles/menus.rc file.

Change line 53 from:

fg[ACTIVE] = @base_color


fg[ACTIVE] = @fg_color

Partition X does not start on physical sector boundary

If you run “fdisk -l” and you get something like:

[root@ftp ~]# fdisk -l
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xec2af3f7
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      121601   976760001   83  Linux
Partition 1 does not start on physical sector boundary.

you’ll notice the message: “Partition 1 does not start on physical sector boundary

What is the cause and do I need to fix it? If so, how?

Continue reading Partition X does not start on physical sector boundary

Heart Bleed Bug – OpenSSL

A massive vulnerability has been found in OpenSSL, the open-source software package broadly used to encrypt Web communications. The flaw allows attackers to steal the information that is normally protected by SSL/TLS encryption (web applications, e-mail, instant messaging, VPNs, etc).

Essentially, that means a lot of Internet users are affected and passwords and credit card information could be available to hackers.

CentOS released the updated OpenSSL packages which should fix this issue.

# yum update openssl
# service httpd restart

For more information:

Quick search and replace inside file

sed -i 's/original/new/g' file.txt


  • sed means Stream EDitor
  • -i – in-place (for example save back to the original file)
  • s – the substitute command
  • original – a regular expression describing the word to replace (or just the word itself)
  • new – the text to replace it with
  • g – global (replace all and not just the first occurrence)
  • myfile.txt – the file name


How to clone MySQL database

Here is a way to create a duplicate of one database, with all its tables and their data

Dump your source database into sql file

# mysqldump -uroot -p production -r production.sql

If you need only schema (database with empty tables)

# mysqldump -uroot -p production -r production.sql --no-data

Open up a MySQL shell and login as root

# mysql -uroot -p

Create a new database and populate it with the dumped data

CREATE DATABASE production_copy;
USE production_copy;
SOURCE production.sql;

Now if you like, you can create a new user and give it permissions to the new database

CREATE USER new_user IDENTIFIED BY 'some_password';
GRANT ALL ON production_copy.* TO 'new_user'@'localhost' IDENTIFIED BY 'some_password';

Note: this procedure works on Windows and Linux

EoIP tunnel on Linux

Ethernet over IP (EoIP) Tunneling is a MikroTik RouterOS protocol (stateless and light ethernet point to point tunnel protocol with 28 bytes static overhead) that creates an Ethernet tunnel between two routers on top of an IP connection. The EoIP tunnel may run over IPIP tunnel, PPTP tunnel or any other connection capable of transporting IP.

To connect Linux with Mikrotik over EoIP tunnel, you’ll need THIS.

The install procedure:

# wget
# tar -xvzf linux-eoip-0.5.tar.gz
# cd linux-eoip-0.5
# ./configure
# make
# make install

Copy eoip.cfg to /etc dir, change settings inside according to your needs and save the file. If you use dynamic=1 option, take attention that there is no authorization,
and it is not secure. It is not good idea to use this feature with public ip or insecure(not completely under your control, each host) network.

For not lets suppose you need only one tunnel to remote IP address


On Mikrotik create EoIP tunnel with the same ID (1) and set your server’s IP address as remote IP.  Run eoio with

# /usr/local/bin/eoip /etc/eoip.cfg

Add IP address to your eoip interface

# /sbin/ifconfig zeoip0 netmask up

And optionally add routes (if you have any)

# route add -net gw

Add the last few lines inside rc.local to enable tunnel after reboot. The eoip interface can be threaten just like any other interface.

# ifconfig
zeoip0    Link encap:Ethernet  HWaddr 5B:25:C9:44:6A:79  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::5425:d9ff:fe80:6b79/64 Scope:Link
          RX packets:167397 errors:0 dropped:0 overruns:0 frame:0
          TX packets:138861 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:14934574 (14.2 MiB)  TX bytes:12520192 (11.9 MiB)
# ps ax|grep dhcp
5180 ?        Ss     0:02 /usr/sbin/dhcpd eth1 zeoip0
27356 pts/1    S+     0:00 grep dhcp

As you can see, you can run dhcp server on eoip interface. Just open /etc/sysconfig/dhcpd and add DHCPDARGS=”eth1 zeoip0″ inside. Save the file and restart dhcp server.

Teamviewer on Linux

I suppose you have a couple of clients who believes in Teamviewer only. Teamviewer on Linux works fine but after you install it, you’ll be supprised that the proces is always running in the background (it is build to respawn) which is ok if you’re the client who needs help. The first thing which average sys admin will do is to shut down teamviewer.

To stop teamviewer you can use:

teamviewer --daemon stop

You’ll see

initctl stop teamviewerd
teamviewerd stop/waiting

To disable teamviewer on system startup you can use:

teamviewer --daemon disable

More info about the deamon you can find with:

boss init.d # teamviewer --help
 TeamViewer                      8.0.20931 
 teamviewer                      start TeamViewer user interface (if not running) 
 teamviewer --help               print this help screen 
 teamviewer --version            print version information 
 teamviewer --info               print version, status, id 
 teamviewer --passwd [PASSWD]    set a password (useful when installing remote (ssh) 
 teamviewer --ziplog             create a zip containing all teamviewer logs (useful when contacting support) 
 teamviewer --daemon status      show current status of the TeamViewer daemon 
 teamviewer --daemon start       start		TeamViewer daemon 
 teamviewer --daemon stop        stop		TeamViewer daemon 
 teamviewer --daemon restart     stop/start	TeamViewer daemon 
 teamviewer --daemon disable     disable	TeamViewer daemon - don't start daemon on system startup 
 teamviewer --daemon enable      enable		TeamViewer daemon - start daemon on system startup (default)

CentOS 5 Call to undefined function sqlite_escape_string()

If you’re using PHP 5.2.x on RHEL/CentoOS and you received error

PHP Fatal error:  Call to undefined function sqlite_escape_string()

don’t worry. The reason for this is the missing sqlite extension which is not included in RHEL/Fedora/CentOS php packages by default.

To fix this issue, you can include it manually

tar xzvf php-5.2.XX.tar.gz
cd php-5.2.XX/ext/sqlite/
make install
echo >> /etc/php.d/sqlite.ini
service httpd restart

Replace XX with your PHP version (check the php version with “php -v”)

PostgreSQL books which you should consider

Since the Oracle bought Sun (including MySQL), I wanted to improve my knowledge about other databases and to check the alternatives (in case “something” happens to MySQL).

Luckily, MySQL is still here and it still works fine but in the last couple of months, I wanted to dig a little bit about PostgreSQL. I thought that it would be easy to find online tutorials about this topic but I noticed that online tutorials and forums about PostgreSQL are not so popular. Don’t get me wrong, there are several blogs which fits perfectly in my learning habits but spending so much time just to find the basic things is not what I wanted.

I found a link about Packt Publishing free PostgreSQL backup e-book and I didn’t wait (LINK). I posted a comment and couple days later received Packt account with two books

Instant PostgreSQL Starter by Daniel K. Lyons was exactly what I was looking for. A small (48 pages) book was right away uploaded to my DropBox so I can have it where ever I go. The book covers everything you need to start with Postgresql.
You will learn how to install Postgresql, how to connect and create your first database. The book also covers basic SQL queries for creating tables, CRUD (create, read, update and delete records), etc. The last part of the book contains some features you should also know (how to store passwords, working with XML, Full text search and basic options for improving speed and security). Couple advices about backups are also there.
Using pgAdmin III as a GUI tool won’t be a problem because the book contains pgAdmin screenshots.
Don’t get me wrong…. The book has only 48 pages and it can be compared with a cheat sheet but it is a very good portable book. Learning Postgresql can take only one afternoon and in less than a weekend you’ll became a “usable” DBA.

After the Postgresql starter book, I switched to PostgreSQL Backup and Restore How-to. We usually like to say that backup doesn’t have the price and every DBA should know everything about creating and restoring backups.
This (55 page) book is a step-by-step guide to backing up and restoring your database which covers:

  • basic and partial exports,
  • simple restore,
  • creating and restoring binary backups,
  • compressing backups
  • taking snapshots
  • sync backups
  • point in time recovery
  • warm and hot standby restore
  • streaming replication

Just like the first book, this one is also uploaded to my DropBox. Having those books with you is a nice idea and I highly recommend them to all Postgresql beginners. You can buy them as an e-book and as a hard copy.