msgbartop
A cronological documentation test project, nothing serious, really!
msgbarbottom

07 Oct 2009 Create a Debian Lenny installation USB stick

This is a short post that describes how to prepare your USB memory stick for a base installation of Debian Lenny. This will most likely also work on Debian based distributions like Ubuntu.

Download the latest Debian boot.img.gz file

# wget http://people.debian.org/~joeyh/d-i/images/daily/hd-media/boot.img.gz

Download the latest Debian netinst ISO image

# wget http://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/i386/iso-cd/debian-testing-i386-netinst.iso

Connect the USB stick in the computer and verify that the drive is recognized in /var/log/messages.

It is now time to write the downloaded files onto your USB stick.

First write the boot information to the stick

# zcat boot.img.gz > /dev/sdb

I am assuming that /dev/sdb is the memory stick. Always check that you are writing to the right device!

Mount the USB stick and copy the installation files from the ISO image

# mount /dev/sdb /media/memstick
# cp debian-testing-i386-netinst.iso /media/memstick

The USB stick is now ready to be used as a boot media just like a CDROM.

Tags: , , ,

Posted by Hans-Henry Jakobsen

04 Sep 2008 Store Debian boot messages in log

You can enable boolog in /etc/default/bootlogd

BOOTLOGD_ENABLE=Yes

The log is saved in /var/log/boot

This tip also applies to Ubuntu systems.

Tags: ,

Posted by Hans-Henry Jakobsen

02 Sep 2008 Rename files by wildcard pattern and correct the EXIF timestamp metadata

This is a little script I’ve written to correct all my image files since the EXIF timestamp information is one hour out of sync. The filenames have been renamed to comply to the EXIF information and has to be renamed again because of the one hour scew. The filename can look something like this 20080102-1201_DSC_0910.JPG where the name is built up like YYYYMMDD-HHMM_Original_Filename.JPG
Remember to backup your imagefiles before you continue. You have been warned!

Rename files using wildcard pattern

This is the files we are going to rename

20080102-1201_DSC_0910.JPG
20080105-1923_DSC_1006.JPG
20080111-1220_DSC00189.JPG
20080122-0929_DSC00190.JPG

The mmv command is a command that lets you move/copy/append/link multiple files by wildcard patterns. It can be installed in Debian (or Debian based distributions like Ubuntu) by issuing the command

# aptitude install mmv

Now rename the files back to their original name

# mmv "*_DSC*" "DSC#2"

The result after this operation looks like this

DSC_0910.JPG
DSC_1006.JPG
DSC_1179.JPG
DSC_1302.JPG
DSC_1587.JPG

Correct the EXIF timestamp using exiv2

Next adjust the EXIF information stored in the image files to fix the one hour difference. This can be done using different EXIF tools like exiftool, but I will show you how it can be done using jhead and exiv2. The advantage with exiv2 is that it can also handle Nikon NEF files while jhead only can prosess JPG.

The current timestamp can be determined as follows

# exiftool DSC_0910.JPG | grep "File Mo"

The result in this case is

File Modification Date/Time : 2008:01:02 08:34:09

Adjust EXIF time info one hour forward using exiftool

# exiftool -AllDates+=1 DSC_0910.JPG

Other tools that could have done the job

Adjust EXIF time info one hour forward using jhead

# jhead -ta +1 DSC_0910.JPG

Install the jhead package using aptitude as mentioned earlier for the mmv package

Adjust EXIF time info one hour forward using exiv2

# exiv2 ad -a 1 DSC_0910.JPG

Rename files back to YYYYMMDD-HHMM_Original_Filename.JPG

It is now time to rename the files back to the YYYYMMDD-HHMM_Original_Filename.JPG format I used before this operation. This operation has been describe in a previous post named Rename image files according to EXIF date

exiv2 -r'%Y%m%d-%H%M_:basename:' rename $(ls D*)

The script

#!/bin/bash -x
# Needed software:
# exiftool
# exiv2
# mmv

# Script tested on Nikon D80 and Sony Cybershot DSC-W12 files

# Make a printout of how the files look like now
ls -l > repair_name_and_exif_before.txt

# Rename files to remove date formatting back to original name
mmv "*_DSC*" "DSC#2"

# Change EXIF info on JPG files (order is important)
exiftool -overwrite_original -AllDates+=1 D*.JPG
# Preserve date/time of original file when writing
exiftool -overwrite_original '-DateTimeOriginal>FileModifyDate' D*.JPG

# Change EXIF info on NEF files (order is important)
exiftool -overwrite_original -AllDates+=1 '-DateTimeOriginal>FileModifyDate' D*.NEF
# Preserve date/time of original file when writing
exiftool -overwrite_original '-DateTimeOriginal>FileModifyDate' D*.NEF

# Rename files back to date formatting (YYYYMMDD-HHMM_Filename) based on the new EXIF info
exiv2 -r'%Y%m%d-%H%M_:basename:' rename $(ls D*)

# Make a printout of how the files look like after conversion
ls -l > repair_name_and_exif_after.txt

Tags: , , , , , , , , ,

Posted by Hans-Henry Jakobsen

13 Apr 2008 Mount remote filesystem using ssh and sshfs

This is short howto on how you can mount a remote filesystem through ssh and access in Debian it like any other local filesystem. This is a safer method to mount remote filesystems and a user can perform it without root privileges.

First you need to install sshfs

# aptitude install fuse-utils sshfs

Install the necessary kernel module

# modprobe fuse

If you haven’t installed the ssh server package already, now is the time

# aptitude install ssh

Mounting a remote filesystem is easy

sshfs username@hostname: mountpoint

Example

create the mount point

# mkdir /mnt/remotefilesystem
# chown [username]:[groupname] /mnt/remotefilesystem/

Add yourself to the newly created fuse group

adduser [your-user] fuse

switch to your user and mount the remote filesystem.

sshfs remote-user@remote.server:/remote/directory /mnt/remote/

You can specify any directory after the colon.

$ sshfs [user@]host:[dir] mountpoint [options]

If you want to unmount your directory use the following command

fusermount -u mountpoint

Tags: , , ,

Posted by Hans-Henry Jakobsen

25 Mar 2008 aptitude cheatsheet

aptitude is a great alternative to apt-get and the best way to install, remove, upgrade, and otherwise administer packages on you system with apt. aptitude solves orphaned dependencies and has a curses interface that blows the doors off of dselect. Finally, and most importantly, it takes advantage of one tool, doing many many operations:

Syntax Description
aptitude Running it with no arguments brings up a curses based interface to search, navigate, install, update and otherwise administer packages
aptitude install Installing software for your system, installing needed dependencies as well
aptitude -d install Download packages to the package cache as necessary, but do not install or remove anything.
aptitude remove Removing packages as well as orphaned dependencies
aptitude purge Removing packages and orphaned dependencies as well as any configuration files left behind
aptitude search Search for packages in the local apt package lists
aptitude update Update the local packages lists
aptitude upgrade Upgrade any installed packages that have been updated
aptitude clean Delete any downloaded files necessary for installing the software on your system
aptitude dist-upgrade Upgrade packages, even if it means uninstalling certain packages
aptitude show Show details about a package name
aptitude autoclean Delete only out-of-date packages, but keep current ones
aptitude hold Fix a package at it’s current version, and don’t update it

aptitude uses many of the same commands as apt-get. It is not a good idea to use both, you should either use aptitude or apt-get exclusively, or your dependencies might get confused.

Tags: , , ,

Posted by Hans-Henry Jakobsen