Monday, May 20, 2013

Trouble with Windows patch files and projects on Linux

I was having a rough time patching a project in Debian Linux using a patch file generated in Windows using svn diff. There were many errors of the type Hunk #1 FAILED.

From this forum thread, I got the idea that it might be the windows style line endings that were causing the errors. I proceeded to run dos2unix on my patch file but the errors persisted when running patch -p0 < path/to/patchfile.

On further investigation, it emerged that the project I was patching was also using Windows style line endings. The following command changed all the files that are listed in the patch file to Unix line endings.

cat file.patch | grep ^Index | cut -d: -f2 | xargs dos2unix

New files in the patch are gracefully skipped by dos2unix. After this, the patch succeeded.

Saturday, December 1, 2012

getting started with request tracker and gmail

I had used request tracker at my former work place as a user. This was my first time installing it. Ubuntu 12.04 provided a smooth install experience. The slight surprise here is that the main package is not named rt4 but request-tracker4.

The documents that guided me on this are:
  • Installing Request Tracker 4 on Debian
    This blog gives a good account of installing request tracker on debian for a using a custom email domain.
  • GmailAndExim4 on the debian wiki
    It has a good breakdown of how to setup exim4 to send emails to a smarthost. I adapted the instructions to work with gmail.
  • Gmail POP3 with Fetchmail
    The fetchmail configuration given by the first source does not show how to connect fetchmail via SSL. This document shows a configuration that can be used for gmail.
In my setup, an email is sent to a gmail account (mfano@gmail.com) which fetchmail logs on to and delivers the email to the request tracker queue. Once request tracker has processed the email, it sends it out using a local account address (rt4@localhost). Exim4 takes over at this stage and delivers the email to gmail using smtp.

Still trying to figure out how the comment email will be sent via exim4 as it appears that one account will be used to send all emails that match the google dns.

Default Queue Settings
These were provided in the debconf wizard during the rt installation.

Queue settings (Local email account)











/etc/email-addresses
rt4:mfano@gmail.com
rt4@localhost:
mfano@gmail.com
rt4@app-server:
mfano@gmail.com

/etc/fetchmailrc
poll pop.gmail.com protocol pop3
   username "mfano@gmail.com" password "siri" options ssl
   mda "/usr/bin/rt-mailgate --queue general --action correspond --url http://localhost/rt/"
   no keep
;

/etc/exim4/passwd.client

*.google.com:mfano@gmail.com:siri

Monday, November 19, 2012

Perl script to remove stale PID file

Here's a script for removing a stale PID file. It is my first real world perl script. This also happens to be my first blog this year, following the renaming of this blog from locait.blogspot.com. I had to create this script when apacheds refused to start due to a stale PID file.

#!/usr/bin/perl
# perl script to remove state pid file
# adapted from example at http://search.cpan.org/~cwest/File-Pid-1.01/lib/File/Pid.pm
# it expects the pid file as the sole argument

use File::Pid;
  if ($#ARGV < 0) {
        die "Expects the path to the pid file but received $#ARGV args";
}
  my $pidfile = File::Pid->new({
    file => "$ARGV[0]",
  });

  if (! $pidfile->running ) {
      $pidfile->remove;
  }

Thursday, September 29, 2011

Mounting a webdav url with davfs2

I found a very useful article online and my points of departure from the author's directions are summarised as a comment on the article and also quoted below.
Many thanks for the helpful information.
I placed the secrets file in ~/.davfs2/secrets and added an entry to /etc/fstab and it worked well.
Being on a 64bit system, I needed to install the 32 bit version of libneon27 for davfs2 to work.

Thursday, September 22, 2011

Adding new vtapes to amanda and troubleshooting

I needed to add new vtapes to amanda after successfully adding new space via LVM. Using a one line script included in the vtape how-to on the amanda wiki, I created the additional tape directories - slot[m] to slot[n].

After this, I changed the configuration file's tapecycle parameter to reflect the advice by martineau in a zmanda forum post - that tapecycle should be at least runspercycle * runtapes.

On executing amcheck on one of the amanda configurations, I ran into an error - WARNING taper changer error: slot : Slot  is already in use by driveN. This was resolved by deleting the driveN directory as suggested by dustin in another zmanda forum post.

Earlier, an all estimate timed out error had been resolved by adding the directive estimate calcsize to the configuration's dumptype as suggested by paddy in a zmanda forum post.

Monday, September 12, 2011

Screen Capture/Recording with ffmpeg

My attempt to record a video tutorial was failing with the error 'x11grab AVParameters don't have video size and/or rate. Use -s and -r'. This was in response to typing in the following command as based on an example in the ffmpeg man page.

ffmpeg -f x11grab -s 1280x1024 -i :0.0 -r 25 -sameq /tmp/test.mpg

After several failed tries, I determined that the error could be coming from the -r option. I moved it to immediately after the -s option so that both -s and -r options followed the x11grab specification. This time, it worked great. The final command is shown below.

ffmpeg -f x11grab -r 25 -s 1280x1024 -i :0.0 -sameq /tmp/test.mpg

Wednesday, July 20, 2011

Setting up the first LVM partition

Most of the LVM setups I have created have been done by the OS installer. I wanted to add more disk space to a server that did not have any LVM partitions setup. Below are the steps that I took:
  • added the hard disk (it was a virtual hard disk in this case)
  • created a partition and assigned it the lvm partition type id using fdisk
  • created the physical volume
    pvcreate /dev/sdb1
  • created a volume group called system with the earlier created physical volume:
    vgcreate system /dev/sdb1
  • created a logical volume to take up all the free space
    lvcreate -n storage -l 100%FREE system
  • created an ext3 file system on the logical volume
    mkfs.ext3 /dev/system/storage
  • Made an entry in /etc/fstab
    /dev/system/storage /storage ext3 defaults 1 2