Archive for the ‘Linux’ Category.

“Error: queue file write error” with Postfix and Amavis

If you’re using Postfix and Amavis, you may be seeing “Error: queue file write error”, especially with larger than usually email rates.
Here is what you can do to get rid of them.
Continue reading ‘“Error: queue file write error” with Postfix and Amavis’ »

restoring a single table from a large MySQL dump file

If you have a large MySQL dump file, but only need to restore a single table, you may use the following:
Continue reading ‘restoring a single table from a large MySQL dump file’ »

repairing broken PostgreSQL databases / tables

If your server happened to crash, Postgres database is corrupted, but didn’t contain too precious information, you may try the following fix.

The typical symptoms of a corrupted Postgres database would be like below:
Continue reading ‘repairing broken PostgreSQL databases / tables’ »

simple filesystem read/write tracing with /proc/sys/vm/block_dump

Ever wondered what is hammering your disk so now and then, but couldn’t figure out with top / htop and similar? Annoying, but constant 100-200 kB/s writes? Or, simply blktrace was an overkill (or not supported by the kernel)?

Continue reading ‘simple filesystem read/write tracing with /proc/sys/vm/block_dump’ »

SOCKS proxy with OpenSSH (instead of port forwarding)

You’ve probably used port forwarding available in OpenSSH to securely forward selected ports to selected hosts.

What if you wanted to securely push i.e. all web traffic from your PC/laptop through some other server running?

OpenSSH and its SOCKS capability to the rescue!
Continue reading ‘SOCKS proxy with OpenSSH (instead of port forwarding)’ »

listing your EC2 instances IP addresses from command line

Increasing number of instances running on EC2, ever wondered how to get their list of IP addresses, including elastic IPs, from CLI (i.e. to make sure you don’t have any servers with proxy or SMTP open relay)?

Here is a small bash script that will do it.

Continue reading ‘listing your EC2 instances IP addresses from command line’ »

rooting Motorola Droid Razr xt910 from Linux

If you want to root your Motorola Droid Razr xt910, but can’t find proper Linux docs, here is a small howto. Do it on your own responsibility, you may brick your device!

Continue reading ‘rooting Motorola Droid Razr xt910 from Linux’ »

Installing KDE 4.9 in Ubuntu

If you’re not a big fan of Unity or Gnome 3 and use KDE with your Ubuntu Linux (or, Kubuntu), you may want to try KDE 4.9 which was recently released.

Ubuntu 12.04 comes with KDE 4.8.4, so if you’d like to try KDE 4.9, run the below commands:

sudo apt-add-repository ppa:kubuntu-ppa/backports -y
sudo apt-get update
sudo apt-get upgrade

After fetching about 500 MB of archives, log out and log in again (or, simply reboot) and enjoy KDE 4.9!

The sorry state of desktop Linux

I’ve used desktop Linux for 15 years, and for all these years, it’s a continuous path of failures and sorry state.

Anyone still remembers KDE? KDE2 wasn’t so great, but KDE3 improved a lot and was really pleasant to use. Heck, no, the developers had to introduce the chaotic and unstable KDE4 – user base dramatically dropped and nobody has confidence in KDE anymore.

Gnome? Became even more popular after KDE4 was introduced. Unfortunately, Gnome developers, much as most Linux desktop developers, don’t learn on success of the others, rather, they repeat the errors of the others (KDE4). So Gnome 3 made it to the world, with users leaving and having same mixed feelings about it, just like they have with KDE4.

The new kid on the block, Unity, is as controversial and annoys a lot of its user with its inconsistency.

There are others, too, like MATE, Cinnamon, Xfce, but they suffer from even more immaturity than their bigger brothers.

 

What do we have so far on the Linux desktop? No organised engineering, no long term plans, no QA, releasing alpha versions as stable products, in short, just total revolutions every couple of years.

 

Frustrating.

 

date conversion oneliners in bash

Some handy date conversion oneliners in bash.

Assuming we have a unix timestamp format (seconds since 1970-01-01 00:00:00 UTC) and we want to make it human readable:
$ date --date=@1343351724
Fri Jul 27 01:15:24 GMT 2012

 

Same as above, but we’d rather make it output in a different format:

$ date --date=@1343351724 +%d/%b/%Y:%R:%S
27/Jul/2012:01:15:24

 

Need the above for a different timezone? Try this:

$ env TZ="Asia/Tokyo" date --date=@1343351724 +%d/%b/%Y:%R:%S
27/Jul/2012:10:15:24

 

Date “now” in Tokyo, our custom outputĀ  format:

$ env TZ="Asia/Tokyo" date +%d/%b/%Y:%R:%S
27/Jul/2012:19:11:39

 

12 hours later from now in Tokyo:

$ env TZ="Asia/Tokyo" date +%d/%b/%Y:%R:%S --date="+12 hours"
27/Jul/2012:19:13:08

 

For a list of possible timezones on your system, see ls /usr/share/zoneinfo.

 

First day of this month:

$ date +%F
2012-08-07
$ date -d "-$(date +%d) days + 1 day" +%F
2012-08-01

Last day 2 months ago:
$ date +%F
2012-08-07
$ date -d "-$(date +%d) days - 1 month" +%F
2012-06-30

Convert syslog date to unix timestamp – assuming your log line begins with:

Nov 5 08:49:45

you can convert it to unix timestamp with:

date --date="Nov 5 08:49:45" +%s