Terminal not fully functional when using rxvt-unicode-256color

After reading some interesting articles about rxvt-unicode (often called urxvt) I wanted to try it out myself on my Archbox. Installation is quite simple via pacman and further customization can be done be modifying the .Xdefaults fine in your home directory.

If you install the rxvt-unicode-256color package the TERM variable will be set to rxvt-256color and that’s a problem when connecting to the debian boxes, because the ncurses package does not have a valid entry for this under /lib/terminfo.
When using less, man and I assume some other tools too, you’ll get the following error message:

WARNING: terminal is not fully functional
-  (press RETURN)

To avoid this, you can add the following line to your .bashrc file in your home folder to set the TERM variable to rxvt-unicode which is included in the debian ncurses package:

case "$TERM" in
    rxvt-256color)
        TERM=rxvt-unicode
        ;;
esac

Check installed gems via “gem server”

If you quickly want to check which gems you’ve installed via rubygems you can start the integrated gem server by invoking hte following command:

gem server

After that step fire up you browser and got to http://localhost:8808

You should see something like this:

Installed gems seen via "gem server"

Tunneling Rsync through SSH for ABS updates

As I told on my previous post I’m currently using Archlinux here at work. Archlinux has beside it’s ‘normal’ package management system pacman (similar to apt-get) a ports-like application-repository called the ‘Arch Build System’ (ABS).

In order to use the ABS software repository and to be able to install software from it, you need to sync the whole package tree to your local disk. This doesn’t contain the full packages with all tarballs and stuff – it’s only some Meta-information. The necessary files needed for a package installation will be downloaded on request when installing the software.

Updating the ABS-tree is being done by rsync. The problem is that I don’t have the possibility to connect to the internet by something other the http(s) and ssh, but I haven’t found a solution yet to tell abs to use rsync over ssh for this step.

So my workaround for this is the following:

- Tunnel the rsync requests to the Arch servers via ssh (this needs root priviledges)

ssh -l johndoe -L 873:rsync.archlinux.org:873 yoursshserver.cooldomain.com

- Edit /etc/abs.conf and replace the value for SYNCSERVER with ‘localhost’

- Run abs

It’s working very fine, but I have to admit that you need a ssh-server to connect to in the internet or at least a linux-box (of course any other ssh-able server will fit too) accesible via dyndns.

Speeding up Arch Linux

Currently I’m using Arch Linux on my desktop-machine at work. As I’m still at the evaluation phase i read trough some forums, wikis and blogs about Arch Linux.
One very interesting article I found was this one: http://www.cywhale.de/arch-linux-optimieren-booten-in-16-sekunden/
It describes how the booting time can be speeded up with some nice tricks. I did not all steps described there, but only the few changes i made saved me 19 seconds and my arch-machine now boots to the KDE logon-screen in 13 seconds.

Before the optimization:

bootchart_slow

After:

bootchart

Migration finished

As I wrote in the last post i was thinking about migrating back to wordpress. The steps are almost done. I don’t use categories anymore and the few links i had were added manually after the db-migration. What’s still left to do is to look for a nice theme and install some nifty plugins.

Thoughts about migrating (back) from Drupal to WordPress

Here’s something I found on this webpage related to a Drupal2Wordpress database migration:

prerequisites:

  • A fresh and clean installation of WordPress
  • Drupal database name: drupal (no table-suffix)
  • WordPress database name: wordpress (table-suffix ‘wp_’)

Fire up the mysql cli:

USE wordpress;
DELETE FROM wp_posts ;
DELETE FROM wp_comments;
INSERT INTO wp_posts( ID, post_author, post_date, post_content, post_title, post_excerpt, post_name, post_modified )
  SELECT a.nid, 1, FROM_UNIXTIME(a.created), b.body, a.title, b.teaser, concat('OLD',a.nid), FROM_UNIXTIME(a.changed)
  FROM drupal.node AS a, drupal.node_revisions AS b
  WHERE a.nid = b.nid AND (a.TYPE='blog' OR a.TYPE='page' OR a.TYPE='story' OR a.TYPE='forum');
INSERT INTO wp_comments ( comment_post_ID, comment_date, comment_content, comment_parent )
  SELECT nid, FROM_UNIXTIME(TIMESTAMP), concat(subject,' ', comment), thread FROM drupal.comments ;

For the last part I wrote a perl-script, because the statement needs to iterate over all posts and calculate the related amount of comments. For getting this to work the user who runs the script needs to be able to login without a password to mysql. This can e.g. be achieved by a .my.cnf file in the home directory of the user.

#!/usr/bin/perl

@postids = `echo "select ID from wp_posts" | mysql wordpress`;

foreach (@postids) {
    if ($_ == "ID") { next }
    print $_;
    system "echo 'UPDATE wp_posts SET comment_count = (SELECT count(*) from wp_comments where comment_post_ID = $_) where ID = $_;' | mysql wordpress";
    system "echo 'SELECT comment_count from wp_posts where ID = $_;' | mysql wordpress";
}

I wrote this in a very short amount of time and I know it’s very dirty, but it works :-)

Things that are still missing:

  • User migration
  • Post and Comment Formating
  • Categories

200 days Uptime!

Today I received an email from the uptime daemon on my machine:

Uptimed noticed an uptime event!

The uptime of www.schmalenegger.com has reached a milestone:	200 days, 00:00:00 (two hundred days)

Congratulations!

Wow! 200 days on a vserver is really quite okay. Thanks to my server - keep on rocking :-) 

VMWare Remote CLI – libxml2 not found

After installing the VMWare Remote CLI on a VC-Server I was always getting the following error:

Can’t load ‘C:/Program Files/VMware/VMware VI Remote CLI/Perl/site/lib/auto/XML/LibXML/Common/Common.dll’ for module XML::LibXML::Common: load_file:The specified module could not be found at C:/Program Files/VMware/VMware VI Remote CLI/Perl/lib/DynaLoader.pm line 230.

But all the files were there. Strange….

Thanks to Bob Plankers the solution was really simple: Just logout and log in again to update the environment variables.

Monitoring of max open files in a vserver

Running services on a virtual server sometimes causes problems. I often faced such porblems by reaching the maximum amount of open files. In that case applications like Apache or Postfix fill up their logs with lines like this:

“Too many open files in system”

I wanted to be able to monitor the amount of open files on my server (OpenVZ/ Virtuozzo) to easily see when there were and also when there might be problems. I decided to give Munin a try. Installation and basic Configuration was really simple and what I like very much is that custom plugins can be written very quickly with basic knowlegde of bash or perl.

Attached is my munin plugin. Just copy it to /etc/munin/plugins (in the default installation of munin) and rename it to vserver_open_files. Also add following lines to the file /etc/munin/plugin-conf.d/munin-node, because this plugin needs to run with root privileges.

 [vserver_open_files] user root

vserver_open_files-day

Here is the link: http://www.schmalenegger.com/files/vserver_open_files.sh

using msmtp with mutt

Since a few days ago i only used mutt directly on my server where the fully-loaded and configured postfix was running. The setup always worked and still works fine, but i wanted to use mutt also on a different machine and still be able to send mail via smtp through my postfix on the server.

As I don’t want to use postfix for this simple “mail-forwarding” job, i googled a bit through the internet and found msmtp.

Installation and configuration is quite simple. msmtp is available via package-management on most linux distributions and it only needs on single configuration-file to get it running.

Simple paste the following content (adapted to your needs of course) to .msmtprc in your home folder:

account default
host mail.yourserver.com
auth on
user johndoe
password verysecret

What’s now left to do is to tell mutt to use msmtp instead of /usr/sbin/sendmail.
This is done via the following line in your .muttrc:

# use msmtp
set sendmail="/usr/bin/msmtp"

That’s it.