VPS Migration

Tonight I migrated my VPS from vpslink which I no longer recommend to GeekStorage. They both run Debian on OpenVZ/Virtuozzo, so I figured it wouldn’t be hard to migrate over.

I didn’t really find much about migration on the user side. Most of the migration pages were about how to migrate containers from the host server’s perspective. I did manage to cobble together enough clues to figure out what to do.

Basically to summarize the essential points, you can just copy everything from the old server to the new, clobbering whatever is there, EXCEPT for the following:

/aquota.group
/aquota.user
/etc/fstab
/etc/hostname
/etc/hosts
/etc/resolv.conf
/etc/network/interfaces
/etc/network/interfaces.template
/dev
/proc
/sys

In more detail:

On vpslink I have Debian on OpenVZ. So when I signed up the GeekStorage, I requested Debian on Virtuozzo. OpenVZ is the open-source variety of Virtuozzo, so they are close enough.

When GeekStorage said the VPS was ready, I logged in and used rsync to copy everything from the old server to /backup/old. That took a few hours. Then on the old server, I shutdown all the services (sendmail, apache, mysql, tinymuck, etc.) and then ran rsync again. That updated everything that changed while the first rsync was running, and was fairly quick.

Once that was done, I put the server in repair mode. This creates a temporary container with the real container’s contents mounted under /repair. I logged into the repair mode serve. First I moved everything in /repair except aquota.*, backup, dev, proc and sys to /repair/backup/orig. This moves the new VPS’ original OS files out of the way.

Then I moved everything in /repair/backup/old except aquota.*, dev, proc and sys to /repair. That moves the old VPS’ OS files to the new VPS’ root directory. Then I copied the etc files (see above) from /repair/backup/orig/etc to /repair/etc.

Caveats: Remember that there are probably hidden dotfiles in the old and new root dirs you need to move too. Also remember to always work in /repair when in repair mode. It’s easy to forget and start twiddling in /etc instead of /repair/etc. That disappears as soon as repair mode is finished.

Then I took the server out of repair mode, which boots into the VPS container again. And miraculously, it booted up just fine with everything looking just like it was on the old VPS. I had to twiddle a couple of other files with hardcoded IPs, but the OS came up just fine. I also had to update a bunch of things in DNS and wait for DNS caching to time out.

Windows Update Fail

For several days now my desktop system has been trying and failing to install a windows update for “Microsoft UAA Bus Driver for High Definition Audio” over and over again. The update was from 2004 so it is unclear why this was suddenly something it is trying to install now. I finally got whatever it was resolved:

– In Device Manager (Control Panel, System, Hardware, Device Manager) expand the “System devices” category

– For each “Microsoft UAA Bus Driver for High Definition Audio” device, right click and select “uninstall”

– It will ask you to reboot; do so.

– When it reboots it will reinstall the device and ask you to reboot again; do so.

– Now you should no longer see the update trying to install.

(It may try and fail to install the update again during the two reboots but just ignore that. It should be back to normal after the final reboot.)

Using Eset NOD32 Antivirus on English OS in Taiwan

One of the problems for users of English version OS in Taiwan is it is often difficult to get English versions of software as most items on the shelf are the Chinese version. A critical requirement on any computer is antivirus software.

I had previously used AVG (Commercial Version) on my main Desktop and Laptop systems, but it has been getting a bit bloaty and intrusive lately. (I still use and recommend the free version on less critical PCs.) Several months back I started looking at other AV solutions and two that came highly recommend were Kaspersky and Eset NOD32.

I had received a 90 day trial of Kaspersky with a hard drive I bought, so I gave that the first chance. Unfortunately while Kaspersky was fairly efficient, it was much more intrusive than AVG. When installing software it would almost always warn of the impending doom that could be caused by SETUP.EXE and verified that I was willing to risk death and destruction by running it.

It also frequently popped up confirmation dialogs when running programs for the first time, and generally was fairly generous about notifying me about all kinds of non-serious things. I don’t want my AV software to do that. I just want it to sit there quietly and quickly checking things and only telling me when it finds a real problem. So, Kaspersky was ruled out.

Then I downloaded a free 30 day trial of Eset NOD32 and for the whole trial period it did exactly what I wanted, quietly sitting in the background and only popping up when a real problem was found. (The first time this happened was late in the trial period when I started backing up my Gmail.) I managed to make it through the trial period without it annoying me with stupid stuff.

So now the problem… Only the Chinese version is sold in Taiwan. I did some searching and it seemed that it would be possible to switch to the English version, but nothing conclusive. Eventually I had to decide, so I rolled the dice and bought a copy. If you need to do the same thing, here is what you need to do:

  1. Buy a copy of the software. I bought it from PC-Home’s 24h Shopping. I bought the 3 Year License Home Version. (Click on NOD32 on the left if you want a different license.)
  2. When you get it, look at the back of the manual to find your license code. You will need to activate on the Eset’s Asia servers, not their US servers. If you can manage basic Chinese then you can register on Eset Taiwan or if you need English, go to Eset Singapore.
  3. After you register, click on the Download link and then select “Download Purchased Software / Home Users” and scroll to the bottom for the English 4.0 version. The “Download” link will download the software and the “Manual” link will download the manual. (That’s for the Singapore site. The Taiwan site is organized a bit different. Click on download then select the English download link.) You will need your username and password to download, which is emailed to you about 15 minutes after registering.
  4. Install the software.

Only one extra caveat. When I used the “Verify License Validity” option just after installing, it didn’t work. However, it was working fine by the next day. I’m not sure if it was something broken yesterday or if there is a delay during registration.

Setting Kindle Date and Time Without Wireless Networking

One drawback of using your Kindle 2 in an area without wireless connectivity is that the date on your Kindle will not be set correctly, but instead be set to sometime in 1970. (UNIX timestamps start from January 1, 1970 and Kindle’s software runs on Linux.) This is really not a very serious problem except that your bookmarks, notes and clippings files will have bogus timestamps.

Fortunately there is a hidden option to enable networking over USB connections. If this connection is enabled and properly set up, then one of the things it will do when connected is set the time. The time on mine was set to UTC (sometimes called GMT) time zone instead of Taipei time (UTC+0800), but at least it is only 8 hours off instead of 39+ years.

I learned how to set up USB networking on Kindle from Jesse Vincent’s blog post Tethering your Kindle 2 where he explains how to do this on MacOS. Since Windows systems are a bit different below is a shorthand version for Windows XP. If you get confused by anything, see Jesse’s original post for more detail. Vista procedure is probably a bit different.

  1. Get the driver here: http://www.davehylands.com/linux/gumstix/usbnet/linux.inf (If you run XP x64 or Vista 64-bit, you will need to modify the driver as documented here: http://docwiki.gumstix.org/index.php/Windows_XP_usbnet#Step_7.)
  2. Enable Internet Sharing on your Windows box. Open the “Network Connections” Control Panel, right click on your main network connection and select “Properties.” Select the “Advanced” tab and enable “Allow other network users to connect …”
  3. On your Kindle press “HOME”.
  4. Search: ;debugOn
  5. (Optional) Search “`help” to verify debug mode is on; you should get a list of available commands.
  6. Search: `usbNetwork
  7. Search: `usbQa
  8. Connect your Kindle to your computer’s USB port. You should see a network connection detected. When it asks to install a driver tell it to manually install, and point it to the directory you saved linux.inf to.
  9. The “Network Connections” Control Panel will now have a new network connection listed. Right click on it, select “Properties,” click on “Internet Protocol (TCP/IP)” at the bottom of the scroll box and press “Properties.” Enter the following: “IP address: 192.168.15.200” “Subnet mask: 255.255.255.0.”
  10. Shortly after connecting to the Internet you Kindle should update the time setting. You can confirm if it does so by searching: @time
  11. To get your Kindle back to normal USB mode, restart it: “HOME” “MENU” “Settings” “MENU” “Restart”

ssh logins for any user on QNAP TS-409

The QNAP NAS servers run a Linux OS and out of the box supports ssh logins as the “admin” user (basically root with a different name). But if you add a user and try to log in, it just closes the connection. If you look at /etc/ssh/sshd_config you’ll notice that there is a configuration line for “AllowUsers admin” which may lead you to believe that you just need to modify this line. Unfortunately the ssh server itself is also hard coded to allow admin logins only.

There are several guides for how to get around this restriction. The solution involves installing openssh either in addition to or as a replacement of the built in sshd. Many of these guides seemed overly complex to me, so I took several of them and came up with what I think is the simplest approach to replace the existing sshd with one that allows logins by all users.

This guide is known to work with the QNAP TS-409 running firmware 2.1.2 Build 1112T. It will probably work with other QNAP models, or other firmware versions, but no guarantees. This assumes you know how to ssh to your NAS as admin, you’ve created a new user and you already have ipkg installed and working. If you don’t have ipkg, see this http://forum.qnap.com/viewtopic.php?f=85&t=1085 and follow the “Sit Back” approach.

First install openssh:

ipkg update
ipkg install openssh

Now let’s swap out the stock server with the ipkg version:

mv /usr/sbin/sshd /usr/sbin/sshd-orig
cp /opt/sbin/sshd /usr/sbin/

Now on QNAP servers the filesystems are a bit strange because the OS is loaded from firmware onto a ramdisk. As a side effect of this, some system modifications will disappear upon reboot unless you follow special procedures to preserve them. This is true of the /etc/ssh/sshd_config file. We will need to move it to a location outside of the ramdisk.

cp /etc/ssh/sshd_config /mnt/HDA_ROOT/.config/ssh/

Next we need to edit the relocated sshd_config file (use your preferred editor if you don’t like vi):

vi /mnt/HDA_ROOT/.config/ssh/sshd_config

You have two choices when editing this file. Option one is to edit AllowUsers to add the usernames you want to be able to log in. Each username is separated by a space. Alternatively, you can comment out the AllowUsers line completely which will allow any user to log in.

Next copy it back to the normal location:

cp /mnt/HDA_ROOT/.config/ssh/sshd_config /etc/ssh

At this point you can test your configuration. BUT… you are NOT done yet. There’s one more step to make your changes permanent, so don’t just quit after this step.

Log into the web admin interface of your NAS and under the “System Tools” category click on “Remote Login.” Untick “Allow SSH Connection” and press “Apply.” Wait a few seconds, then tick “Allow SSH Connection” and press “Apply” again. This will reset your ssh server and if you did everything right you should now be able to login as users besides admin.

If it does not work, don’t panic. You can restart your NAS and the configuration will be replaced with the original. If you really manage to screw things up, enable telnet and log in that way to try to fix things up.

(Be careful about restarting sshd while logged in via ssh. It is very easy to kill your own connection before the new sshd starts and then you will have to use the web admin interface anyways. If you know what you are doing and are very careful, you can restart it via the shell.)

Now if everything went well, we can make the configuration permanent. We need to create or edit an autorun.sh script which moves the configuration over during boot. First mount the config area:

mount -t ext2 /dev/mtdblock5 /tmp/config

(The device may differ if you have a different model. Check Google if the last step doesn’t work.)

Next we need to edit or create the autorun.sh file:

vi /tmp/config/autorun.sh

If the file doesn’t exist or is empty, insert all of the following. If there is already a script there, skip the first two lines and add the rest at the end of the file:

#!/bin/sh

# SSH Config
cp /mnt/HDA_ROOT/.config/ssh/sshd_config /etc/ssh/sshd_config
/etc/init.d/login.sh restart

After saving it, make sure it is made executable and unmount the filesystem:

chmod +x /tmp/config/autorun.sh
umount /tmp/config

Now you can reboot your NAS and confirm that the configuration was preserved. Keep in mind that it can take 3-4 minutes to reboot. There will be a couple of short beeps during the reboot process and one longer beep when it has completed booting. Be patient and wait for the long beep before trying to login.

In the future be sure to make any configuration changes to sshd_config by editing the non-ramdisk copy like follows:

vi /mnt/HDA_ROOT/.config/ssh/sshd_config
cp /mnt/HDA_ROOT/.config/ssh/sshd_config /etc/ssh

AviSynth Plugin ReduceFlicker on x64

If you are trying to use this plugin on XP 64-bit OS you may find that you follow all the directions to install it and then run into an error:

“unable to load …ReduceFlickerSSE3.dll”

The problem is that the instructions tell you to install AvsRecursion.dll in “C:\WINDOWS\system32”. On XP x64 it should actually be installed in “C:\WINDOWS\SysWOW64”. Move it there and it should work fine.

PowerDVD 8 HD-DVD and MoovieLive Tweak on 64-bit

If you are on a 64-bit OS and having trouble getting the PowerDVD 8 HD-DVD pack and MoovieLive tweak pack to be effective, it is probably because your registry structure is different. Here’s how to fix:

HD-DVD Pack:
Edit HDDVD64.reg and change all instances of “HKEY_LOCAL_MACHINE\SOFTWARE\Cyberlink” to “HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Cyberlink” and then run Install64.bat again.

Tweak Pack:
Edit Disable_MoovieLive.reg and do the same changes as for the HD-DVD Pack and then add the file to the registry. DO NOT change “HKEY_CURRENT_USER\Software\Cyberlink”.

Media Player Classic could not render MEDIASUBTYPE_YV12

This is a bizarre problem I ran into on my new desktop that I wasn’t able to find a solution to by googling, so hopefully this post will help some other poor soul avoid hours of banging head against keyboard which is not good for either head or keyboard. Anyways…

Let’s say you have an XP Pro x64 64-bit system. You’ve installed Avisynth and DGMPGDEC and have run dgindex on some video and set up an avs project file for it. Most things read it in fine, like AvsP and Megui. But when you try to play it with Media Player Classic you get an error that it can not render MEDIASUBTYPE_YV12.

I’m not sure if this has anything to do with a 64-bit OS, but I’ve done the same thing on 32-bit systems before and never ran into the problem. It could also be a quirk in the software versions of the programs I use. Anyhow, I’m putting all this in so that the next person to search on the terms I was searching on will find some useful advice.

There is one easy workaround for it which is to stick “converttorgb()” at the end of the avs file, but that has issues of its own once you get to encoding or whatever else you were going to do with the avs project.

There are a few pointers in google to setting ffdshow to use the RGB YV12 output conversion settings to solve the problem, which is the wrong advice but put me on the right path.

The real solution is to bring up the ffdshow “Video decoder configuration” program, click on codecs, scroll all the way to the bottom and find the “Raw Video” format. Click on the second column (which probably says “disabled”) and a little pulldown menu will come up. Set it to “all supported” and then click on the “OK” button at the bottom.

Should play just fine now.

Converting Chinese HTC Touch Pro to English

WARNING: Changing the firmware on your HTC phone could cause it to become inoperable. A phone with changed firmware may not be eligible for warranty service. Any data on your phone will be erased! Make sure you follow directions carefully and never ever interrupt the firmware update until it is finished. I take no responsibility if this doesn’t work out for you.

So let’s say that you live in Taiwan and want to buy a fancy new HTC Touch Pro smartphone. You’ll quickly learn that in Taiwan you can only find the Chinese version of this phone. Importing a European version is expensive, plus you won’t get any contract signup discounts. US phones use provider-customized firmware that may not work correctly or optimally in Taiwan.

Don’t despair. There’s active communities of HTC enthusiasts who have extracted HTC firmware in English and other languages. It’s a fairly simple process to change the firmware on your phone, but the documentation is slim, so it’s difficult to know where to start. Here’s a simple guide on what you need to do. Each page referenced has additional information if you need more detail:

1 ) Download and install on your computer the English version of ActiveSync from Microsoft: http://www.microsoft.com/windowsmobile/en-us/help/synchronize/device-synch.mspx

2 ) Turn on your phone and connect the USB cable that came with the phone (aka the charging cable) between your phone and computer and set up the phone to sync. You don’t need to actually sync anything yet, you just need to get ActiveSync on your computer to say it is “Connected”.

3 ) Download to your computer and extract RaphaelHardSPL-Unsigned_1_90_3.zip from here: http://forum.xda-developers.com/showthread.php?t=410150. Normally you can only install ROM firmware versions intended for your version of the HTC Touch Pro. HardSPL will change the SPL firmware to allow any HTC Touch Pro ROM firmware to be installed.

4 ) Make sure your phone battery is more than 50% charged or the SPL and ROM firmware will not install.

5 ) Run RaphaelHardSPL-Unsigned_190_1_3.exe on your computer. Follow the prompts in the program to start the SPL upgrade. After the upgrade starts there may be an inquiry on your phone’s display asking permission to switch into the bootloader. Press “是” (yes). Do not do anything on your phone or computer until the installer says the process is completed and your phone has restarted. (Note that it says the firmware upgrade takes up the 10 minutes but the SPL is small so it will be much faster.)

6 ) Download to your computer RUU-Raphael-HTC-WWE-1.90.405.1-Radio-Signed-Raphael-CRC-52.33.25.17-1.02.25.19-Ship.exe from http://wiki.xda-developers.com/index.php?pagename=HTC_Raphael_WM6.1_ROMs. At this writing there are newer ROMs there but this one is the stable released version on shipping English phones. (In the future there may be a newer stable release.)

7 ) Run RUU-Raphael-HTC-WWE-1.90.405.1-Radio-Signed-Raphael-CRC-52.33.25.17-1.02.25.19-Ship.exe on your computer. The interface is similar to the SPL upgrade, but this upgrades the main ROM firmware. Again, do not do anything on your phone or computer until the installer says the process is completed and your phone has restarted. This firmware is very large so it will take several minutes.

8 ) When your phone restarts it’ll go through the install process just like a brand new phone. (Your dealer may have done this for you when you bought the phone.) It’ll take several minutes to install the OS and additional software, calibrate the display and setup your phone network settings.

9 ) Congratulations, your Chinese phone now speaks English.

Quick Script To Sort and Rename from EXIF Date

I wrote a quick bourne shell script to sort and rename the image files I recovered from my formatted memory stick. It requires the perl exifdump script that comes with the Image::Info module (not the python script by the same name). Since the last pre-format image I had was 8160, I started the recovered files at number 8161. The filenames will not be exactly right due to images that were deleted and retaken, but close enough.

The script was coded up quickly so there is no documentation or error checking.

#!/bin/sh
#

NUM=8161
PRE=DSC0
EXT=.JPG
TEMPLIST=`/usr/local/bin/mktemp /tmp/ds-rename.XXXXXX`
TEMPSORT=`/usr/local/bin/mktemp /tmp/ds-rename.XXXXXX`

for file in V*.[jJ][pP][gG]
do
echo "Processing ${file}..."
DATE=`/home/jlick/bin/exifdump ${file} 2> /dev/null | /bin/grep DateTimeOriginal | /bin/sed -e "s/.*DateTimeOriginal -> //"`
echo ${DATE} ${file} >> ${TEMPLIST}
done

echo "Sorting..."
/bin/sort ${TEMPLIST} > ${TEMPSORT}

for file in `/bin/sed -e "s/.* //" < ${TEMPSORT}`
do
echo "Renaming ${file} to ${PRE}${NUM}${EXT}..."
/bin/mv ${file} ${PRE}${NUM}${EXT}
NUM=`/bin/expr ${NUM} + 1`
done

/bin/rm -f ${TEMPLIST} ${TEMPSORT}