Monday, 6 December 2010

Windows XP Mode in virtualBox

In order to run Windows XP under virtualBox, I did the following:

Firstly, in order to activate the XP Mode VM in virtualBox, I set HKLM\SOFTWARE\Microsoft\Windows NT\WPAEvents\CurrentVersion\WPAEvents\OOBETimer to FF D5 71 D6 8B 6A 8D 6F D5 33 93 FD and then denied SYSTEM's permission to the WPAEvents key.

To check activation, run %systemroot%\system32\oobe\msoobe.exe /a. Bad idea, grace period (a.k.a. time bomb) still expires this way and can be reset at most 4 times using rundll32.exe syssetup,SetupOobeBnk.

Although both processors show up in Device Manager, they don't show up in Task Manager. The "Computer" tab does not show a multiprocessor ACPI. In order to allow multiple processors to be used inside the VM, I have to install the multiprocessor HAL halmacpi.dll and kernel ntkrnlmp.exe. I find those files in sp3.cab and copied them to %systemroot%\system32. Then I added the options /kernel=ntkrnlmp.exe /hal=halmacpi.dll to the last line in \boot.ini and rebooted. Edit \boot.ini by selecting Startup and Recovery Settings from the System Properties "Advanced" tab.

After rebooting, new hardware is detected and both processors now show up in Task Manager.

Finally, it's a good idea to turn off the login window by running control userpasswords2 and clearing the "users must enter a user name and password" tick box.

Tuesday, 30 November 2010

Intelligentes Leben in Deutschland?

Es ist ein heißer Herbst: Noch nie fielen mir aus dem Stand so viele Gründe ein, nicht mehr in Deutschland leben zu wollen.

Liste wird fortgesetzt!

Friday, 24 September 2010

Jellies

The last few days I've been busying myself making jellies. The idea came when we noticed huge amounts of ripe blackberries by the roads when cycling around. So I went blackberry picking and I tried to make blackberry jelly.

Blackberry jelly

Blackberries are relatively low in pectin, especially the very ripe fruit that I picked. So I bought jam sugar which contains added pectin to help the jelly set. Because I wanted to make »reduced sugar« jelly, I only added half the amount of jam sugar to the fruit juice. I boiled it for a while and it didn't seem to set, but I filled it into jars anyway. Of course, by next morning it still hadn't set.

The next day, I opened the jars again and reboiled everything after adding the rest of the jam sugar which brought the ratio to about 1.6 parts of sugar per juice, considerably over 1:1. Again, the resulting jelly didn't set, maybe because I didn't boil it for long enough.

Later that day, we went blackberry picking together. I boiled the resulting juice with the same amount of normal sugar and some lemon juice and also added the first batch of liquid jelly, resulting in a sugar ration of 1.2:1. After boiling for 50 minutes, the jelly finally started to show signs of setting (for example, when dripping from a spoon, the last drop becomes long), so I filled it into jars and the jelly set. Most likely, the reason it had to boil for so long was because the pot was too full, so I had to keep the temperature very controlled in order to stop it from boiling over.

The next day, I went blackberry picking again and also bought a bottle of Certo, which is apple pectin. I picked blackberries and followed the instructions on the Certo, but used only half the amount of sugar. The instructions say to boil the juice for 2 minutes, reduce the heat, add the Certo, and then fill the jars. This mixture didn't set, which might have been because due to the low pectin blackberries need more boiling, maybe also after adding the Certo.

When I reboiled the jelly the next day, I added more sugar to one half, and more sugar and more Certo to the other half. Both mixtures started jelling after boiling for about 5 minutes and the half with the added Certo set considerably faster than the other, but might have turned out too solid (like toffee).

Quince jelly

I also bought quinces which I quartered, removed the kernels, and placed in a pot which I filled with water to just cover the fruit and added the juice of half a lemon to keep the fruit from turning brown. The mixture already started jelling while I was boiling it to extract the juice. Therefore, I didn't add any Certo, but just an equal amount of normal sugar and the juice of the second half of the lemon, and the jelly became very solid.

From the remaining fruit pulp I made quince paste by adding half its weight in sugar and boiling it until it became quite hard to stir.

Experiments using less sugar

For blackberries (or low-pectin fruit), it seems to be necessary to add equal amounts of sugar to the juice and improve the pectin content by using Certo or mixing with apples (or quinces?). I still think it may be possible to use only half the amount of sugar when using Certo.

A good strategy is probably to start with half the amount of sugar, adding the Certo at the start of the boiling and then increasing the amount of sugar if the juice does not begin to jell after 10 minutes. Another approach would be to try and make up for reduced sugar by adding more Certo.

A test for pectin is to drop some liquid into ethanol (I used burning alcohol for the trangia). If it forms a single blob, there is sufficient pectin. If it dissolves or forms several strains, more pectin is needed. When I tried this with blackberry juice that contained Certo, or quince juice, it nicely formed a single blob. I have yet to try it with untreated blackberry juice.

For quinces, I also think it might be possible to use much less sugar because the juice seemed to set even while extracting it before adding any sugar.

The other point about reducing the sugar is that the sugar binds excess moisture in the resulting jelly, thereby preventing the growth of microbes. Jam sugars for smaller amounts of sugar per fruit don't just contain special modified pectins (PDF) but also added preservatives. Jellies made with less sugar may therefore have a reduced storage life.

Tuesday, 21 September 2010

Lucid Lynx on Sony Vaio P VGN-P19WN

After successfully running Xubuntu Karmic Koala 9.08 on the Sony Vaio P VGN-P19WN, the pleasant surprise after upgrading to Lucid Lynx was that the GMA500 »poulsbo« drivers were easy to install from the PPA repository. However, I was quite disappointed to discover that many things were broken after upgrading to Lucid Lynx (10.04):

  1. The brightness keys trigger the on-screen brightness display, but the display brightness doesn't change.
  2. After selecting »suspend« from the menu or closing the lid, the laptop suspends (to RAM) but cannot wake up.
Both features were working flawlessly before in Karmic.

The backlight starts working as soon as the kernel option acpi_backlight=vendor is removed from the variable GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub. I don't remember whether that option was there in Lucid Lynx by default or whether it was carried over from the previous Karmic Koala installation which needed that option.

After installing the uswsusp package and uninstalling the vbetool package (not needed, see below!), suspend works if calling

$ sudo s2ram -f
manually. The -f switch is needed because otherwise s2ram just displays the message
Machine is unknown.
This machine can be identified by:
    sys_vendor   = "Sony Corporation"
    sys_product  = "VGN-P19WN_Q"
    sys_version  = "J003KYE9"
    bios_version = "R2073U3"
However, setting SLEEP_MODULE="uswsusp" in /etc/pm/config.d/00sleep_module isn't enough to make the suspend work from the menu or by running pm-suspend from the command line. The suspend process looks the same as when calling s2ram manually, but the system does not wake up. So something that pm-suspend does before or after suspending using s2ram is breaking the wake-up.

There is also some advice on the web to deactivate the ath9k module, but this does not affect the Vaio P.

Deactivating all the scripts in /usr/lib/pm-utils/sleep.d by appending a ~ to their names also doesn't solve the issues. Turning them back on again one by one isolated the issue to 98video-quirk-db-handler (and occasionally 49bluetooth). So by adding these names to HOOK_BLACKLIST in a file in /etc/pm/config.d calling pm-suspend from the command line now works.

However, when pm-suspend is called using the Xfce interface or by closing the lid, an additional parameter --quirk-s3-bios is passed which again prevents resume from working. Also, lshal reports power_management.quirk.s3_bios = true. The reason turns out to be a double semicolon in a match clause in the file /usr/share/hal/fdi/information/10freedesktop/20video-quirk-pm-sony.fdi which adds the s3_bios to every product. The upstream bug report and fix.

While trying to manually restart hald I notice that Lucid Lynx no longer has a file /etc/init.d/hald, nor does the service command list or know about hal, hald or haldaemon. How to manually restart hald now escapes me. Shoddy user interface change!

Ironically, that same error was copy-and-pasted into the file /usr/lib/pm-utils/video-quirks/20video-quirk-pm-sony.quirkdb (turning into a double pipe symbol along the way), which was the reason I had to disable the module 98video-quirk-db-handler above. Upstream bug report. After deleting the spurious pipe symbol, I can enable the module again.

Also, it is not necessary to install the uswsusp package, the default kernel suspend method works fine. In that case, it might be necessary to unload and reload the ath9k module using SUSPEND_MODULES in a file in /etc/pm/config.d in case wireless networking frequently doesn't work after resume.

Wednesday, 14 July 2010

Language Pack installation on Windows 7 Professional

There is a lot of information on the 'net about how to persuade Windows 7 Professional (or Home Premium) to accept language packs. This is the route I followed to convert a laptop bought abroad to en-US:

I downloaded the language pack installation from Microsoft using the URLs kindly listed on the Sevenlizator site. This produces an .exe file which when run creates a lp.cab in the working directory which you need to grab quickly before it gets deleted. On my Windows 7 Home Premium, the installer failed without so much as an error message, probably because it detected that this version doesn't support language packs.

Once you have the lp.cab file you can use the GUI lpksetup or the command-line tool dism to install it:

# dism /online /add-package /packagepath:lp.cab
This will require a reboot. You can also use dism /online /get-intl to list the currently installed language packs.

It is now possible to change the locale of the boot and OS load process, but this wasn't necessary in my case because curiously the locale changed after installing the language pack:

# bcdedit /set {bootmgr} locale en-US
# bcdedit /set {current} locale en-US
To find the strings {bootmgr} and {current} I used bcdedit which lists both the available identifiers and the current settings. This affects the "Starting Windows" message that is displayed at system startup.

Next, you might want to change the boot process to the new locale using bcdboot:

# bcdboot %windir% /l en-US
I'm not sure what this affects and I don't know how to find out what the current setting is.

Now for the hard part: actually making the system accept the new language pack. As is to be expected, the GUI is missing from the "Regional settings" Control Panel in versions which don't support language packs. So it comes down to the Registry and you. After playing around fruitlessly with HKCU\System\Control Panel\Desktop\MUILanguagePending for a while I came to the conclusion that the code dealing with this key does not appear to be active either in my version of Windows 7. So I followed the advice given in multiple places to just change what I believe to be the default system language:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Language]
"InstallLanguage"="0409"
"Default"="0409"
I have not worked out yet how to modify the language on a per-user basis in a cut-down version of Windows 7.

Finally, in order to change the language displayed for the current user, the following key might be modified:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Desktop]
; The value is the string "en-US".
"PreferredUILanguages"=hex(7):65,00,6e,00,2d,00,55,00,53,00,00,00,00,00

I cannot confirm that Microsoft's validity check fails after installing a language pack. On my system, everything seems to be working smoothly.

Sunday, 30 May 2010

GNOME username login order

Current versions of gnome-simple-greeter which is part of the gdm package that manages the GNOME login screen display the users ordered by how frequently they log in to the system. This can be quite confusing as it is generally different from the obvious sorting criteria like user name or numeric user id.

It took a little while of digging around to find out how the login frequency is calculated. As it turns out it is a feature of ConsoleKit which can be accessed from the command line as

$ ck-history --frequent
In order to reset the count, it suffices to delete the file /var/log/ConsoleKit/history. By editing that file the login count can also be modified at will.

Tuesday, 19 January 2010

Debugging shared libraries

If an application crashes inside a shared library, you need source level debugging in that shared library to find the cause.

Let's assume the shared library is part of the base system. First of all, you need to build the library with debugging information. Unfortunately, MKDEBUG and MKDEBUGLIB don't help because they only affect applications and static libraries, respectively. Assuming you still have the obj tree of the last build around, the easiest way to build is by using the make wrapper it created:

$ MAKE="`echo /usr/obj/usr/src/tooldir*/bin/nbmake-amd64`"

As an alternative, you could also use normal make. This will use its own obj directory and might trip over missing dependencies as a result:

$ MAKE="make USETOOLS=no"

Now build the debugging library:

$ cd /usr/src/lib/libedit
$ $MAKE obj
$ $MAKE CFLAGS=-g distclean dependall

When loading the application into the debugger, you can use LD_LIBRARY_PATH to make sure that your debug version of the library is loaded. To run sh with our debugging version of libedit:

$ LD_LIBRARY_PATH="`$MAKE print-objdir`" gdb /bin/sh
(gdb) b el_gets
Function "el_gets" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
(gdb) r
Breakpoint 2, el_gets (el=0x7f7ffdb11800, nread=0x621b1c)
    at /usr/src/lib/libedit/eln.c:75
75  el->el_flags |= IGNORE_EXTCHARS;