« May 2010 | Main | July 2010 »

June 29, 2010

Sloooow OOo? This could be the answer!


One of the residual issues from my troubled Kubuntu 10.4 upgrade was a puzzling OpenOffice.org problem. Last week I finally got a chance to investigate it. The solution may surprise you!

(If you can't be bothered with the dissertation and just want to try the solution, click here.)


The problem
Package developers like tinkering with other people's code. I'm not sure why, especially when suites like OpenOffice.org come tried and tested for all flavours of operating system direct from the home website. In the case of 10.4, OOo was still at version 3.1 when I'd been using 3.2 for months.

The Ubuntu version started speedily enough, but every time I clicked to open a file it would freeze for 20 seconds. Every time.

I checked running processes, I checked top, I checked memory usage -- nothing out of the ordinary. Just 20 seconds lock-up for each and every File / Open. Damned annoying!

So I ditched it, downloaded version 3.2.1 from OpenOffice.org and tried that. The file opening problem vanished, to be replaced by sluggish start up. Hit go, up pops the splash screen and -- yes, 20 seconds later -- the program opens. Once running however, everything was fine. It was just that initial startup.

I've never suffered with sluggish OOo before and, as I said, last week I finally got round to a thorough investigation.


The Clues
The first clue came from unplugging the network lead. No network = instant start. Ah-ha!

There are tons of references to networked printers causing slow OOo, and yes, I run a networked printer. But none of the suggested solutions -- such as setting the default printer to fax or PDF -- made any difference, and none explained the reason why this should affect start-up.

So I kicked off Wireshark and watched the network traffic. That was when I spotted what was happening.

My PC's name is "asok" (I'm a Dilbert fan). Every time I started OOo, a DNS request was sent seeking the IP address of "asok.(none)" -- which doesn't exist. So the request would time out, another would be sent, that too would time out ... until eventually the seeker gave up trying and the start-up continued.

Now "asok" is associated to IP address 192.168.1.100 in my /etc/hosts file...

192.168.1.100   asok

...so adding another name resolution in the form of ...

192.168.1.100   asok   asok.(none)

... made my problem vanish. Yay!

But why is OOo seeking "asok.(none)" in the first place?



The Reasons
Having nailed the problem -- and therefore my precise search terms -- it was easy to find and explanation. Here is it, from a 2003 forum post by Lars Oppermann, a StarOffice (OOo's predecessor) Software Engineer:


For each user, OOo keeps a set of configuration files. Those files may only be accessed by one instance of OOo at a given time. One user can only run one single instance of OOo on a single given host - but in a networked environment with transparently mounted home-directories, two sessions on different hosts could be started accessing the same configuration (oh the horror!).

In order to prevent this kind of simultaneous access, OOo will create a lock-file in the root of the configuration direcory (e.g. $HOME/OpenOffice1.1/.lock) in which it saves the starting-time, username and hostname for the instance that has locked the configuration. Now, if another instance is started on another host, it sees the lockfile and warns the user.

The reason why we keep the hostname, is that in case of abnormal termination and stale lockfile we can notice that the lockfile was created on the same host we are running on. If that is the case, we can take over the lockfile and don't need to display a warning, since only one instance per user/host can run; any additional instance on the same host would connect to the socket of the first instance and just hand over it's commandline.



In short, it's all to do with preventing simultaneous access to the same user configuration files on a network. My guess -- though I haven't confirmed this -- is that if I'd selected the "single user" option in OOo's setup, this wouldn't have happened.


The solution
Well that's investigation and the reason. How can you try a DIY fix with resorting sniffing network traffic? After all, my solution won't work for your machine -- unless you happen to have a PC called "asok" on address 192.168.1.100 -- so here's a simple way to determine exactly what should be in your /etc/hosts...

1. Start OOo.
2. When it's running, drop into a console session and type cd ~/.openoffice.org/3 and list all the contents of this folder ls -la You'll get something like this...

total 20
drwx------  4 geoff geoff 4096 2010-06-23 17:04 .
drwxr-xr-x  3 geoff geoff 4096 2010-01-09 11:33 ..
-rw-r--r--  1 geoff geoff 132 2010-06-23 17:04 .lock
drwxr-xr-x 18 geoff geoff 4096 2010-01-10 17:25 user
drwxr-xr-x  8 geoff geoff 4096 2009-09-21 21:09 user_backup


3. The .lock file is the one we're after. Print out its contents with cat .lock Here's mine...

[Lockdata]
User=geoff
Host=asok.(none)
Stamp=4BF3169071E73BF7D70...
Time=Wed Jun 28 17:04:48 2010
IPCServer=true


4. And there you have it; the host name that OOo searches for on start-up. Tack it to the end of the appropriate line in /etc/hosts, and you're away!

192.168.1.100   asok
Before

192.168.1.100   asok   asok.(none)
After

So, did that work for you? Leave me a comment and let me know.


A footnote for Windows users: You'll typically find OOo's .lock file in the folder
C:\Documents and Settings\USER NAME\Application Data\OpenOffice.org\3

Follow Geoff Palmer on Twitter

June 20, 2010

Spam Warning: Canadian Health&Care Mall


Compromised Gmail accounts are being used to disseminate spam about Canadian Health&Care Mall, a bogus site offering cheap drugs online.

The email I received consisted of "Subject: sarah carter" and a single URL in the message area. Suspicious, I didn't click on the link but copied it to my browser, anonymized myself by activating Tor, and only then hit Enter. The original link -- www.mach3fr.com/default.php -- actually took me to www.pharmacymedshealthsite.net, home of a notorious spammer.

The website actually looks professional and reassuring with FAQs, contact addresses, and testimonials, but Spam Trackers, (amongst several others), have done a detailed analysis. I'll leave you to explore their findings -- including fake licenses, fake doctors, fake registrations and even fake buildings! (You gotta love Google Street View!)




Here's their "Head Office" at 186 Brock Street, Kingston, Ontario ...

... which is really the Hotel Dieu Hospital, which occupies the entire block.

Needless to say, avoid, avoid, avoid! And if you have a Gmail account, it might be time to change your password.

Follow Geoff Palmer on Twitter

June 16, 2010

Anonymous Surfing

Safeguarding online privacy and security is becoming more and more important, both for individuals and organisations, and one of the best and simplest ways of doing so is to use Tor. In short, Tor allows you to use the net anonymously, whether you're browsing or publishing information, using instant messaging or Internet Relay Chat.

"Tor's hidden services let users publish web sites and other services without needing to reveal the location of the site. Individuals also use Tor for socially sensitive communication: chat rooms and web forums for rape and abuse survivors, or people with illnesses.

Journalists use Tor to communicate more safely with whistleblowers and dissidents. Non-governmental organizations (NGOs) use Tor to allow their workers to connect to their home website while they're in a foreign country, without notifying everybody nearby that they're working with that organization."

Tor is reccomended by the Electronic Frontier Foundation (EFF) and groups such as Indymedia. It's also free and open source.


Installation
A typical installation bundle consists of three packages:

Vidalia - a configuration and monitoring GUI to allow you to control Tor.
Polipo - a caching web proxy that increases the browsing performance of Tor
Torbutton - a Firefox extension that allows you to flick anonymous browsing on and off at a button click.

You find all downloads on the download page. There are versions for Linux, Mac (both OS X and PowerPC) and Windows, with the latter coming in two flavours. There's a regular Installation Bundle, an 8.5MB package containing all the necessary goodies and automatic setups, and a 15MB Browser Bundle that requires no installation, making it ideal for USB drives. It unpacks to a Desktop folder named "Tor Browser" that you can then copy anywhere or even run in situ. Just open it and click on Start Tor Browser.exe. The package contains a portable version of Firefox that won't interfere with your installed version.

(You'll find full installation details on the Documentation page.)


You really should get a browser that handles PNG files!

Windows installation adds the Vidalia control to your Taskbar...




Firefox handles PNGs. It's free too!

...allowing you to control and configure Tor



Testing
To activate/deactivate, simply click the Tor control on Firefox's status bar...



... then check the changes on What Is My IP. Note that when you change from Disabled to Enabled or vice versa, Torbutton blocks the refreshing of tabs by clicking the Reload (F5). You need to click in the URL bar and hit Enter.


Important!
Tor's a great place to start, but simply installing it will not magically make you anonymous for ever more. Check out these warnings. You may need to change some of your browsing habits and/or tweak your software!


Follow Geoff Palmer on Twitter

June 10, 2010

How long will your digital data last?

How long will your digital archives last? It's a question I attempted to answer back in our April print issue, and I came up with the following table, drawn from a number of sources...


Media
Usable life
(years)
CD (factory pressed) 25
CD-R (cyanine and azo dyes 8-10
CD-R (phthalocyanine dye, gold metal layer) 100
CD-R (phthalocyanine dye, silver metal layer) 25
CD-RW, DVD-RW, DVD+RW 8-10
DVD (factory pressed) 25
DVD-R, DVD+R 20
Flash drive 10
Tape - Analogue 20
Tape - Digital 10-15

Estimated storage life for media stored under ideal conditions.


It seems I was a little optimistic. According to the French National Centre for Scientific Research discs "designed to last for centuries, actually rarely lasted longer than 5 to 10 years." In the most severe cases "the data on some discs lasted just one year."

It seems that buying name-brand discs is no guarantee. "Disc production varies. In the same brand we find discs produced by different manufacturers which means their quality and how long they last for is not necessarily the same."

So what are we to do? The best advice is to be vigilent:"Every two or three years ... copy your archive onto fresh discs. And after that, because these new discs will last a bit longer, you will have to re-copy them after five or six years."

And spread your archives around: "You must have your information in two places at least -- on a hard-disc, for example, and on another hard-disc or on a recordable DVD or CD."


Follow Geoff Palmer on Twitter

June 4, 2010

How to: Install Linux without a CD-Rom


I recently came across a puzzling problem: how to install Ubuntu Server 10.4 on the beast you see below.



It's a Norhtec MicroClient PC, fanless, about the size of a cigarette packet, that runs from a CF card (that large slot you see on the front). The idea was to bung a USB drive in one of the other slots and use it as a simple home backup server. We're not looking at blinding performance here, just something ticking over quietly in a cupboard doing differential backups.

The problem is this: while you can begin the installation from a USB drive, part way in it demands a CD-Rom, at which point you enter a deadly bind which I'll summarise here:

Load CD-Rom drivers? <yes> None found. Fail.
Load CD-Rom drivers? <no> Manually select them? <no> None found. Fail.
Load CD-Rom drivers? <no> Manually select them? <yes> Nothing in the selection list. Fail.

Every time the result was the same ...



One alternative is to mount the CF card on a CD-Rom-equipped machine and install it from there -- but that's not satisfactory because of hardware differences between the two machines. Another is to do a network installation or internet installation, both of which, frankly, involve a lot of mucking around, to say nothing of requiring a pre-exsting a network.

There must be a simple answer, I thought. And there is!

I searched high and low until I finally came across this, a brief how-to on the Acer Aspire Revo User forum. The answer, it turns out, is blindingly obvious: start with two copies of the installation image, boot with the first, then mount a second on a virtual CD-Rom and continue from there. Here's the process, step-by-step. You'll need a USB stick of at least 2GB.

1. Download Ubuntu and burn the image to the USB drive as usual. (Excellent details on how to do so at Step 2, here.)

2. Add a second copy of the .iso file. In this case I copied ubuntu-10.04-server-i386.iso to the USB.

3. Boot and install as usual in the targe machine until you reach the "Load CD-Rom drivers?" step. Choose No then, at "Manually select?" choose Yes.

4. Hit Ctrl+Del+F2 to take you into fresh virtual console and do the following ...

5. Identify your USB drive:

ls -l /dev/sd*
(Let's say we're using /dev/sdx.)


6. Create a new folder called ISO:

mkdir /iso


7. Mount the drive on it:

mount -t vfat /dev/sdx  /iso


8. Now here's the cunning bit. Create a link from the second copy of the installation image to the target machine's CD-Rom device:

ln -sf /iso/ubuntu-10.4-server-i386.iso  /dev/sr0


9. That's it! Hit Ctrl+Del+F1 to return to the installation screen. Where it asks you for the "Device for accessing the CD-Rom" enter:

/dev/sr0


... and you're away. Installation proceeds from what the system thinks is a CD-Rom but is actually a virtual drive linked to the USB. Oh the joys of Linux, where everything is a file!

One further point. A bit later on in the installation, at the partitioning stage, you'll be given the option of unmounting /dev/sdx. Pick No!


Follow Geoff Palmer on Twitter
Subscribe
Newsletter & SubscriptionsPC World is New Zealand’s top selling computing and technology magazine.

It provides up-to-the-minute editorial, insight and buying advice for personal computing, cell phones, game consoles, digital entertainment and broadband.
SIGN UP
PCWorldUpdate
PC World's weekly round-up of tech news, gear and game reviews, software selections, and handy How Tos.