Sunday, December 21, 2008

Installing Skype on an XO laptop

I successfully installed Skype with video and did a test call from my XO laptop (build 720) today. I used a version of these instructions. Note: Skype will probably need to be reinstalled each time the xo laptop is upgraded. Warning: Skype isn't really meant for the xo - this install creates several zombie processes each time Skype is started, and the sound quality is definitely inferior.

  1. Install Skype
    #mkdir /home/olpc/skype
    #cd skype
    #yum --nogpgcheck -y localinstall skype-
    #rpm -i libasound2-1.0.15-33.el5.i386.rpm
    #chmod +x gstfakevideo
  2. Skype doesn't have a sugar package, so it must be started by root with the command /home/olpc/skype/gstfakevideo. This is cumbersome and hard to remember, so use nano .bashrc to create an alias. Add this line to the 'alias' section of the .bashrc.
    # User specific aliases and functions
    alias skype 'sudo /home/olpc/skype/gstfakevideo'
    Now the user (not root) can start Skype from any prompt with the command skype.

SSH suddenly stops working

I tried to ssh to my XO laptop today, but got the following error:

me:~$ssh user@(IP addr of xo_laptop)
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
Please contact your system administrator.
Add correct host key in /home/USER/.ssh/known_hosts to get rid of this message.
Offending key in /home/USER/.ssh/known_hosts:NUMBER
RSA host key for (IP addr of xo_laptop) has changed and you have requested strict checking.
Host key verification failed.

Why? Probably because I upgraded the OLPC laptop.

How to fix it?

  1. Use ssh-keygen -R (IP addr) to purge the old key.
  2. Connect again like normal ssh user@xo_laptop to install the new (current) key.

Monday, October 13, 2008

Creating a patch to fix an Ubuntu bug

Today I'm preparing a patch to fix Launchpad Bug #117984, which is also Gnome Bug #451734.

References: Ubuntu Wiki, Ubuntu Packaging Guide

It turns out that to do it properly, you need to make two patches. The first one is a .diff file for Debian and upstream. The second creates a .debdiff patch for Ubuntu.

There are circumstances, of course, where one of the patches is not neccessary, and some of these steps can be skipped.

    Note: Use steps 1-9 & 14-15 for just an upstream (.diff) patch. Use steps 1-4,5-7,11-13 & 15 for just an Ubuntu (.debdiff) patch.
  1. Open a terminal window
  2. Create a working directory with the command mkdir working
  3. Move to the working directory with the command cd working
  4. Download the latest source package using the command apt-get source packagename. This method automatically appends an '.orig' suffix, and unpacks the file, too. DON'T download the source from; instead ADD the repos to your Software Sources control panel using the instructions at the Ubuntu Wiki
  5. Make a copy of the unpacked folder with cp -r package-folder package-folder-orig
  6. Go into the unpacked folder (not the orig) with cd package-folder.
  7. Edit the file using nano path/to/file/to/fix. Fix the file
  8. Return to the working directory with cd ..
  9. Use diff -Nurp package-folder-orig package-folder > upstream-bug#.diff to create the upstream patch.
  10. Go back into the unpacked folder (not the orig) with cd package-folder.
  11. Use the command dch -i to update the changelog. Show the change and list the bug# fixed.
  12. Use debuild -S -us -uc to create the debdiff patch.
  13. Attach the .debdiff patch to the bug in Launchpad.
  14. Attach the upstream .diff patch to the Launchpad bug AND the upstream bug.
  15. Delete the working directory, and all contents.
Update February 5, 2009: Accepted and fixed!

Saturday, September 20, 2008

Cron to be deprecated in favor of Upstart in Ubuntu

Ubuntu's Upstart is an init daemon replacement, quite analagous to OS X's launchd. Launchd also replaced cron on OS X - and upstart plans to replace cron on Ubuntu. No telling when, but all my cron jobs will need to be reformatted.

Update: Sept 2011. Three years later and still waiting...

Wednesday, September 17, 2008

Recurring jobs, launchctl, plist, and shell scripting on OSX

OSX is Unix - similar, and yet dissimilar to linux. I'm setting up a few recurring maintenance scripts

First of all, cron is deprecated in favor of launchd, which handles a lot more than just cron jobs.

First, recurring jobs are located in /Users/username/Library/LaunchAgent/ as .plist files.

Sample syntax of a .plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://">
<plist version="1.0">

Alternative interval for daily

Activate the job using the command launchctl load /Users/username/Library/LaunchAgents/plistname.plist

Deactivate the job the same way (except use unload)

Tuesday, September 9, 2008

Music Score Program

Trying music notation programs

mscore - looks great, requires fluid-soundfont-gm to playback (piano)

denemo/lillypond - haven't tried yet.

lime might be promising for the Mac - but Lime for Windows doesn't work under Ubuntu Wine.

Replacing update-notifier with a cron script in Xubuntu

Update-notifier does a lot of good things. It shows you when a package manager is working in the background, it automates security updates, it caused updates to be downloaded in the background, and it provides a convenient icon to click on and launch update-manager. Good stuff.

But it's daemon eats an annoying trickle of ram and resources.

I have it set to update weekly, so the rest of the time it's just eye candy. Much of it's power is wasted on my scheduled update cycle. Time to find a replacement with less overhead.

The simple solution: Really, all I need is to run update-manager weekly. So add the following to your user crontab (crontab -e):

#Reminder bot - this e-mail replaces the update-notifier package
# nail must be instaled, it is part of the heirloom-mailx package
40 7 * * sun /usr/bin/nail -s "Reminder Bot: Run Update-Manager" >/dev/null
or instead of using nail (to e-mail the notice), I can simply use zenity to create a pop-up:
#Reminder bot - this e-mail replaces the update-notifier package
40 7 * * sun DISPLAY=:0.0 /usr/bin/zenity --info --title "Reminder!" --text "It's time to run Update-Manager"
or zenity can also create a notification-area icon:
#Reminder bot - this e-mail replaces the update-notifier package
40 7 * * sun DISPLAY=:0.0 /usr/bin/zenity --notification --text "Reminder: It's time to run Update-Manager"

and I'll get a reminder e-mail every Sunday morning at 7:40 am...if I'm awake. Then I launch update-manager from the menu or command line...if I want.

The lazy solution: The simple solution has a drawback - none of the packages are downloaded yet, so the update might take a while (zzzzz). An additional cron entry, though, will have everything downloaded and ready.

Edit the root crontab: sudo mousepad /etc/crontab

Add the line 42 6 * * sun root apt-get update && apt-get autoclean && \apt-get -q -d -y -u upgrade (source)

This will download the updated and upgraded packages on Sunday mornings about an hour before the reminder e-mail, plenty of time.

In theory we could try 42 6 * * sun root apt-get update && apt-get autoclean && \apt-get -q -d -y -u upgrade && /usr/bin/nail -s "Reminder Bot: Run Update-Manager" and have it all in one place, but I'll find that confusing in another 6 months.

Removing update-notifier and update-notifier-common: Nothing depends on the package in Xubuntu 8.04, so a simple sudo apt-get remove update-notifier update-notifier-common gets rid of the packages, freeing up a whopping 426kb of disk space.

I find I don't miss the old notifier at all.

Tuesday, September 2, 2008

Package management in Ubuntu

Package tools and command line tips.

What's the difference between dpkg, apt-get, aptitude, synaptic, and add/remove? Which one should I use?

  1. dpkg: In the beginning, there were packages. And the community divided the stable packages from the testing, and the dev team cried out, 'Lo, these things need a manager, for how else are we to install and remove them?', and the milestone begat 'dpkg'.

    For dpkg was the first, before all others, and is still the heart of package maintenance. dpkg still does the real work, though the usurpers get the credit.

  2. apt-get: But the people were troubled, and they cried out, 'O mighty devs, dpkg is too hard to use. It heeds only our words, and knows not our heart. It is complicated, and we suffer because it is too easy to bork our system. And forth, into the light, came the Advanced Package Manager, and they called it apt. And the most favored among the apt was 'apt-get'

    And apt-get was a glorious step forward, for now the people's package manager heeded their hearts instead of long lists of pakage names when they wanted to update, and it gave them easier choices to understand. And obeisance to apt-get was still obeisance to dpkg, for apt-get was merely an easier-to-use front end for dpkg.

  3. aptitude: But the people, who are just *never* satisfied, lamented 'O mighty devs, this command-line nonsense has gone far enough. We want a graphical front end tool, because these endless lists of packages are breaking our spirit and making us confused in our oblutions. And the devs heaved a mighty sigh. And their voice brought forth 'aptitude'

    And aptitude had the same commands as apt, but in an easier-to use graphical format. It was called ugly, for it was descended of the command-line, and was despised by the pretty x-server-window adherents, yet it was strong and easy to use. Obeisance to aptitude was strong among the servers and headless devices, for they never listened to the words of the followers of the x-windows-server. And aptitude simply converted the commands into apt commands, and apt converted the commands into dpkg commands, and dpkg still did the real work. And when anyone pointed out that this was a bit convoluted, they were cast out.

  4. synaptic: But the majority of the people, the whiny people, cried out once more 'O mighty devs, who have given us packages and dpkg to rule them, and apt-get to prevent us borking our systems, and aptitude so we don't need to think very hard. And that's nice, for now we can download a lot more pornography. But also, we have heeded the words of the x-windows-server, and we want pretty windows that we control with mice and touchpads and drag around the screen. So chop chop, and get us a version of aptitude for these cool x-windows. And thus was born 'synaptic'.

    And synaptic was strong and robust, and popular among the adherents of GUI were very pleased and multiplied like locusts into legions of users. And like aptitude before it, synaptic simply converted the commands into apt commands, and apt converted the commands into dpkg commands, and dpkg still did the real work.

  5. add/remove: And still the people lamented 'O mighty and wonderful devs, who have found a way to automate updates, who have given me a powerful operating system for free, who have duplicated the miracles of Microsoft and Apple, we think that package management is still too hard, particularly for new users. Your newest followers should be able to install and remove applications with just one click, even more easily than they can now. And the devs considered casting those chuckleheads into the lake of fire, but instead raised their hand and brought forth 'Add/Remove'.

    And add/remove worked with a limited number of applications, a one-click installer/uninstaller of windowed apps, with a lot of advanced details hidden. Add/remove was a front-end for synaptic, which was itself a front-end for apt-get, which was itself a front-end for dpkg.
  6. but still, the people wailed for more and easier, but the tired devs closed their ears and hardened their hearts and went off to work instead on torrent-downloaders to speed up pornography.

  • sudo apt-get -f install - Find broken packages and try to fix them.
  • aptitude show packagename - Is a package installed? (check the second line of the response).
  • dpkg --get-selections > file - Write a list of all the installed packages in a file named 'file'.
  • sudo apt-get update - Refresh the package list.
  • sudo apt-get -d upgrade - Download the upgrades (with a y/n prompt)
  • sudo apt-get -dy upgrade - Download the upgrades (answer the prompt 'y')
  • sudo apt-get update && sudo apt-get -dy upgrade && sudo poweroff - Download all upgrades (not install), then shut down, perfect for unattended download, with installation upon startup in the morning.
  • log for all package actions is at /var/log/dpkg.log. It is rotated monthly at the beginning of the month, so for last month look in /var/log/dpkg.log.1

Friday, August 29, 2008

Fast File Sharing from Ubuntu

Command line Python 2.6 tool to set up an instant FTP server:

Open a terminal

cd /path/to/directory-I-want-to-share
python -m SimpleHTTPServer # Python 2.x only  starts the server on port 8000 
python3 -m http.server     # Python 3.x only  starts the server on port 8000
  • Minimize the terminal window so you don't accidentally close it.
  • Sharing is one-way; no uploading. No security. The entire contents of the directory are shared; no blocking. No logging (that I know of). Just pure download server. Cool.
  • Other computers access the server by web:
  • Your computer accesses the internal server by web: or http://localhost:8000.
  • Kill the process CTRL+C to stop the server

Friday, August 22, 2008

Opening a terminal window using cron

Fast experiment to use cron to open a terminal window and execute a command. Success!

The crontab item is:

* * * * * DISPLAY=:0.0 /usr/bin/xfce4-terminal -x top
     # * * * * *               - the crontab time codes. Substitute your own.
     # DISPLAY=:0.0            - sends the subsequent commands to the screen
     # /usr/bin/xfce4-terminal - the application (opens a terminal window)
     # -x top                  - execute the top command in the application
Once a minute, a new terminal window spawns running 'top', just as intended.

Saturday, August 16, 2008

AbiWord Spell Checker on Xubuntu 8.04

AbiWord doesn't come with a spell checker installed...but it doesn't tell you that.

Here are the packages to install the spell checker: (source)

  • aspell
  • aspell-en
  • libenchant1c2a

Use Synaptic or the command line to install. Restart AbiWord, and it works.

Thursday, July 24, 2008

Creating an Evolution e-mail from the command line and python

Evolution is intended as a GUI e-mail client, so the scripting options are limited. Also, it looks like you cannot autosend e-mail from a script, there's so script command equivalent to the 'send' button.

But that's a good thing; I can autosend from nail when I want to. So a script will compose the e-mail, which will sit on my desktop until I review it and click to send it. Nice.

shell command source

This command creates a window with To:, From:, Subject:, and Body filled in. 'From:' is already known by Evolution, the rest is parsed from the following command:


Another (easier) way:
evolution""\&subject="This Is The Subject"\&body="This is the body of the message"\&attach=Desktop/test_file.xml
  • evolution - Launches Evolution's e-mail composer and To: line
  • ?cc="" - CC: Line
  • \&subject="Subject" or ?subject="Subject" - Subject line
  • \&body="Body" - Body of the e-mail is everything after this line
  • \&attach=/path/file - Files to attach
  • %20 - Space
  • %0D%0A - CR/LF (new line)
  • %09 - Tab

python command

Python 2.x has it's own smtp module for creating e-mail, it's far more useful in most circumstances. But in this case, we want the composed evolution window.

import os
body_string = 'This is the body of the e-mail message'
body_string = body_string.replace(' ','%20')
os.popen('evolution\&body=' + body_string)
  • import os - Use python's os module
  • body_string = 'This is the body of the e-mail message' - The body in normal text
  • body_string = body_string.replace(' ','%20') - Encode the spaces (evolution will decode them). Tabs, newlines, and other reserved strings need to be encoded.
  • os.popen('evolution\&body=' + body_string) - The 'os.popen(cmd)' executes shell cmd. Note that cmd is just a python string, and you can use all the string tools on it, like adding body_string.
>>> import os
>>> to = ''
>>> cc = '""'
>>> subject = '"This is the subject"'
>>> body = '"This is the body"'
>>> attachment = 'Desktop/rss_test.xml'
>>> os.popen('evolution mailto:'+to+'?cc='+cc+'\&subject='+subject+'\&body='+body+'\&attachment='+attachment)

Tuesday, July 22, 2008

Fixing a broken cron job

I am afflicted by Ubuntu Bug #189462, and so I'm getting occasional e-mails from cron that tell me:

slocate: fatal error: load_file: Could not open file: /etc/updatedb.conf: No such file or directory

It turns out to have a trivial solution: touch /etc/updatedb.conf

Update: August 2011 - Finally fixed in Debian.

Saturday, July 19, 2008

What are all these processes?

Trying to figure out all the processes I have running, to see what I can kill, and which packages I can remove.

According to gnome-system-monitor:

System or Root processes I uninstalled,

avahi-daemon - the avahi local discovery system.

System or Root processes I don't use but can't uninstall,
atd                - the at command daemon.
console-kit-daemon - a tracking app for multiuser systems. Many GNOME apps depend on it for some reason.
getty              - console, 6 of them open.

System or Root processes I should keep,
bonobo-activation-server - GNOME component tracker. Safer to leave in place.
gam_server               - gamin tells the window manager about changes in the filesystem.
thunar-tpa               - Thunar trash can applet
evolution-data-server    - database including addressbook and other functions to integrate Gnome app data (breaks Evolution)
evolution-alarm-notify   - alarm clock (breaks Evolution)
system-tools-backends    - DBUS

Thursday, July 17, 2008

Configuring Wine in Xubuntu

Wine 1.0 bugs and fixes.

  • 'Browse C Drive' fails with url not found. This is because Thunar doesn't do bash-style completion, and chokes on a '~' in a config file.

    1. sudo mousepad /usr/share/applications/wine-browsedrive.desktop
    2. Change the line Exec=xdg-open ~/.wine/drive_c to Exec=xdg-open /home/USERNAME/.wine/drive_c
    3. Save and close.

Wednesday, July 16, 2008

Using aria2c for ftp, http, and torrent downloads

Trying aria2c as a command-line replacement for wget, curl, and torrents.

  • Use a new line for each file to download.
  • Use aria2c -D URI for daemon (background) downloads, and free up a terminal window.

Monday, July 14, 2008

Installing DOD CLASS 3 CA-7 security certificate into Firefox 3.0

Superseded by

The US Army has a plethora of websites to keep it's mighty bureaucracy chugging along. Unfortunately, the security certificate they all require is not included in Firefox 3.0 (under Ubuntu 8.04). Here's how to get it and install it.
NOTE: The certificate is worthless to non-DOD people. It doesn't give you access, you still need an account. It's really boring, anyway, and none of the cool secret stuff is in these websites. All the certificate really does for most people is prevent the annoying message: This website has a certificate that I don't trust.
  1. Download the following three files to the desktop:

    The easy way in linux is to use curl -O -O -O

  2. Go to the Firefox Certificate Manager
    • Open Firefox
    • Edit Menu --> Preferences
    • Advanced settings
    • Encryption tab
    • View Certificates button

  3. Import the three new certificates
    (Repeat for each certificate)
    • Authorities tab
    • Click the 'Import' button
    • Show firefox where the downloaded certificate is and click 'OK'

  4. Fix a bug with the CLASS 3 CA-7 Certificate
    • In the Certificate Manager, Authorities Tab, scroll down to the new 'US Government' entries
    • Select DOD CLASS 3 CA-7, and click the 'Edit' button
    • Two of the certificate boxes should be checked. Check them if they are not:

      This certificate can identify web sites

      This certificate can identify mail users

  5. Whew. You're done. Close the windows, restart Firefox and test it.
Importing the same certificates to Evolution is a similar method.

Thursday, July 10, 2008

Messing with the history file

I set the following bash history to make the history file more useful to me.

HISTCONTROL=ignoreboth     #Prevent duplicate history entries
HISTIGNORE=ls:history      #Don't remember these commands in history

Wednesday, June 18, 2008

DVD ISO to AVI file

I have an old DVD ISO image (I make DVDs of my kids), and I want to make an AVI copy to upload the funniest bits to YouTube. This is on an Ubuntu 8.04 system, your mileage may vary.

  1. Install dvd::rip using Synaptic
  2. Mount the .iso image (source):
    1. Create a mount point with sudo mkdir /mnt/iso
    2. Mount the image with sudo mount -o loop /path/and/file.iso /mnt/iso
      Alternate: Somewhere along the line, my Thunar magically gained this ability when I right-click on the .iso icon, but I cannot remember which package made this possible...
  3. Rip the DVD. Open dvd::rip.
    1. Preferences: I created no special folder for ripped projects; just saved to the home directory. I checked the dependencies, and had to download a mountain of them (xine, mplayer, etc) using Synaptic.
    2. Storage: Click 'Choose DVD image directory', and select /mnt/iso. Select the button for 'Encode DVD on the fly' since it's already on the hard drive.
    3. Rip Title: Click 'Read DVD table of contents' and the chapters appear. I highlighted (CTRL + Click) the chapters I wanted to convert.
    4. Clip and Zoom: Click the preset menu, select 'Autoadjust - Medium Frame Size, HQ Resize'.
    5. Transcode: Video bitrate calculation is the size of the final file, so I can keep it small (~10 MB per minute, or ~200 MB per half hour). Finally, click 'Transcode' and wait an hour or two or five for the machine to work.
    6. Test the finished file to ensure it's really what you want. I had to do it a couple times, twiddling with various controls.
  4. Cleanup.
    1. Unmount the iso: sudo umount /mnt/iso
    2. Remove the empty mount point: sudo rmdir /mnt/iso
    3. Delete the .iso file (optional, obviously)
    4. Open Synaptic and get rid of all the packages you won't use again. Or use:
      sudo apt-get remove dvdrip mplayer xine
      sudo apt-get autoremove
      sudo apt-get autoclean

The package ripmake didn't work - tcprobe failure.

Tuesday, June 17, 2008

Python List Tricks

Poking around looking for ways to clean up my Python code for MWC. It's probably time for me to let go of my 25-year-old BASIC programming experience, and stop making my Python look like BASIC:

Eliminating duplicates from a list using Sets. Currently I convert a list to a dictionary and back to do this:

>>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
>>> fruit = set(basket)              # create a set from a list, removing duplicates
>>> fruit
set(['orange', 'pear', 'apple', 'banana'])

>>> li = []                          # create a list from a set
>>> for f in fruit:
...   li.append(f)
>>> li
['orange', 'pear', 'apple', 'banana']

>>> fruit = set([])                   # create an empty set
>>> fruit.add('fred')                 # adding to set
>>> fruit.remove('fred')              # removing from set

>>> fruit.clear()                     # clear all data from a set

>>> 'orange' in fruit                 # fast membership testing
>>> 'crabgrass' in fruit
Source: Dive into Python.

To do:

  1. Convert MWC keyword (tag) lists to sets - the duplicates annoy me.
  2. Using List Comprehensions as a building block for filters and mapping. What else are they good for?
  3. Filter data using Filters instead of for loops
  4. Add data using Map instead of other crazy structures

Friday, June 13, 2008

Ubuntu Fonts

Looking for cool fonts for violin labels (the paper tag inside the f-hole of the instrument).

I used the free font 'Adorable' from

Fonts in Ubuntu are much more straightforward than I expected:

  • The config file (don't need to touch) is at /etc/fonts/fonts.conf
  • The system-installed and packaged fonts (don't need to touch) are at /usr/share/fonts/
  • Personal fonts are at /.fonts (inside the home directory in a hidden file).
  • To install new TrueType fonts, save them to the /.fonts folder. To remove them, drag them to the trash. No sudo needed.
  • Restart any program to see the new font.

Sunday, June 8, 2008

Legacy Printing

Thirteen years ago, I purchased a laser printer that still works great despite a few wrinkles and liver spots. Here's how I keep it alive currently.


    The hardware hasn't changed in nearly ten years.
  • An Apple LaserWriter 4/600 PS, capable of printing from serial or network.
  • An EtherWrite ethernet-to-localtalk (ethernet to apple serial cable) adapter.
  • A Hawking PN400TP 4-port ethernet hub (not router or switch, a hub)

The printer doesn't have an ethernet port, only a localtalk (serial) port. Long ago, our last serial-printer Mac died, so the only way to talk to the printer is through the network via the EtherWrite adapter.

The EtherWrite is not detectable on the network if it's directly connected (by ethernet) to a mac or a router. It only works if the connection passes through a hub first. I don't know why. The EtherWrite's measly documentation is unhelpful, and the company that made it died long long ago.

The printer itself still has clean and sharp output. It's outlasted a couple serial, USB, and multifunction inkjets. Toner is still available. The case is yellowing, and the rear feeder spring has been lost, so it feeds out the top - I taped the rear feed selector level in the position I wanted.

Since I print at home only rarely, I leave the printer/adapter/hub assembly powered off for months at a time. When I need to print, I turn them all on, then alternate unplugging/replugging the printer and adapter until they show up on the network. I've never figured out what the proper power-up sequence should be - and I've tried.


  • A MacBook G4 running OS X 10.5
  • My laptop running Ubuntu 8.04, printing via CUPS.

The printer only speaks Apple's localtalk. It's built-in on the MacBook, and available as an add-on on Ubuntu.

Printing from the MacBook is simple. First, it needs to be plugged into the router, since my router's wireless doesn't support Appletalk. Next, print the document. If the printing errors out "cannot connect to printer," then cycle the power on the printer or the adapter. Since the printed document is in queue, when the printer appears on the network, the printer will begin working despite the original error message.

Printing from linux is a bit more tricky, and Ubuntu doesn't make it easy. But it can be done. These instructions are for Ubuntu 8.04, and your results may vary.

  1. Install the netatalk package with sudo apt-get install netatalk. Due to a bug in the package, you might get a bunch of errors:
    dpkg - trying script from the new package instead ...
    hostname: Unknown host
    invoke-rc.d: initscript netatalk, action "stop" failed.
    dpkg: error processing /var/cache/apt/archives/netatalk_2.0.3-6ubuntu1_i386.deb (--unpack):
     subprocess new pre-removal script returned error exit status 1
    hostname: Unknown host
    invoke-rc.d: initscript netatalk, action "start" failed.
    dpkg: error while cleaning up:
     subprocess post-installation script returned error exit status 1
    Errors were encountered while processing:
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    A package failed to install. Trying to recover:
    dpkg: error processing netatalk (--configure):
     Package is in a very bad inconsistent state - you should
     reinstall it before attempting configuration.
    Errors were encountered while processing:
    Don't sweat if the errors look like these - you'll fix them in the next step. What's happening is that the bug prevents netatalk from figuring out the name of it's host.

  2. The netatalk package is broken. Edit these two files to fix them - then netatalk will work Edit the files even if you didn't get the errors in the last step.
    FROM: ATALK_NAME=`/bin/hostname --short`
    TO: ATALK_NAME=`/bin/hostname`
    FROM: ATALK_NAME=`/bin/hostname --short`
    TO: ATALK_NAME=`/bin/hostname`
  3. Test the printer connection.
      nbplkup PrinterName - Find the printer on the network.

    If the printer's not on the network, there are three possible reasons:

    1. Most wireless routers talk Appletalk only on the wired connections - if you're using wireless, that may be the problem. Obviously, this doesn't apply to Apple wireless routers. For example, our Macbook can't talk wirelessly to the Apple printer because the wireless router can't understand Appletalk.
    2. The netatalk daemon in being flaky. There's a second serious bug in netatalk: The daemon looks for Appletalk devices on the network at startup; if it can't find any, then it shuts down instead of sleeping. For example, if I boot my computer into eth1 (wireless) connection -and we already know my router can't handle wireless Appletalk- netatalk finds no Appletalk network and the daemon shuts down. If I plug in eth0 (wired) connection, and nbplkup PrinterName, it will still fail - netatalk never checked the new connection. Use sudo /etc/init.d/netatalk restart (or stop and start to reset the daemon.
    3. The printer or adapter is being flaky. I make sure the printer is visible to the Macbook (always best to start with a known point, and the Macbook speaks Appletalk like a native). Otherwise, cycle the power on the printer or adapter and try again. With such old hardware, I don't know the correct order to power them up. It can be annoying.

  4. Test command-line printing. Before setting up CUPS, install 'pap' (actually just a script to make pap executable from CUPS) and test it on the command line. CUPS needs pap in the next step.
    • Download pap and save it to your desktop.
    • Make pap executable with sudo chmod +x Desktop/pap
    • Install pap in the correct directory with sudo mv pap /usr/lib/cups/backend
    • Restart CUPS with sudo /etc/init.d/cupsys restart
    • Prepare a test file for printing. The printer seems to only speak Postscript, so your testfile must be in Postscript format. I used this one. In Ubuntu, the a2ps package (included with default install) will create .ps files. Usage: a2ps input_text_file -o
    • Test print using pap -p Printername

  5. Add the printer to CUPS
  6. Most interesting. I can't get CUPS to print, though the rest is great. Hmmmm.

Update: October 2009 - The old hardware finally died, so I never followed up any further.

Saturday, June 7, 2008

Custom Browser URL bar icons

Long ago, I made a favicon.ico custom icon for the Milwaukee Without A Car website, but I don't remember how.... I think I created a .bmp image and simply renamed it...

So I found a new SVG of the same graphic, but I'm not using it - instead I'll stick with the old favicon until inkscape can export to .ico files.

Another example showing how SVGs and their tools have great promise, but aren't quite there yet.

Friday, June 6, 2008

More SVG Shortcomings

  • SVGs, since they are embedded objects, link internally instead of from the parent body. This is the same annoyance I had with frames long ago. For example, a link inside an <object> will work, but only the tiny object box will show the new page. Workaround: Use the target="parent" or target="top" properties of the link tag.
  • SVGs within a link (like a linked image) are not, in fact, linked. Move the cursor over them, and you see that you can't click on the SVG. This particularly sucks with a graphic menu header I tried. Workaround: Use an imagemap (ugh).
  • SVGs can't be called by CSS on a mouseover event (graphic header again). No workaround.

So I'm back to .png and .gif and .jpg for most HTML images. As before, SVG original for easy changes, but export raster images. Well, that's what experiments are for.

Hey, this is my first 'fail' entry in over a month!

Thursday, June 5, 2008

Advantages and shortcomings of SVG images

After a bit of experimenting with SVG graphics, I've reached the following conclusions:

  • I can't figure out how to get SVG graphics to resize automatically in a browser based on an HTML tag. I know how to add an SVG using the <object> tag, but changing the <object> size doesn't scale the image, it crops instead.
  • SVG tutorials ignore the subject, or discuss the <transform> and <preserveAspectRatio> tags, both of which are in the original XML, not the HTML.
  • So, SVGs on a website need to be properly sized before the web browser gets them - one SVG can't be reused at different sizes. Resizing is trivial in Inkscape, but you still need two images for two sizes - that stinks.
  • Basic SVG images are supported by all the common browsers.
  • SVG images are very handy for line drawings like basic maps and diagrams.
  • In print, SVG images saved as .odg OpenOffice Drawing images are very useful replacements for frequently used graphics in business cards, flyers, contracts, etc.
  • SVGs are good for icons/logos since they scale well.

The upshot is that I'll keep file archives in SVG for future manipulation, resized SVGs for web use, and exported ODGs for print media.


  1. SVG can be scaled by HTML tags
  2. OpenOffice imports SVG natively

Sunday, June 1, 2008

Sending e-mail from the command line

I want to send automatic e-mail as a cron job from my Xubuntu 8.04 laptop. Originally, I tried routing it through the legacy mail spools - it is, after all, on the same laptop as my e-mail - but gave up in despair. Thanks to Ubuntu Forums for the info.

  1. sudo apt-get install ssmtp heirloom-mailx
    or install ssmtp and nail using Synaptic.
  2. sudo mousepad /etc/ssmtp/ssmtp.conf to edit the ssmtp config file. Modify or add the following lines to the config file:
    The nail config file does not need to be changed at all.
  3. Using the nail command to send e-mail:
    Tip: Pay close attention to the <RETURN>s and <CTRL+D>s
    First line: nail<RETURN>
    Second line: Subject: subject<RETURN>
    Third line: E-mail body text<CTRL+D>

    Subject: Lotta viruses coming into this account
    I need to stop responding to the spam.
  4. Generating e-mail as part of a script or cron job:

    Script nail -s "Test 3" < /tmp/test_email will send the following e-mail.
    From: You (automatic)
    Subject: Test 3
    Message Body: (read from file /tmp/test_email)

    nail -s "Test 3" < /dev/null will send an e-mail with a blank body - good for quick reminders using the subject line only.

    To generate e-mail from cron events, use the command crontab -e to edit your crontab file:

    26 21 * * * nail -s "Test 3" < /tmp/test_email

    This crontab entry will send the same "Test 3" e-mail every day at 9:26 p.m.

Many elements can be added or customized - this is simple enough to generate automatic e-mails to myself.

UPDATE: September 9, 2008: I could do this in evolution, but it's more fun to use cron and nail or zenity
This crontab entry:

0 6 28 * * /usr/bin/nail -s "Reminder bot: Pay The Store Rent!" </dev/null

will send the following e-mail at 6:00 am on the 28th of each month,

From:    me <my computer>
Subject: Reminder bot: Pay The Store Rent!
Date:    Thu, 28 Jul 2008 06:00:01 -0500 
Text:    None
So I won't forget to pay the rent.... It's important.
This sends an e-mail to a known (to nail) e-mail server, so all machines that check the account get the mail.
Alternately, if I want a a pop-up window:

0 6 28 * * DISPLAY=:0.0 /usr/bin/zenity --info --title "Reminder Bot" --text "Pay The Store Rent"

will give me a pop-up window instead, and

0 6 28 * * DISPLAY=:0.0 /usr/bin/zenity --notification --text "Reminder Bot: Pay The Store Rent"

will give me a tiny notification-area icon.

Saturday, May 31, 2008

Replacing deprecated HTML tags

HTML has changed since I learned it. For example, <style> tags weren't useful, and CSS was just starting out.

Ew, I'm old.

So I used to write an image tag as <img src="General_Lew_Wallace.jpg" width="108" height="144" align="left" border="1">.

But, an alt text is now required, and the border has been deprecated. So after some poking around with CSS, I came up with:

<img src="General_Lew_Wallace.jpg" alt="General Lew Wallace of the U.S. Civil War. I don't look like him." width="108" height="144" align="left" style="border-style: ridge; margin-right: 10px">

It does look better. Thanks to the tutorials at

Friday, May 30, 2008

Using Bash aliases to simplify the universe

I update this blog using the curl command to upload to the web server (see my entry back on March 8, 2008, "The Joy of cURL").

The command, curl -v -T TechBlog.html -u website:password lives in my Bash history; each time I want to upload, I simply up-arrow through the history at the command prompt until the list time appears, and then hit -enter-. Presto! Terribly easy.

But sometimes I've done a lot of command line work in the meantime (for example, python programming), so I up-arrow seventy or ninety times before the old curl command reappears.

I'm much too lazy to do that regularly.

So I created an alias in my .bashrc file: alias blog='curl -v -T TechBlog.html -u website:password'. Now I can simply type blog instead of looking for the old curl command.

Wednesday, May 28, 2008

Adding python event notifications to the Desktop

Figured out how to get a Python script pop up a notification bubble on the desktop:

It uses the pynotify frontend to libnotify. It's not part of the python 2.5 base, but is included with the Ubuntu default install. Here's a test script for my Ubuntu system. It pops up a little bubble from the system tray

import pygtk
import pynotify

pynotify.init( "Some Application or Title" )
n = pynotify.Notification("Title", "body", "dialog-warning")

Tip: The .init() call is neccessary, or you'll get a lot of ugly DBUS and GTK errors.

Changing Stuff: Simply replace the elements("Title", "body", "dialog-warning") with your desired title, body, and image path. The image display will take .jpg, .png, .svg, and likely others. For example...

n = pynotify.Notification("Milwaukee Without A Car", "The Python script MWC_Webcrawler has completed a scheduled run. The logfile has been added to your desktop", "/usr/share/icons/Rodent/48x48/apps/gnome-info.png")

Monday, May 19, 2008

Adding RSS Icon to the browser URL bar

Found out how to add an RSS icon to the URL bar:
Add the following to the <head> section of the page: <link rel="alternate" type="application/rss+xml" title="Your News Feed" href="">

Thursday, May 15, 2008

Xubuntu 8.04 sessions

Had terrible problems with applications autostarting at login that I didn't want. I looked everywhere in /etc and /home/me/.config, but OpenOffice and Thunar just kept appearing.

Then I figured it out. One lousy time I checked the Save session for future logins option on logout. So it restarted that way every time.

So the fix was to shut down all applications, logout (saving the session), log back in. Voila! All fixed.

Saturday, April 5, 2008

Converting bitmap images to vector graphics

Our sign contractor for the store created some beautiful graphics - but the disk they gave us was all .jpg and bitmap .pdf and even a bitmap .ai file. Limited usefulness for reuse unless we can convert them to vector graphics - bitmaps are big and pixellated, vectors are small and infinitely scalable smoothly.

Used Inkscape. Turned out to be incredibly easy. Import the bitmap, then Path -> Trace Bitmap. Next, File -> Document Properties to crop the page area (so it doesn't save as one logo in the corner of an empty sheet of paper). Save the converted file.

Next problem: Inkscape saves as .svg, but OpenOffice can't open it. Easy to fix - instead of .svg, have Inkscape save as .odg, an OpenOffice drawing file. I love when things work out.

Monochrome and color laser prints of the converted graphics are great - no pixels, smooth and clean edges. Interesting: The bitmaps look better on screen, but the vector graphics are superior on paper.

Friday, April 4, 2008

DVD copying

Needed to backup a DVD. On Linux, Brasero failed to finish reading the disk, and never said why. The MacBook Disk Utility errored out with -39. Back to Linux dvdcopy - error reading Title VOB at block 159. No luck - giving up.

Thursday, April 3, 2008

NTFS woes

The 320GB external NTFS drive is faring poorly, but it's the Linux driver's fault. There's a bug. As an attempted fix, I enabled the backport repository and updated the driver (from 6 months old to four months old). Minor improvement only. Since the next update of Ubuntu is due in three weeks, I'll wait to see it it's fixed then.

Update: I never did try it again. Eventually, in 2011, I took the drive out of the casing and used it in my gateway/router/server.

Monday, March 31, 2008

First python script

Did my first successful python scripts! The first simply imports the second, the second checks the existence of a network connection.

Thursday, March 20, 2008

NTFS external drive

For fun, I checked my external drive while booted in Windows. Oh no! It needed to be defragmented! Defrag recommended CHKDSK as well.

Big mistake: One or both of them scattered a lot of my backup files (including the backups of this blog - quite a few entries gone until they turn up again). I'm afraid to look at my music...or my collection of Futurama episodes. Only fix is to hunt through the 'found' folder and put stuff away manually. Big mess.

Thursday, March 13, 2008

Tesseract OCR

Tesseract is a very powerful OCR package that works only from the command line. Imagemagick is a very powerful image conversion toolkit. To OCR a PDF:

convert inputfile.pdf covertedfile.tiff
tesseract covertedfile.tiff textfile
. That's amazingly easy.

Deluge crash recovery

I just figured out that Deluge saves a quick-resume file in the same folder as the torrent (/home/me/.config/deluge/torrentfiles). I wondered how often it updates - now I suspect it updates every time Deulge successfully quits without an error.

If so, then a good idea is to quit and restart Deluge every 6 or 12 hours or so, thereby limiting the loss from a crash.

My external drive is NTFS, and likes to crash on I might start setting my timer.

New MacBook - File Sharing

File sharing is finally easy. System Preferences -> Sharing -> Turn sharing on. Option to log in as the user for total access. At last. The MacBook and iBook share wonderfully. Haven't been able to get the Linux box or the XO laptop on board yet - they see the file shares in Avahi, but can't connect to them.

Sunday, March 9, 2008

New MacBook - Migrating

The new MacBook arrived a couple days ago, and I finally touched it tonight. The new MacBook had OS 10.5, the old iBook has 10.3.9. The iBook wouldn't run the Migration Assistant, and I don't have a Firewire cable we used the house wireless, I logged into the iBook through file sharing on the MacBook, and moved most of Library by hand. Great web page detailed which files to move...but can't find it any more.

Saturday, March 8, 2008

Sharing Music Files Using Avahi

Success! I successfully shared my Linux (Ubuntu 7.10) music files to the Mac using Avahi on a wireless network. Now, if the Mac and Linux boxes are on the same network, the Mac can see and play any of the Linux songs.

How I set it up (surprisingly easy):

  1. Install package mt-daapd for the service, and package avahi-discover as a diagnostic tool.
  2. Open a web browser to localhost:3689, Username: (blank), Password: mt-daapd. The project is called Firefly Server.
  3. On the Configuration tab, put in the directory to music files. On the Server Status tab, click Start Scan.
  4. Open the Mac and launch iTunes. Look in the Shared section for the Firefly Server, and test play a file.

No mucking about with .config files, no command line work, no ports or services to modify.

We'll see if it works after a reboot. Still need to figure out how to share iTunes music with Rhythmbox, and how to share both wth the OLPC. Still need to figure out how to share video files, and other non-media files.

Mounting a USB stick drive on an OLPC Laptop

Success! How do you mount a USB stick on an OLPC laptop and get a window of the contents?

Tip #1: Try several of the USB ports. I was successful in the lower right side port.

Tip #2: Once inserted, the USB stick will automount under /media/UsbStickName. Just do an ls /media/ to see your stick there.

Tip #3: For the GUI, look in the Journal. The stick shows as an icon on the bottom. Click it, and the window of contents opens!

Tip #4: To unmount and eject the drive, use the Journal's USB Drive icon. Trying to use the umount command in Terminal fails, claiming the drive is busy.

The joy of cURL

curl is a wonderfully useful and scriptable upload/download tool. For example, instead up firing up FTP to upload this page to my website, I figured out that I can open a Terminal and enter: $curl -v -T localpath/TechBlog.html -u username:password And it does the whole thing for me!

Cleaned out orphaned packages

Periodically, I use the terminal command deborphan to clean out orphaned packages. Found eight or nine.

It's easy to use. Deborphan merely lists the items. I use Synaptic to remove them.

Update - It's easy to use apt-get autoremove to do the same thing without an additional package.

Friday, March 7, 2008

Fixed Toshiba Sound!

Since the reinstall, there's been no sound in Linux. Xubuntu has output no sound. Found the following solution on the Ubuntu Forums.

Edit the alsa config file: sudo mousepad /etc/modprobe.d/alsa-base

Added the following lines at the bottom of the file:

# Fix for Toshiba sound. From Ubuntu Forums
options snd-hda-intel model=auto

We'll see how it works at the next reboot.

Wednesday, March 5, 2008

New MacBook on the way!

My wife's old iMac G4 started making an ugly sound last night.

So I backed it up immediately. We looked at the loose power connector, the buckling casing, and the noise...and decided it had become unreliable. So I ordered a replacement today.

Looks like the kids get a spiffy toy.

Reinstallation fallout

<p>So far, only three problems with the reinstallation.</p>
  <li>Some data from my shared partition was lost - my backup wasn't as thorough as I thought. I also had to reenter all my e-mail accounts to Evolution (backup copy on the Mac, whew). Nothing critical, just minor annoyances...and a couple Doctor Who episodes.</li>
  <li>The trackpad was fine for the first day, then suddenly became jumpy and unusable today. Looking through various forums, it seems I'm not alone. May or may not be related to the reinstall. On Windows, it was intermittent. On Xubuntu, it's always bad.</li>
  <li>Sound works great on Windows, no sound at all in Xubuntu.  Well, I kind of expected it...</li>

Tuesday, March 4, 2008

Dual Boot (Win XP / Linux) Reconstruction

<p>I decided not to wait until April...</p>
<p>Downloaded and burned an Ubuntu 7.10 Alternate CD. Reinstalled Windows (snore, 1 hour of installing, 2 hours of updating and faddle). Installed Ubuntu 7.10.</p>
<p>Uh-oh. No I didn't. The Ubuntu CD was corrupt, and instead hosed everything again.</p>
<p>Reinstall Windows while using the Mac to download and burn an Ubuntu 7.10 Live CD.</p>
<p>The live CD passes the self-test, but then is no longer recognized as bootable by the laptop.</p>
<p>Use the installed Windows to download and burn Xubuntu 7.10 live CD. At the same time, installed Quickbooks and Openoffice, and de-bloated the tiny (10GB) Win partition. Even used the 'compression' feature to squeeze 2.5 GB free space.</p>
<p>Install Xubuntu 7.10 - Success! Lots of adding and updating, but it's done. The laptop is usable again.</p>

Monday, March 3, 2008

Quickbooks Repair on the store PC

<p> I located the store's .qbw file on my laptop (the Linux partition is still fine), moved it to a stick, and took it to the store. Goal: Install the latest company data on the store PC, since I had been updating at home.</p>
<p><code>QuickBooks has encountered a problem and needs to close. Microsoft Visual C++ Runtime Library Runtime Error! Program: C:\PROGRAM FILES\INTUIT\QUICKBOOKS\QBW32.EXE</code></p>
<p>Okay, go to Add/Remove Control Panel and repair it...</p>
<p><code>The following error occurs when trying to register the QuickBooks items:
    Internal Error 2908 {7D4B5591-4C80-42BB-B0E5-F2C0CEE02C1A}</code></p>
<p>Argh. Turns out I had weeded unused programs last week. I hate bloat. I had removed <code>Microsoft .NET Framework 2.0</code>. Who knew it was installed by Quickbooks?</p>
<p>Put in the Quickbooks CD. It recognized that the correct component was missing, and installed it. Ejected the CD and put it away.</p>
<p>Went back to Add/Remove and the Repair option. It chugged a while (20-30 minutes) and reported success. Tried it with the moved company file....success! We're back in business.</p>

Sunday, March 2, 2008

Scripting and CURL

Learning to use curl, to download schedule information. Using a tutorial to guide me through the minutae of faking forms and another to guide through scripting it into BASH.

Saturday, March 1, 2008


Cool! Package apt-rdepends installs a shell command (also apt-rdepends) that gives a clean list of all dependencies. Reverse searching is also possible. I needed something like this in Iraq, when I was upgrading by hand due to a lack of internet connection for my laptop.

Interestingly, Synaptic has grown a script-maker for offline package changes. It generates a script that you use on a connected machine to download the right packages. I could have used that, too...

Now they are merely of academic interest - unless I go back.

Instead of using the apt-rdepends package, you can get the same result using the apt-cache rdepends packagename command.

Friday, February 29, 2008

Ubuntu Brainstorm is addictive

Trying to limit myself to 30 minutes per session at Ubuntu Brainstorm. Reading the silly ideas (and the few really good ones), and responding to many. So many are already implemented! Many people want to bloat up the distro, others to pare it down to the bone. Very geeky fun.

Update April 10, 2009: Today I became an idea reviewer for Brainstorm.

Update May 15, 2011: Today I became an Admin for Brainstorm!

Thursday, February 28, 2008

Ubuntu Bug #158706 Verified

A couple months ago I submitted a bug. Today they confirmed it. (I made a good report)

When installing the package netatalk 2.0.3-6ubuntu1 on Ubuntu 7.10, the following errors occur:

hostname: Unknown host
invoke-rc.d: initscript netatalk, action "stop" failed.
dpkg: warning - old pre-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
hostname: Unknown host
invoke-rc.d: initscript netatalk, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/netatalk_2.0.3-6ubuntu1_i386.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
hostname: Unknown host
invoke-rc.d: initscript netatalk, action "start" failed.
dpkg: error while cleaning up:
 subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
dpkg: error processing netatalk (--configure):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting configuration.
Errors were encountered while processing:
Press return to continue.

How to fix it:

  1. edit /etc/default/netatalk

    FROM: ATALK_NAME=`/bin/hostname --short`

    TO: ATALK_NAME=`/bin/hostname`
  2. edit /etc/init.d/netatalk

    FROM: ATALK_NAME=`/bin/hostname --short`

    TO: ATALK_NAME=`/bin/hostname`


  • Submitted Feb 28, 2008
  • Marked as a duplicate of Bug 109917 on October 10, 2010

Wednesday, February 27, 2008

Ubuntu Startup: services-admin prompts for password

Every time I login to my Ubuntu 7.10 laptop, I get the 'happy login' music and the screen begins to populate with my desktop.

Then it vanishes (before I can click on anything), and services-admin prompts me for my password. Whether I enter the password or simply cancel, the system thinks for a moment, then brings up the network and brings back the desktop.

The only difference I've noticed is that CUPS seems to be active only when I've entered my password, and isn't if I cancelled instead. If all it's starting is CUPS, then I don't care if services-admin starts or not; I can start it manually. I'm annoyed by services-admin prompting me.

Result: Nothing in bugs, nothing in forums. Left a post at to see if anyone can help.

Update April 2009: Upgrading to 8.04 eliminated the problem. The ubuntuforums thread was never answered.

Linux Startup: intel_rng: FWH not detected

Every time I boot Linux, one of the startup messages is intel_rng: FWH not detected. Today I fixed it!
The item shows up in /var/log/dmesg as Feb 27 06:28:03 my_computer kernel: [ 15.128000] intel_rng: FWH not detected

It turns out to have a simple explanation, and suggested solution is to 'turn off' the kernel module.
I used sudo gedit /etc/modprobe.d/blacklist to edit the blacklist file as root. I added the following at the bottom of the file:

# prevents minor boot error 'intel_rng: FWH not detected'
blacklist intel_rng
Reboot, and success! The error message is gone.

Monday, February 25, 2008

Created My Tech Blog

Success! Today I created and tested this page, plus the feedback webform.

Success stories are so rare....

Update: Began moving items over to Blogger on August 23, 2011. No need for the webform on Blogger, plus it has tags and rss that I have finally decided that I want.

Converting a .tiff to a .pdf in Ubuntu

For some reason, my CUPS under Ubuntu 7.10 refuses to print-to-pdf. I've tried everything I know (not much)...and probably broke a lot of stuff along the way.
But I found an easy way to do it from the command line.
  1. Scan the item to a .tiff file in a known location (for example, save it to the Desktop)
  2. Open a terminal:
    convert -density 300 -units PixelsPerInch Desktop/scanned_file.tiff
    ps2pdf -s PAPERSIZE=letter final_output_file.pdf
    rm scanned_file.tiff