Apache Redirect Loop

I was trying to use mod_alias to redirect the root of my website to a subfolder. However, the Redirect directive was just giving an redirect loop.

Finally found the solution at this stackoverflow thread.

Instead of using Redirect, it is necessary to use RedirectMatch with a regular expression for the /

RedirectMatch 301 ^/$ http://example.com/stuff


Samsung NC110 Screen Brightness in Ubuntu 13.04

After upgrading the Samsung NC110 netbook to Ubuntu 13.04, the screen brightness buttons stopped working. Googling the terms “ubuntu 13.04 samsung nc110 brightness” led to an askubuntu.com thread with the solution.

Here are the steps.

Backup the grub config file
sudo cp /etc/default/grub /etc/default/grub.bkup

Edit the file
sudo vim /etc/default/grub
add the following to the line GRUB_CMDLINE_LINUX=".... acpiosi=Linux acpi_backlight=vendor"

The ellipsis (….) refers to what was already there and is not meant to be entered literally into the file.

Run grub-mkconfig
sudo grub-mkconfig -o /boot/grub/grub.cfg

Installing Ubuntu 13.04 on a Mac

I like having a Ubuntu install handy to play around with. It’s already on my PC as a VirtualBox image, but 3D acceleration refuses to work, so I can’t upgrade it beyond 12.04 as there’s no more Unity 2D after that and upgrading prompts dire warnings about terrible performance. I decided to try installing 13.04 (Raring Ringtail) onto the Mac with VirtualBox.

Installing VirtualBox was easy. Download the Mac versio and drag it to the Applications folder. That’s generally the case for installing Mac apps, although some of the newer ones can be obtained from the App store, just like for mobile devices.

Creating a new image, mounting the ISO file and installing Ubuntu was no problem. In fact, the install wizard seems to have been streamlined a bit.

However, running it was a different issue. Opening the ‘Start’ menu took ages as it slowly fades in, and just getting it to go away took another eternity as it slowly faded away. A bit of Googling revealed that the problem was a lack of 3D acceleration. That apparently causes it to use the CPU to render the graphics, leading to terrible performance.

The solution was found in this forum thread. Basically, install the VirtualBox extensions, install guest editions, then insert the line ‘vboxvideo’ to /etc/modules

Reboot and check that 3D is supported with the following command.

/usr/lib/nux/unity_support_test -p

If that shows all green, everything should be running much smoother!

Upgrading a MacBook with an SSD

SSD Macbook


Having bought a new solid state drive (SSD), I needed somewhere to use it. Mountain Lion runs terribly slow on a 2009 MacBook Pro, so I decided to upgrade its hard drive to an SSD. I had originally planned to use it for a new desktop, but that isn’t going to happen anytime soon and it seemed like such a waste to leave a perfectly good SSD lying around.

The hard drive replacement was quite easy. Just unscrew everything and replace the drive. Some other websites should provide much better instructions. The main thing to note is that the hard drive support posts use a funny star shaped screw. I still have my friend’s toolkit from the last drive replacement so this wasn’t a problem.

Prior research had led me to the Recovery Disk Assistant, a bootable recovery USB stick. Plugging that in and starting the Mac starts a recovery utility. Start by adding a partition and formatting the disk using the disk utility.

Next, install the OS. The utility prompts for an AppleID. Use the account used to purchase Mountain Lion. The installer will now download the whole OS from the App Store. This requires an Internet connection, which can be configured from the recovery utility. Go do other stuff while it downloads and installs the OS.

At the end of the process, it will prompt for a location to restore user data from. One of the options is to use a hard drive. I plugged in the hard drive I had just replaced as an external USB drive. The installer automatically detected the applications and user data and offered the option of restoring it. I just let it do its thing and at the end of the process, the data recovery was complete without me having to manually dig up the application install disks or recreating the user accounts. It just worked!

The Mac now starts up in less than 10 seconds. Applications start much faster and Mountain Lion is finally acceptably quick.

I’m really amazed by the ease which I could reinstall the OS and restore the data after changing out the hard drive. The performance increase is very nice too. However, it’s a little disappointing that Mountain Lion needs an SSD to not feel sluggish.


Resizing VirtualBox Partitions

My Ubuntu VM was running out of space. The good thing about VMs is that the hard disk storage file can just be expanded. I followed the steps from this blog post.

First, expand the size of the disk. My host OS is Windows, so the following command is for the Windows version of VirtualBox. If the VirtualBox folder isn’t in the PATH variable, you will have to use the full path to VBoxManage.exe. For the command below to work, your working directory should be where the vdi file is. The final parameter is the new desired size of the partition.

VBoxManage.exe modifyhd mydisk.vdi --resize 20000

The partition must now be resized to make use of the expanded disk. Boot to a liveCD of Ubuntu to use the GParted partition editor. If you have an ISO file, it’s a pretty simple matter of assigning it to the virtual CD drive. Boot from the liveCD, select “Try Ubuntu” and start GParted.

If the Swap partition is in the way, right click on it, select Swapoff so that the partition can be moved. This is also necessary to do other stuff to the swap partition, like deleting it.


The swap partition was in the way, preventing me from expanding the primary partition, so I first had to move the extended partition all the way over. To do so first required deleting the swap partition. Right click on the swap partition to open the context menu and select delete.

Now click on the cyan border of the extended partition to select it, then right click and select Resize/Move. Adjust the sliders to move it to the end. This post here had the solution to the problem of moving the extended partition.

Recreate the swap partition in the extended partition. linux-swap is one of the options for the filesystem type.

Finally, extend the primary partition to take up the space. Remember to click on the green tick to apply the changes.

Shutdown the VM and remove the liveCD from the virtual CD drive. Reboot, and the available disk space has been increased!

Network Scan with Mac OS 10.8

Having already set up network scanning with little fuss on my Windows machine, I was expecting a simple task on Mac OS, but nooooo.

The shared folder method over Samba fails with a login error. Some googling suggests that it’s due to a change in the port number from NetBIOS (139) to TCP/IP (445). Naturally I couldn’t find an easy way to change that on the Mac.

Neither does the address book on the printer’s configuration page allow port 445. Only 139 and a range of 4 digit numbers are allowed.

Thus the alternative is FTP. To enable that, it is necessary to open a Terminal window and use the following command.

sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist

That enables FTP with authentication. Logging in with an FTP client with a user account will bring you to the user’s home folder. I created a subfolder there to keep scan output and configured that through the printer’s web interface.

Now it works 🙂

Setting up the Fuji Xerox DocuPrint M255z in Ubuntu 12

Open the Dash and type ‘print’. Click on ‘Printing’ and Add a printer.

Under Network Printer, the printer should show up after a while. It probably can’t find a suitable driver, and the one on the CD doesn’t seem to do anything. Let it search for a while then choose a driver from the database.

Just select a generic postscript driver and it should work, including duplex printing.

Don’t use the PCL drivers. While they will install just fine and you can send print jobs to the printer, it’ll just hang there and never get out of the processing stage. Cancelling doesn’t work either as it will forever stay in the cancelling stage until the printer is restarted by switching it off with the main switch.