2009-07-30

Xen recovery on CentOS

I had a Xen domain crash, and it was a file image based LVM system. To mount the system manually in the host, I had to do:

losetup /dev/loop0 /storage/image.disk
kpartx -a /dev/loop0
vgchange -ay
lvscan
mount /dev/VolGroup00/LogVol00 /mnt

This allowed me to access the LVM volume. To unmount it, I needed to do:

umount /mnt
vgchange -an VolGroup00
kpartx -d /dev/loop0
losetup -d /dev/loop0

Now I could attempt to boot the domain again.

2009-05-19

bzr error on BranchHooks

On one Ubuntu 8.04 system, I was getting the following error:

0.031 looking for plugins in /root/.bazaar/plugins
0.031 looking for plugins in /usr/lib/python2.5/site-packages/bzrlib/plugins
[ 7744] 2009-05-19 09:37:54.672 WARNING: 'BranchHooks' object has no attribute 'install_hook'
[ 7744] 2009-05-19 09:37:54.673 WARNING: Unable to load plugin 'dbus' from '/usr/lib/python2.5/site-packages/bzrlib/plugins'
0.093 Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/bzrlib/plugin.py", line 231, in load_from_dir
exec "import bzrlib.plugins.%s" % name in {}
File "", line 1, in
File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/__init__.py", line 76, in
install_hooks()
File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/hook.py", line 30, in install_hooks
Branch.hooks.install_hook('set_rh', on_set_rh)
AttributeError: 'BranchHooks' object has no attribute 'install_hook'

Everything else worked fine, but it was reporting an issue with install_hook. I tracked it down, and fixed it by deleting the dbus directory in /usr/lib/python2.5/site-packages/bzrlib/plugins - not sure where it had come from, but other systems didn't have it.

2009-03-10

NVidia TwinView on Ubuntu

After using envyng to install the NVIDIA drivers, I would get this error when trying to turn on TwinView:

Failed to set MetaMode (2) 'DFP-0: 1920x1200 @1920x1200 +0+0, DFP-1: nvidia-auto-select @1920x1200 +1920+0' (Mode 3840x1200, id: 60) on X screen 0

Even when running sudo nvidia-settings I would get this error, and things just wouldn't work.

Turns out the correct thing to do is to run sudo nvidia-settings, detect the second screen, and configure it as you want, and don't hit apply - instead hit Save to X Configuration File and then hit CTRL+ALT+BACKSPACE to restart X. This worked for me. Note that it will log you out and close any open programs you have. Now I have double desktops!

2009-02-24

Diablo II on Vista

If you try to install Diablo 2 on Vista you may get this error:

Error in script file Setupdat\inst.ins, line 14: undefined symbol (desktop)
First, you need to add the a registry key in the following location:

HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Explorer\Shell Folders

If there is no key named "Programs" add one of type string with the following contents:

C:\\Users\\%USERNAME%\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs

Exactly as shown. If there is no key named "Desktop" add one also:

C:\\Users\\%USERNAME%\\Desktop

2008-12-25

StarCraft on Vista

Installing StarCraft on Vista can be a pain. First, you need to add the a registry key in the following location:

HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Explorer\Shell Folders


If there is no key named "Programs" add one of type string with the following contents:

C:\\Users\\%USERNAME%\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs

Exactly as shown.

Now you can install StarCraft (it will give a non-fatal error which you can ignore). Don't bother running it, quit and install BroodWars - it will give the same error.

Download the latest patch from Blizzard and install it.

Once the patch is installed, you can follow the instructions here to copy the MPQ files over to run without the CD.

Now, to get the game to run you need to tell Vista to run StarCraft.exe as an administrator, or you'll get a "Unable to identify Application Version" error.

If you do run as Administrator, it should allow you to connect to Battle.Net - note that you may have to tell Vista to allow StarCraft to access the internet.

Note: I originally thought that this was Vista 64, turns out the system had 32 bit Vista.

2008-11-09

request_module: runaway loop modprobe binfmt-0000

When trying to upgrade my kernel on a Gentoo box I got the above error. Many people discussed it, but all the solutions seemed to be "it went away." However, I couldn't get it to stop occurring until I told Gentoo to rebuild the entire toolchain used by genkernel:


emerge --emptytree genkernel

and then rerunning genkernel solved the issue. The best hint seems to be that it is something to do with a bad version of CPIO or similar, or some library that changed and didn't get fully recompiled.

I've filed a bug on this with Gentoo:

2008-11-04

VMware Fusion incorrectly assigns user ids for hgfs shares

Because VMware is aimed at CentOS, by default the hgfs shares are set up to be owned by the user with id 501; you'll need to change this so that it's owned by your user. To do this, first run `id`:

$ id
uid=1000(user) gid=1000(user)

Then edit `/etc/fstab` and change the line:

# Beginning of the block added by the VMware software
.host:/ /mnt/hgfs vmhgfs defaults,ttl=5 0 0
# End of the block added by the VMware software

to

# Beginning of the block added by the VMware software
.host:/ /mnt/hgfs vmhgfs defaults,ttl=5,uid=1000,gid=1000 0 0
# End of the block added by the VMware software

Where the values for `uid` and `gid` come from the output of the `id` command as above.

Remount `/mnt/hgfs`:

$ sudo umount /mnt/hgfs
$ sudo mount /mnt/hgfs

Note that you'll have to do this EVERY TIME you upgrade VMware tools.

2008-10-29

Enable Mac OS X Leopard Remote Desktop for VNC via SSH

If you have SSH access to your Mac, you can remotely enable Remote Desktop. However, if you want to VNC into the Mac, you'll need to set a VNC password and turn VNC on. The following huge command turns on Remote Desktop, enables VNC, and sets the password to password.

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -restart -agent -privs -all -setvnclegacy -vnclegacy yes -setvncpw -vncpw password

However, the last part doesn't seem to work, so you can run:

sudo nano /Library/Preferences/com.apple.VNCSettings.txt

and put this as a single line:

6755221DFCC7B786FF1C39567390ADCA

which is the encoding of "password". Now use SSH tunnels, connect, and it should work. You can then change the password via system Preferences to a more secure one.

To turn off Remote Desktop run:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -configure -access -off

Exporting a database in human-readable form from mysql

Using mysqldump with the defaults results in huge INSERT statements that can be hard to deal with if you're fiddling with the output by hand; this command dumps a database in a more readable format:

mysqldump -u root -p -h hostname.dns --databases databasetodump --skip-extended-insert --complete-insert > database.sql

Of course, replace the italic words with the ones that apply to you.

2008-09-23

Using ntpdate like rdate

If you want to just update the current time on a linux box but not configure ntpd, and rdate is not available or not working, use this command:

ntpdate pool.ntp.org

Simple!