Fix Windows as default boot on Ubuntu with Grub2 loader

If you install Ubuntu on a machine that came with Windows pre-installed you have the choice of preserving Windows and chose each time you boot which operating system to run. By default, the boot menu will list the current Linux kernel, followed by any older Linux kernel versions, followed by a memory test and finally the original Windows version. By changing a GRUB boot loader configuration file you can chose which one is the default that gets booted when you just wait and don’t touch the keyboard.

(NOTE: The following instructions assume the Grub2 loader used in Ubuntu 9.10 – earlier versions are different)

For example, the menu might look like this:

Ubuntu, Linux 2.6.31-14-generic
Ubuntu, Linux 2.6.31-14-generic (recovery mode)
memory test (memtest86+)
memory test (memtest86+, serial console 115200)
Windows Vista (loader) (on /dev/sda1)

You can configure Linux to — unless you tell it otherwise — always boot Vista by setting GRUB_DEFAULT in /etc/default/grub to the number of lines above the entry you want to boot (4 in this case), instead of 0 (zero) for the top entry. After any change to /etc/default/grub you need to also run sudo update-grub:

joe@ubuntu910:~$ gksudo gedit /etc/default/grub

GRUB_DEFAULT=4

joe@ubuntu910:~$ sudo update-grub

The problem with that is, when the next kernel update comes out, two lines will be inserted at the top and your default value now selects the wrong entry:

Ubuntu, Linux 2.6.31-15-generic
Ubuntu, Linux 2.6.31-15-generic (recovery mode)
Ubuntu, Linux 2.6.31-14-generic
Ubuntu, Linux 2.6.31-14-generic (recovery mode)
memory test (memtest86+)
memory test (memtest86+, serial console 115200)
Windows Vista (loader) (on /dev/sda1)

You would need to manually select the latest kernel and repeat the above steps with a new value of 6 in this case. This is clearly a problem. Fortunately, there’s a simple workaround: use a name instead of a number for selecting the default. Here is how it works:

1) List the bootable operating systems:

joe@ubuntu910:~$ fgrep menuentry /boot/grub/grub.cfg
menuentry “Ubuntu, Linux 2.6.31-15-generic” {
menuentry “Ubuntu, Linux 2.6.31-15-generic (recovery mode)” {
menuentry “Ubuntu, Linux 2.6.31-14-generic” {
menuentry “Ubuntu, Linux 2.6.31-14-generic (recovery mode)” {
menuentry “Memory test (memtest86+)” {
menuentry “Memory test (memtest86+, serial console 115200)” {
menuentry “Windows Vista (loader) (on /dev/sda1)” {

2) Mark and copy the entry you want to stay bootable, including double quotes, for example "Windows Vista (loader) (on /dev/sda1)".

3) Edit the Grub configuration and paste the new value after the GRUB_DEFAULT= (in place of 0 or 4 or whatever number):

joe@ubuntu910:~$ gksudo gedit /etc/default/grub
GRUB_DEFAULT=”Windows Vista (loader) (on /dev/sda1)”
joe@ubuntu910:~$ sudo update-grub

Note: Make sure to close the gedit window before doing sudo update-grub

That’s it, no more Grub configuration tinkering required! 🙂

Revolution in Prague – 20 years of freedom

This week it will be twenty years since I had the privilege to become an eyewitness to the Velvet Revolution (Czech: sametová revoluce) in then Czechoslovakia. With close friends of mine I attended a mass demonstration at Letna Park in Prague to mobilize for a general strike the following day, which ended 4 decades of Communist Party rule.

The following is an account of these events that I wrote about 10 years later, with photographs taken on that cold winter day.

[Start of original article]

Revolution in Prague

I have long had friends in Czechoslovakia, some 100 km (60 miles) east of where I was born. In 1968 a massive invasion of Soviet, East German and other Warsaw pact armies ended “socialism with a human face”, a daring but short-lived experiment by liberal communist prime minister Alexander Dubcek. My friend later showed me underground leaflets distributed then, that he had secretly stashed away. I was only seven years old when that happened, but I still remember being frightened after hearing my father and uncles talking about whether the invasion could mean WW3.

Nine years later, a group of intellectuals formed a human rights organization called “Charta 77”. Its leaders were playwright Vaclav Havel and Jiri Dienstbier. Another prominent member was Petr Uhl. The opposition group was persecuted and its members spent many years in Czech prisons.

Following “perestroika” in Russia under Mikhail Gorbachev, political change built up momentum across Eastern Europe. Poland voted for a non-communist government. Hungary took down the barbed wire along its border to Austria, triggering a mass exodus of East Germans to the west. Mass demonstrations in Leipzig, Dresden and other east German cities followed. Then thousands of East Germans invaded the West German embassy in Prague, forcing the East German government to let them emigrate. Soon after, the Berlin wall and border checkpoints to West Germany were opened and millions of East Germans could travel west for the first time in four decades.

Infected by the bold spirit of their neighbours, Czech students publicly demonstrated near Vaclav square in the center of Prague, commemorating Czech students who had dared to demonstrate against Nazi occupation 50 years earlier. Despite the non-confrontational theme, police violently broke up the demonstration, brutally beating the students. Photos of the events emerged and public outrage followed. The national television eventually had to show pictures of the clubbing. This triggered growing mass demonstrations on Vaclav Square in central Prague, which got so big that they had to be moved to Letna Park, the usual site of the annual Mayday parade of the Communist Party (KSC). Two big rallies were to be held on Letna Park over the weekend, to spread the call for a general strike, to demonstrate to the Communist Party that it was isolated and that the people wanted it to resign.

When I saw the reports on the TV news, I decided to leave for the Czech border the very next morning. East of the Bohemian Forest the snow was about 30 cm (1 ft) deep. Bohemia was covered in white and the infamous “Bohemian Wind” was blowing. I experienced no particular problems at the border and found relatively little traffic on the wintery roads. My 4wd Audi took me to Teplice, in northern Bohemia, some 60 km (40 mls) south of Dresden, without any problems due to ice or snowdrifts.

My friends were surprised to see me, of course. Throughout the afternoon we watched television. All regular programming had been canceled and there were only interviews, live reports and speeches. All censorship had been dropped. Journalists reported about anything, said anything, gave a forum to anybody. I was probably watching the most free television in all of Europa at that moment. Finally it was announced that Vaclav Havel would speak. I was utterly amazed. The man who had all his plays banned, had been jailed, made to earn his living shoveling coal, probably the most stubborn oppositional in this country could speak freely to his compatriots. And speak he did, I don’t remember if it was for 30 minutes or an hour. The camera was his, and the audience too. That same afternoon there were a million people on Letna park, at a demonstration of the Obcanske Forum (civic forum, the largest organization within which was Charta 77).

I talked to my friend about going to Prague on Sunday together. His wife was worried what might happen. What if they had their pictures taken, got arrested and lost their jobs? But a million people had demonstrated already and Havel had been on TV. The Berlin Wall had been broken too. This was not Prague 1968 any more. This time it would work. Well, if he was going then so was she.

The roads were icy as we headed down to Prague the next day, but it was a pleasure to drive in the Audi. Letna Square is on one of the hills high above the centre of Prague, which makes it cold and windswept in the winter. We parked in the suburbs within walking distance and followed the crowds.

The first thing that surprised us was that there was no police. Usually, they were all over the place. Now, not one. I was going to witness an event with anywhere upwards of 500,000 people and would not see a single policeman all afternoon, in what until days ago could only have been described as a police state. Instead we saw students with white armbands, or civic forum badges, who took care of everything. The government must have decided that violence was too risky.

This ice-hockey stadium at the edge of the square was used by the speakers, amongst them Havel, Dienstbier and Petr Uhl, who had just been released from jail were he had been taken for spreading the (luckily mistaken) rumour that a student had been killed during the demonstration the previous weekend.

The crowd was so huge, it was difficult to see how big its was from anywhere in the middle. So I passed up my camera to one of these guys and they were kind enough to take some pictures in various directions. No one was paranoid about having their pictures taken any more. People had shaken off fear.

This is the view towards the stage. Many people were wearing ski hats or jackets in the colours of the Czechoslovakian flag. This was not just an anti-communist or anti-Stalinist event, since it had been a foreign invasion that suppressed freedom 21 years earlier. This was very much a nationalist event too. The revolution of 1989 was as much about reclaiming national sovereignty lost in 1968 as it was about restoring democracy lost in 1948.

That’s the view towards the right hand side of the square. I was told Letna park can hold one million people. It had been full on Saturday. Looks pretty full to me on that Sunday too!

The slogans on three of the banners read: “Step down!”, “Civic Forum” and “Free Elections!”

The Victory sign became popular over night, as a sign of confidence in the effectiveness of the general strike the following Monday.

“Free newspapers, radio and television” (my Czech is pretty rudimentary…) — a message against censorship

On the left (in red): “End one party elections!” Below: Valtr Komarek was a renowned economist who came out against the government.

Two of the young people who organized security, directing traffic and handing out information. Yes, it was cold and windy too.

A Skoda car (Prague license plate) with “I love civic forum” in the rear window.

A revolutionary family effort. The child in the middle holds a banner with “Svoboda” (Freedom) written on it

Stalinism hit its dead end. All shop windows were plastered with political messages, as were the underground (subway) stations that are the arteries of public transport in Prague.

Photographs of the violently crushed students demonstration that caused the outrage triggering the mass demonstrations.

Pictures of Alexander Dubcek, father of the “Prague Spring” of 1968 and of Mikhail Gorbachov whose hands-off policy discouraged the Czech communists from resorting to violence in the way the Chinese leadership had done at Tien-An-Men square earlier that year.

View towards the top end of Vaclav Square, with the National Army Museum in the back. In front of the museum is the Vaclav Monument, which most of us remember from pictures showing it surrounded by Russian tanks in August 1968.

A field of candles lit for the victims of the government.

Cheerful pedestrians were waving the V-sign at passing motorists who honked their horns in solidarity.

V-signs and flags every where — as along the street between Vaclav Monument and the museum.

People had been waiting for this day for at least 21 years. Until a few years aerlier the National Army Museum in the background still bore the bullet holes were it had been hit by Soviet tank artillery.

Ladas, Skodas, Trabants and Wartburgs in a freedom parade.

The following day was scheduled to be a general strike. The opposition groups were headed by well known intellectuals. The big demonstrations had all been in Prague. People still were not sure what the outcome would be in the smaller towns, away from the capital and how effective the strike call would be amongst industrial workers, such as the Skoda factories.

The right to go on strike

The right to go on strike
(See here for an English Translation of this flyer)

But Czechs have long held intellectuals in high respect, like to read and to watch plays. Famous actors, whole theaters and even national football (soccer) players publicly came out in support of the strike call. By Monday afternoon, when I was back in Germany, the figures were in: The strike was a great success, the government had lost every pretense of being in control and there was nothing else left but to withdraw in an as orderly way as possible. Within days, a transitional cabinet was established and former oppositionals took control of public institutions. An election later confirmed that communist majority had always been a carefully constructed fiction.

Vaclav Havel (president of the Czech Republic until February 2003) is one of the politicians who I respect most, for his courage, his non-violent struggle, his sense of humour and his humane values.

[End of original article]

Twenty years later

I went back to the Czech Republic about ten years later, with my wife and kids. We visited Prague as tourists. I was amazed how much everything had changed. I heard English spoken everywhere, where before most tourists were from East Germany or other parts of the Eastern Block. Prague had become a magnet for young people from all over the world.

Things have not been easy for people, as not all have materially benefited equally from the changes. The old planned economy suffered from low productivity and horrendous ecological problems (especially acid rain in the lignite mining areas in Northern Bohemia), but everybody had been guaranteed a job of some sort. Hopes had been so high after 40 years of repression and mismanagement that people were bound to be disappointed by reality (just as Americans were bound to be somewhat disappointed after voting for change in the 2008 US Presidential Election, I might add).

Rule by a repressive one party bureaucracy was a dead end for Czechoslovakia. Now the Czech Republic is a free country again. Its citizens need not fear being arrested or losing their jobs or be denied education for speaking their minds. They are free to travel and to trade and to seek opportunities.

The events of twenty years ago gave me hope in the human spirit. They showed me what people can achieve when they dare to dream, to follow their moral convictions and to reach out to their fellow human beings instead of being bowed by fear.

NTFS disk corruption on frequent file creates and deletes

I recently upgraded a secondary hard disk in a Windows machine from a Seagate Barracuda 7200.11 1 TB drive to a Western Digital Caviar Green WD15EADS 1.5 TB drive. Mirror imaging the data off the old drive to the new drive using the Linux dd utility from an Ubuntu live CD went very smoothly and completed in a little over three hours, but I subsequently hit a snag when I tried to resize the partition on the larger drive.

The image copy of the 1 TB NTFS partition resulted in a 1 TB partition followed by 500 GB of unallocated space, which I wanted to add to the free space of the NTFS partition. That should be no problem for Linux gparted, but only if the partition to be resized is internally consistent. If it is not, one will have to use CHKDSK /F under Windows to fix it first.

C:\>chkdsk m: /f
CHKDSK is verifying files (stage 1 of 3)...
0 percent complete. (0 of 21942736 file records processed)
Deleted corrupt attribute list entry
with type code 144 in file 2300.
Deleted corrupt attribute list entry
with type code 176 in file 2300.
Deleting corrupt attribute record (144, $I30)
from file record segment 2300.
Deleting corrupt attribute record (176, $I30)
from file record segment 2300.
Deleted corrupt attribute list entry
with type code 144 in file 2332.
Deleted corrupt attribute list entry
with type code 176 in file 2332.
Deleting corrupt attribute record (144, $I30)
from file record segment 2332.
Deleting corrupt attribute record (176, $I30)
from file record segment 2332.
Deleted corrupt attribute list entry
with type code 144 in file 2342.
Deleted corrupt attribute list entry
with type code 176 in file 2342.
Deleting corrupt attribute record (144, $I30)
from file record segment 2342.
Deleting corrupt attribute record (176, $I30)
from file record segment 2342.
21942736 file records processed.
File verification completed.
41475 large file records processed.
0 bad file records processed.
1552 EA records processed.
0 reparse records processed.
CHKDSK is verifying indexes (stage 2 of 3)...
10 percent complete. (4118 of 81648013 index entries processed)
Correcting error in index $I30 for file 2300.
10 percent complete. (5149 of 81648013 index entries processed)
Correcting error in index $I30 for file 2332.
Correcting error in index $I30 for file 2342.
34 percent complete. (23316097 of 81648013 index entries processed)
Correcting a minor error in file 2300.
Correcting a minor error in file 2332.
Correcting a minor error in file 2342.
81648013 index entries processed.
Index verification completed.
CHKDSK is recovering lost files.
997 unindexed files processed.
997 unindexed files processed.
CHKDSK is verifying security descriptors (stage 3 of 3)...
21942736 security descriptors processed.
Security descriptor verification completed.
Inserting data attribute into file 2300.
99 percent complete. (1 of 939015 data files processed)
Inserting data attribute into file 2332.
Inserting data attribute into file 2342.
939015 data files processed.
Correcting errors in the master file table's (MFT) BITMAP attribute.
Correcting errors in the Volume Bitmap.
Windows has made corrections to the file system.

1465135996 KB total disk space.
871385828 KB in 18183533 files.
7651336 KB in 939018 indexes.
0 KB in bad sectors.
22057856 KB in use by the system.
65536 KB occupied by the log file.
564040976 KB available on disk.

4096 bytes in each allocation unit.
366283999 total allocation units on disk.
141010244 allocation units available on disk.

Googling for these error messages, I found a Knowledgebase article by Microsoft about disk corruption on Windows NT that could occur with frequent file creates and deletes (for which they had a fix) and a posting by a Windows XP user who also frequently creates and deletes files.

The three files reported by CHKDSK were three folders on my hard disk. CHKDSK converted them into zero length files. After recognizing this, I deleted these files and recreated the original directories. Since then my application has been working again.

As it so happens, these three directories are three places on my computer where the largest number of files is created and deleted in rapid and random succession (there’s one process each creating them and one process each asynchronously consuming them), just like in the articles that I googled.

If anyone else comes across a similar problem with NTFS with similar symptoms, I would be glad to hear from them.

Update 2009-11-20:
The three corrupted folders that were turned into zero length files by ChkDsk did not actually disappear completely. Instead their contents was moved to a hidden folder tree. Note the above lines:

CHKDSK is recovering lost files.
997 unindexed files processed.

I looked on the hard disk for hidden files or folder from the command prompt:

M:\> dir /ah m:\found.*
 Volume in drive M is wd15
 Volume Serial Number is E861-DD52

 Directory of m:\

2009-11-18  17:39    <DIR>          found.000
               0 File(s)              0 bytes
               1 Dir(s)  576,809,738,240 bytes free

This hidden folder contains the three lost directories:

M:\>dir m:\found.000
 Volume in drive M is wd15
 Volume Serial Number is E861-DD52

 Directory of m:\found.000

2009-11-20  12:06    <DIR>          dir0000.chk
2009-11-18  17:39    <DIR>          dir0001.chk
2009-11-18  17:39    <DIR>          dir0002.chk
               0 File(s)              0 bytes
               3 Dir(s)  576,804,810,752 bytes free

Looking at the contents of each of these folders I could soon tell which was which and move those files back to the original path.

Marvell MC85 with NdisWrapper on Ubuntu 9.10

Last week I updated my Gateway M-6750 from Ubuntu 9.04 to Ubuntu 9.10 (“Karmic Koala”) and managed to get myself into a right mess, as I lost access to both my wired and wireless internet connections. I then burnt an Ubuntu 9.10 live CD from an ISO image dowloaded with uTorrent and reinstalled from there. That got the wired connection working, but the wireless was still gone. Before I fixed that problem I upgraded my notebook hard disk drive, complete with dual-boot Vista and Ubuntu partitions, to a new 500 GB drive (see yesterday’s blog post).

The Marvell MC85 doesn’t have a native Ubuntu driver yet. Therefore you have to use a Windows XP driver for it as described here. You can download the Netgear wn311t_setup_4_1.exe driver set and extract its content on either XP or Wine. You’ll end up with NetMW14x.inf, netmw143.sys and netmw145.sys. Only NetMW14x.inf and netmw145.sys are actually needed.

See my instructions in my earlier blog post for the initial steps (look for a section labeled “Update, 2008-03-18”).

Installing the driver with ndiswrapper does almost everything. The magic ingredient that was missing when I tried to get it working this time was to ensure that ndiswrapper loads every time, before using the Network Manager or when booting up. Without ndiswrapper the Windows driver won’t be loaded and Ubuntu simply won’t see the wireless adapter. It will show up as unclaimed on this command:

lshw -C network

*-network UNCLAIMED
description: Ethernet controller
product: Marvell Technology Group Ltd.
vendor: Marvell Technology Group Ltd.
physical id: 0
bus info: pci@0000:02:00.0
version: 03
width: 32 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list
configuration: latency=0
resources: memory:f6000000-f600ffff memory:f4000000-f400ffff
*-network
description: Ethernet interface
product: RTL8101E/RTL8102E PCI Express Fast Ethernet controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:06:00.0
logical name: eth0
version: 01
serial: 00:e0:b8:XX:XX:XX
size: 10MB/s
capacity: 100MB/s
width: 64 bits
clock: 33MHz
capabilities: pm vpd msi pciexpress bus_master cap_list rom ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half latency=0 link=no multicast=yes port=MII speed=10MB/s
resources: irq:28 ioport:4000(size=256) memory:fa200000-fa200fff memory:c0000000-c001ffff(prefetchable)

Ubuntu uses file /etc/modules to enumerate extra drivers and kernel modules that need to be loaded at boot time. Therefore I needed to add a line in /etc/modules using gedit:

gksudo gedit /etc/modules

Add

ndiswrapper

in a line of its own at the bottom of the file and save it, then restart your machine. After the reboot you should be able to use the Network Manager to manage wireless connections, including looking for available networks and configuring security parameters (for WPA, WPA2 / RSN) to be able to connect.

I found many other threads and blog postings that discussed manually editing configuration files and configuring wpa_supplicant, but none of that is required if you just configure Ndiswrapper for NetMW14x.inf, tell NDiswrapper about the device ID and then ensure that Ndiswrapper is always laoded. Here is the lshw output with Ndiswrapper having claimed the wireless adapter:

*-network
description: Wireless interface
product: Marvell Technology Group Ltd.
vendor: Marvell Technology Group Ltd.
physical id: 0
bus info: pci@0000:02:00.0
logical name: wlan0
version: 03
serial: 00:16:44:XX:XX:XX
width: 32 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=ndiswrapper+netmw14x driverversion=1.55+NETGEAR,10/04/2006, 2.1.4.3 ip=192.168.42.122 latency=0 link=yes multicast=yes wireless=IEEE 802.11g
resources: irq:16 memory:f6000000-f600ffff memory:f4000000-f400ffff
*-network
description: Ethernet interface
product: RTL8101E/RTL8102E PCI Express Fast Ethernet controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:06:00.0
logical name: eth0
version: 01
serial: 00:e0:b8:XX:XX:XX
size: 10MB/s
capacity: 100MB/s
width: 64 bits
clock: 33MHz
capabilities: pm vpd msi pciexpress bus_master cap_list rom ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half latency=0 link=no multicast=yes port=MII speed=10MB/s
resources: irq:28 ioport:4000(size=256) memory:fa200000-fa200fff memory:c0000000-c001ffff(prefetchable)

Notice the driver=ndiswrapper+netmw14x after configuration:. If you get that you should be in business! 🙂

Backing up / migrating your hard disk data with a Ubuntu live CD

Recently two hard disks died in my household, both of which were Windows boot disks, just as if I needed a reminder how quickly one can lose important data. This and some troubles while upgrading my Gateway M-6750 notebook from Ubuntu 9.04 to Ubuntu 9.10 (“Karmic Koala”) prompted me to get some spare hard disks and do a complete backup / upgrade.

I upgraded my notebook from 250 GB to 500 GB, and I can now keep my old drive as a safe snapshot to go back to if anything should ever go wrong with the new drive.

The most important tools needed for this were an Ubuntu 9.10 live CD from an ISO image (downloaded with uTorrent) and the NewerTech Universal USB 2.0 Adapter, which lets you hook up just about any IDE or SATA drive to a USB-equipped computer.

My notebook has Windows Vista on it, for which Gateway did not ship an install DVD – theres’s only a recovery partition. For installing Ubuntu I had originally shrunk the Vista NTFS partition on the 250 GB drive to make space for a 60 GB Linux partition, which provides a dual-boot feature via the GRUB loader.

I ordered some WD Scorpio Blue 500 GB notebook hard disks (WD5000BEVT) from Amazon and they arrived the next day. These are good work horse drives. I hooked one up to the NewerTech Universal USB 2.0 Adapter and booted into the Ubuntu Live CD.

From there I started a terminal window and used the “dd” command to make an image copy of the drive, see below. Be very careful with the source and destination specification. Use fdisk -l to verify which drive is which and in some cases the USB drive will appear as /dev/sdc instead or /dev/sdb. For IDE (PATA) drives the names could be /dev/hda, /dev/hdb, etc. If you specify the wrong drive as the destination you could wipe out all your data!

sudo dd if=/dev/sda of=/dev/sdb

This will copy every single byte from the first SATA hard disk to the second SATA (or USB 2.0) hard disk on the machine. You won’t have to worry about what partitions there are and which one is bootable, because it will simply copy all of them.

I started it last thing before I went to bed. It took about 2 hours to copy the entire 250 GB of the existing to the existing WD2500BEVS to the new drive. In the morning I shut down Ubuntu, opened the bottom of the case and transplanted the new drive inside, which took a small screw driver and about 10 minutes. Then I fired up the machine again and it successfully booted both Windows Vista and Ubuntu 9.10 off the new drive.

Since the new drive had more space, I wanted to resize the partitions so that each could take 250 GB instead them having to share that space. GNU utility gparted lets you do that. It can shrink, grow and move partitions pretty any way you like. You can tell it the new size of a partition and how much space to leave before and after it.

I first did not know that gparted can move partitions as well as resizing them, so I decided to remove the Ubuntu partitions, grow the NTFS (Windows) partitions and the reinstall Ubuntu into the remaining space. Be careful when removing an Ubuntu partition in a dual-boot system, because the active loaded and its menu file will be in the Ubuntu partition. Thus if you shoot it without first making the Windows partition the active boot partition you won’t be able to boot off that hard disk any more! Either boot of your operating system install CD/DVD or off an operating system recovery partition (if available) and select the command prompt. From there use fixldr /mbr (2000/XP/2003) or bootrec /FixMbr (Vista / 7) to rewrite the Master Boot Record. This will disable the Ubunto bootstrap loader. Make sure Windows will boot without the Ubuntu boot menu coming up. No you can remove the Ubuntu
partitions.

With sudo gparted on the Ubuntu Live CD you can resize the NTFS partition for Windows to any sensible value. In my case I got an error because some NTFS data structures were in an inconsistent state. To fix that I had to boot Windows and run chkdsk /f from a command prompt and then restart. Windows fixed the problem and one restart later I was back in Ubuntu live and gparted was able to resize the partition

After that I installed Ubuntu into the free space that I’d left for it on the 500 GB drive.

Given the low cost of SATA and USB 2.0 drives versus the time and data lost when something goes wrong with your hard disk, I do recommend a full image backup like mine. The dd command also lets you copy drives or partitions to files, so you can back up multiple machines to one large drive.

Electricty in Japan

Our household of four uses about 500 kWh of electricity per month on average, a considerable portion of which is consumed by the computers I run my business on. The total tends to be more in July and August, when we also run air conditioners to take the edge of 35+ centigrade heat, whereas in the winter our municipal gas bill tends to go up a lot because of heating. All year round we use gas for cooking and hot water.

TEPCO (Tokyo Electric Power Company), the local utility for the Kanto area, charges us about 25 yen per kWh on average (the exact rate varies a bit month by month, as the company tries to even out charges for its customers against seasonal consumption patterns). That’s about US$0.28 / EUR 0.18 per kWh at current exchange rates.

While electricity in Japan tends to be expensive by US standards, its supply is also extremely reliable. Until a few years ago uninterruptable power supplies (UPS) for domestic use used to be almost unheard of here, because we’d expect maybe one brief blackout per year. The Japanese power grid tends to be a lot more redundantly laid out and with more spare capacity than in the US, where cost is the top priority.

The voltage of A/C power in Japan is 100 V compared to 230 V in Europe and 110V in the US. Western Japan (Nagoya, Osaka and further west) uses a mains frequency of 60 Hz like the US whereas Eastern Japan (including Tokyo) uses 50 Hz like Europe. Equipment sold in Japan works with either frequency, but often the Wattage rating is slightly different depending on the frequency. Japan uses two pin plugs like ungrounded US plugs and usually they’re not polarized. If equipment has a ground wire it is attached separately, not via a plug pin.

Electrical appliances purchased in the US will usually work OK at the slightly lower voltage of Japan, but the reverse is more risky. I once managed to fry a power brick for a USB hard disk which I took to the US and used without a step-down transformer (110 V to 100 V). Moving between Europe and Japan, a transformer is almost always required, with the exception of consumer electronics items that use a 100-240 V universal switched mode power supply. These days the latter category includes almost all notebook computers, digital cameras, video cameras and many desktop computers, flat screen monitors, etc.

Japan generates about 30% of its electricity from nuclear power, 7% from hydroelectric dams and the rest from fossil fuels including coal, natural gas (imported as LNG) and oil.

In recent years the electric utility companies have been aggressively promoting “orudenka” (all electric power) homes, i.e. new homes that use electricity for cooking, cooling, heating and hot water, with no propane, natural gas or heating oil usage in the house.

So called “EcoCute” heat pumps produce hot water using ambient heat and electricity. Even if they manage to provide two extra units of heat for every unit of electricity, they are unlikely to save much CO2 output compared to burning gas, as fossil fueled power plants only produce one unit of electricity for every three units of heat from burning fuel. Yes, it may be better to use a heat pump to make hot water from electricity than a simple heater element, but at the power station you’re still wasting 60-70 percent of the primary energy from coal, oil or LNG, which goes as waste heat into a river or ocean or up a cooling tower. It would make more sense to burn gas at home to heat water, instead of two conversions (from heat to electricity to heat) and transmission losses. With the current power infrastructure EcoCute is hardly the way of the future.

EcoCute would make sense only with plenty of wind, geothermal or hydro power to supply electricity without pumping out CO2 or piling up toxic radioactive waste. In reality Japan is generating almost two thirds of its power from fossil fuels. Its utility companies are sitting on piles of nuclear waste that has nowhere to go. Japan is lagging far behind other developed countries in wind power or other renewable energy sources while confidence in its nuclear industry has been shaken by several high profile accidents since the 1990s.

If you’re going to burn anything at all to make electricity (as we’ll probably have to for a few more decades), a much more promising concept is the “Ene Farm” combined heat and power (CHP) generator promoted by several gas utilities and oil companies, launched in Japan in June 2009. It’s a residential fuel cell producing electricity from hydrogen and oxygen while heating water with the waste heat. Like in prototype automative fuel cells (e.g. Honda), the hydrogen is extracted from natural gas through a process called steam reformation. A fuel cell CHP system located where heat can be used directly is about the most economical way imaginable of using fossil fuel, if you’re going to use it at all.

The biggest current drawback of Ene Farm is the high cost of the system: 3,255,000 yen ($US36,000) for a system that puts out 250 to 700 W of power and a multiple of that in heat that goes into a 200 l storage tank. A 1,400,000 yen subsidy by government does make it a bit more affordable, but still its cost needs to come way down to make it popular enough to make a big dent in CO2 emissions from Japanese homes. Its proponents are hoping to reduce the equipment cost by as much as 90% over the next decade. I hope they succeed – at a lower price it could be a killer product.

A very similar idea, but taking a different route is the Linear Free Piston Stirling Engine (LFPSE) cogeneration unit jointly developed by Infinia, Enatec, Bosch and Rinnai (a Japanese maker of gas appliances). Instead of a fuel cell it uses a Stirling engine to convert heat into mechanical motion, which via a moving coil generates electricity. The waste heat produces hot water or heats a home. First generation prototypes are being tested in Europe from 2008 to 2010, with mass production by Rinnai in Japan scheduled for 2011.

Dial +44 70 (UK number) for international online fraud

A few years ago I created the Scam-O-Matic (www.scamomatic.com), a website that every month has helped thousands of people worldwide by automatically diagnosing online fraud emails that people have submitted to it. Scamomatic.com recognizes fake lotteries, “dead customer” scams, “dying widow” scams and many other common formats from scammers from Nigeria that you may have seen in your inbox before. Even when it can’t pinpoint the exact type of scam, it often recognizes it as a generic scam format, largely thanks to the presence in the email of UK phone numbers that start with +44 70. These numbers are everywhere in Nigerian online scams, regardless of the precise scam format. The +44 70 prefix might as well be called the country code of Nigerian scammers.

If you receive any email that mentions any +4470 phone number, do not reply to it! You can submit the body of any suspicious email message to www.scamomatic.com for instant feedback about what kind of scam it might be.

These +4470 numbers are a gift to online scammers by British phone regulators. They are primarily owned by obscure British phone companies offering an anonymous call forwarding service. The economic model of these services is simple: The caller dials a rather expensive UK number and the UK service provider forwards the incoming call to a somewhat less expensive to call international number (for example a Nigerian mobile phone, which remains hidden from the caller), pocketing the difference between the call rates. For example, the caller might pay 50 cents per minute to call a +44 70 number and the call will then be forwarded to a Nigerian mobile phone that costs 25 cents per minute, leaving 25 cents per minute as a net margin for the service operator. The more successful the scammers are, the more money the phone company makes. Who ever said crime doesn’t pay?

These UK phone numbers are very attractive to scammers: When people can be made to believe that they are dealing with a bank, lawyer or government official in London, UK when they’re actually talking to a scammer on his cell phone in an Internet cafe in Lagos, Nigeria then they are much more easily defrauded by criminals.

As far as I can tell these numbers aren’t really being used for any other purpose than to enable international online crimes to be committed. In some nine years of tracking Nigerian scam emails, I have yet to come across a single legitimate user of a +44 70 number. I really don’t understand why the British government has allowed those services to continue to operate.

Now, of course the service operators can claim that they don’t know that their services are being used for criminal purposes unless someone tells them about it. On the other hand, they are not exactly making it easy to report abuse and the high prices of these services means that it’s unlikely that they’ll get much legitimate use, if any.

There are several ways to curb abuse, other than suspending +44 70 numbers altogether and I would encourage the UK government to seriously consider them:

  • The UK regulators could make it a requirement that calls via this service either originate in the UK or terminate in the UK, i.e. to prevent unrestricted global relaying, with say calls from India or the US being forwarded to Nigeria or Côte d’Ivoire.
  • The UK regulators could require service providers to announce the country name of the phone number to which the call is being forwarded if the destination number is not a UK number.
  • The UK regulators could require service providers to block forwarding to mobile phone numbers in certain countries, e.g. Nigeria

Below is a sample list of +44 70 numbers that appeared in Nigerian scams reported to Scam-O-Matic over the course of the last seven days. These roughly 60 phone numbers per day are only the tip of the iceberg:

+447005801505
+447005802020
+447005810692
+447005934945
+447005942459
+447005963237
+447005977097
+447006001100
+447006002121
+447006002413
+447006029116
+447006062478
+447010023307
+447010027439
+447010027978
+447010027983
+447010028455
+447010030769
+447010285923
+447010306559
+447010476294
+447010786457
+447011120379
+447011120510
+447011120524
+447011121450
+447011121596
+447011128170
+447011129280
+447011129286
+447011129446
+447011130062
+447011130670
+447011130769
+447011131077
+447011131152
+447011133259
+447011140499
+447011140945
+447011140989
+447011146747
+447011146830
+447011147295
+447011149054
+447011152991
+447011153129
+447011162749
+447011163186
+447011163846
+447011164243
+447011182522
+447011183455
+447011184113
+447011196412
+447011197245
+447011197787
+447014225697
+447014232391
+447014232411
+447014232442
+447014236733
+447014244984
+447014275175
+447014275728
+447017026507
+447017430128
+447017769494
+447017848035
+447023011587
+447023056559
+447023058575
+447023069806
+447023086665
+447023087509
+447023092593
+447024010876
+447024010915
+447024011554
+447024012660
+447024013770
+447024014859
+447024016712
+447024017968
+447024018504
+447024018707
+447024018725
+447024018963
+447024019584
+447024019588
+447024021204
+447024021389
+447024023138
+447024023643
+447024024530
+447024024914
+447024024938
+447024025942
+447024028606
+447024029852
+447024032255
+447024033542
+447024034362
+447024034768
+447024035958
+447024036606
+447024037907
+447024038051
+447024038950
+447024041571
+447024041989
+447024042397
+447024043571
+447024045842
+447024046548
+447024047607
+447024047708
+447024051081
+447024051604
+447024053655
+447024054764
+447024056650
+447024056684
+447024057656
+447024057695
+447024059725
+447024061362
+447024061659
+447024061805
+447024062162
+447024063633
+447024063645
+447024064180
+447024065549
+447024066713
+447024066858
+447024067752
+447024068617
+447024069933
+447024070671
+447024071597
+447024071804
+447024071867
+447024072603
+447024072995
+447024073988
+447024074220
+447024074568
+447024074742
+447024075722
+447024075954
+447024077025
+447024078351
+447024079530
+447024079908
+447024080526
+447024080571
+447024080634
+447024082668
+447024082680
+447024082728
+447024083093
+447024083705
+447024084762
+447024084918
+447024084994
+447024086967
+447024087401
+447024087599
+447024087905
+447024091678
+447024091701
+447024091706
+447024092775
+447024092795
+447024092863
+447024095774
+447024095778
+447024095878
+447024096802
+447024096869
+447024097854
+447024098802
+447024098874
+447024099606
+447031740924
+447031742574
+447031744227
+447031744980
+447031744994
+447031745967
+447031746067
+447031746887
+447031747046
+447031747509
+447031749721
+447031801246
+447031801866
+447031803498
+447031803820
+447031808512
+447031809778
+447031814575
+447031814720
+447031815436
+447031816735
+447031818230
+447031821851
+447031822608
+447031823431
+447031824330
+447031825003
+447031826670
+447031830878
+447031833248
+447031833760
+447031834660
+447031835615
+447031835762
+447031837227
+447031843396
+447031844360
+447031845639
+447031846542
+447031850801
+447031851126
+447031855107
+447031855527
+447031858919
+447031859268
+447031859327
+447031859972
+447031861174
+447031861534
+447031865718
+447031877392
+447031877975
+447031880502
+447031885537
+447031890014
+447031891762
+447031894541
+447031898197
+447031903871
+447031906765
+447031908701
+447031909751
+447031911974
+447031913322
+447031915331
+447031918554
+447031918592
+447031918698
+447031918840
+447031920863
+447031928723
+447031930960
+447031931805
+447031934581
+447031938867
+447031940670
+4470319419882
+447031943771
+447031954666
+447031956661
+447031958680
+447031960513
+447031964131
+447031971731
+447031971766
+447031972833
+447031972850
+447031973785
+447031974969
+447031978795
+447031979858
+447031982694
+447031983660
+447031983882
+447031984862
+447031988864
+447031993596
+447031993967
+447031996818
+447032334576
+447035900183
+447035900344
+447035900914
+447035901588
+447035902188
+447035902683
+447035910276
+447035911140
+447035912873
+447035913994
+447035915768
+447035922616
+447035923742
+447035924448
+447035927916
+447035928180
+447035931142
+447035937446
+447035939194
+447035939320
+447035940617
+447035944729
+447035944779
+447035947431
+447035950853
+447035951254
+447035951405
+447035954295
+447035955376
+447035956312
+447035959966
+447035960942
+447035965038
+447035966176
+447035966188
+447035966289
+447035966480
+447035968588
+447035969249
+447035969496
+447035969754
+447035969801
+447035969823
+447035972572
+447035973164
+447035973821
+447035977317
+447035978042
+447035978343
+447035978550
+447035983963
+447035988651
+447035988847
+447035989086
+447035992118
+447035996148
+447035997215
+447035997533
+447035998886
+447035999080
+447040110515
+447041743214
+447045702581
+447045704323
+447045704570
+447045705126
+447045705374
+447045706975
+447045707234
+447045707660
+447045708253
+447045709129
+447045709292
+447045710531
+447045710917
+447045711325
+447045712243
+447045712434
+447045712662
+447045712816
+447045712993
+447045713815
+447045714219
+447045719541
+447045720546
+447045721125
+447045721617
+447045722125
+447045724094
+447045725176
+447045727388
+447045729804
+447045733035
+447045733518
+447045736862
+447045742669
+447045743467
+447045747569
+447045748609
+447045754338
+447045759317
+447045767521
+447045768060
+447045770961
+447045776356
+447045780693
+447045782120
+447045783777
+447045785147
+447045785239
+447045790181
+447045791709
+447045795051
+447045798638
+447045799030
+447053491702
+447053492393
+447075158182
+447092849621
+447092861761
+447092864823
+447092980578
+447092981646
+447092981769
+447092982175

Computer power usage: AMD, Intel and VIA

The Kill A Watt EZ Electricity Usage Monitor P4460 by P3 International is a popular gadget in North America for measuring power usage by electronics and electrical appliances. You simply plug it into the wall socket and plug the appliance into the device and it will give you instant read-outs of power usage in Watt, electricity consumption over time in kWh as well as electricity costs (if you enter the price the utility charges per kWh). Knowing exactly how much electricity each device consumes encourages smart choices about when and how you use them.


Watt Checker Plus (2022-04)

While Kill A Watt models have been available for 115V and 230V markets in North America and Europe, I could not find any mention of a 100V model for Japan. As it turned it out, the device is made by Prodigit in Taiwan, who do make a model for Japan (2022-04) which is sold here under the name ワットチェッカーPlus (“Watt Checker Plus”) by Keisoku Giken, Co. Ltd. I bought mine through Amazon.co.jp for JPY 5,670 (about US$63, $28 more than in the US).

Here are some preliminary results:

  • Acer Aspire M5201 (desktop: AMD Athlon X2 5000+, 2.60 GHz, integrated Radeon HD 3200, 4 GB DDR2 RAM, 320 GB + 1000 GB 3.5″ SATA HD):
    – 68 W at idle
    – 120 W at 100% CPU (both cores loaded)
  • eMachines T6212 (desktop: AMD Athlon 64 3200+, 2.00 GHz, discrete Asus EAH3450 256 MB, 3 GB DDR RAM, 160 GB 3.5″ HD):
    – 69 W at idle + “performance on demand”
    – 75 W at idle + “maximum performance”
    – 90 W at 100% CPU (only core loaded)
  • Dell Dimension 3100C (desktop: Intel Celeron D 331, 2.66 GHz, 1 GB RAM, 160 GB 3.5″ SATA HD):
    – 78 W at idle
  • VIA MM3500 (desktop: VIA C7, 1.5 GHz, 2 GB DDR2 RAM, 2 x 1 TB SATA WD10EADS):
    – 41 W at (almost) idle
    – 69 W loaded
  • Gateway M-6750 (notebook: Core 2 Duo T5450, 1.67 GHz, 3 GB DDR2 RAM, 250 GB 2.5″ SATA HD):
    – 24 W at idle
    – 48 W at 100% CPU (both cores loaded)
  • Mac mini (desktop: Core 2 Duo T5600, 1.83 GHz, 2 GB DDR2 RAM, 80 GB 2.5″ SATA HD):
    – 21 W at idle
  • Lenovo S10e (Notebook: Atom N270, 2 GB DDR2 RAM, 160 GB 2.5″ SATA):
    – 20 W at 90% CPU load
  • Dell Latitude CPx J650GT (notebook: Intel Pentium III Mobile, 650 MHz, 512 MB PC100 RAM, 60 GB 2.5″ IDE HD):
    – 13 W at idle, screen off
  • Dell 2408WFP (monitor: 24″, 1920 x 1200):
    – 48 W at brightness 0%
    – 60 W at brightness 12%
    – 120 W at brightness 100%
  • Dell 1905FP (monitor: 19″, 1280 x 1024):
    – 27 W at brightness 0%
    – 32 W at brightness 50%
    – 36 W at brightness 100%
  • Epson PM-A950 (inkjet printer / scanner / copier):
    – 3 W at standby (display off) or soft “off”
    – 15 W at idle (display on)
    – 19 W while scanning
    – 25 W while printing
  • Mitsubishi 25T-SY3 (colour TV: 25″, CRT, 110 W):
    – 80 to 100 W (depending on brightness of scene)

The inefficiency of the Celeron D was to be expected. It’s based on the infamous Pentium4 architecture that was later abandoned by Intel in favour of the more efficient Pentium III / Pentium M derived Core architecture.

Also expected was the frugality of the Atom N270 netbook, but I was positively surprised by how little power the Pentium III Mobile machine (Dell Latitude 650) consumed. Neither of these machines is a scorcher, but given its age the 8 year old Dell is doing surprisingly well as a temporary web browser and e-mail machine for my wife after her Dimension 3100C’s hard disk failed last week.

My biggest surprise was that the Mac mini uses only half the electricity of the VIA server I built (21 W versus 42 W). Admittedly, it only has one notebook drive (80 GB 2.5″) instead of two high capacity 3.5″ drives, but that should only account for about one quarter of the advantage of the faster Intel Mac over the slower VIA. The 80 GB single platter Hitachi TravelStar 2K250 in the Mac only draws a tiny 0.55 W at idle, but the Western Digital WD10EADS in the VIA server are doing quite well for a drive with 1 TB and 3 disks at only 2.8 W each at idle.

Note also that my Mac mini is last year’s model (2008). A newer model that came out in early 2009 (2.0 GHz Core2 Duo, 2GB DDR3 SDRAM, 320GB HD, GeForce 9400M video) is rated even lower, at less than 14 W at idle. Apple calls the Mac mini the “most energy-efficient desktop computer” and not without cause.

I also expected my old CRT TV to use considerably more power than my flat screen monitors. That was true for the 19″ monitors, but not necessarily for the 24″, depending on screen brightness settings.

Another surprise was that it makes no difference whatsoever whether I switch off my inkjet printer when I’m not expecting to print anything soon. After powering it on or after any printing, copying or scanning, the small LCD display will stay lit for a few minutes, with the printer drawing about 15 W (idle mode). After that interval, the display goes dark and the printer goes into a sleep mode from which it will awake on any button press or print job. In this state it is drawing the same 3 W as after switching it off using the On/Off button but leaving it plugged in. All the Off-switch seems to do is to stop it from responding to print output or to buttons other than the On-button. To get rid of the last 3 W you would need to unplug it or switch it off at a switchable power strip. Note that inkjet printers should only be fully disconnected from the mains this way while already switched off using the On/Off button.

I wish that power draw figures at idle and load were readily available for every computer on the market, so that consumers could make informed decisions.


Watt Checker Plus (2022-04)