After installing the 10.5.5 update for my Macbook, I noticed both wireless and wired internet access seemed slower. My wife’s Macbook, running 10.4, didn’t have the same problems.
Category Archives: How-To
Sound Fix for MacBook with Ubuntu 8.04
After upgrading to 8.04, I found a strange bug: my sound worked normally from the internal speakers, but when I plugged in a set of headphones, no sound came out.
I scratched my head for a while trying to work this out till I found the workaround recommended here.
Basically all you need to do is right-click on the Volume Control applet, select Open Volume Control, then Edit -> Preferences. Check the box for “Surround,” then close the Preferences window and unmute the track marked “Surround.” That should do it.
Upgrading the Macbook to Ubuntu 8.04
Bit the bullet today and upgraded to the latest Ubuntu distribution: 8.04.
I decided to try the automatic updater built into the Update Manager (after backing up all my data).
Everything went well until it asked me what to do with the /boot/grub/menu.lst file.
Since my system is dual-boot Ubuntu/Windows, I’ve customized by boot menu to display the Windows XP partition when the computer starts. When the updater noticed the altered file, it asked me if I wanted to keep the old one or use the default (new) one.
I told it to keep the old one, since I wasn’t sure I could duplicate the changes I’d made easily. The updater went along with this decision for a while, then decided it couldn’t get some files it needed from the internet and crashed.
Luckily, my system was still running okay, so I found the menu.lst file and made a copy of it, then rebooted. The computer booted up into 7.10 fine, but when I ran the update manager, it told me my system was up to date!
What had happened? After looking around for a bit, I noticed my /boot folder had references to a new linux kernel, 2.6.24-16-generic. I pulled up my old /boot/grub/menu.lst file and saw it referred to the 2.6.22-14-generic kernel.
Ah-ha! I thought. The new kernel must be the one for 8.04. So I edited the menu.lst file so that this was the first entry:
title Ubuntu 8.04, kernel 2.6.24-16-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-16-generic root=UUID=03265ecc-a831-4aaf-8d13-fc06036d9211 ro quiet splash
initrd /boot/initrd.img-2.6.24-16-generic
quiet
(the part after UUID may vary from what’s on your computer; be sure to use whatever your old menu.lst file lists for your old linux kernel)
Then I rebooted the computer. Sure enough, this time it told me I was in Ubuntu 8.04! I ran the update manager again to check for anything it didn’t load after crashing, and found 2 updates I needed.
When I pressed “Update” though, it told me dpkg was already running, and I had to run “dpkg –configure -a” to fix things.
So, I opened a Terminal and typed in “sudo dpkg –configure -a”. It downloaded a few files, then asked me (again) if I wanted to replace the /boot/grub/menu.lst file. This time I let it use the default (new) one, secure in the knowledge that I had a backup of the old file.
That fixed everything. It wrote the menu.lst file it wanted, then rebooted. After reboot, I copied the part of the old menu.lst file that referred to my Windows install and pasted it into the new menu.lst.
Everything works now, none of my data is missing, and I can still get to Windows.
So, if you’re upgrading to 8.04, be sure to backup your menu.lst file if you’ve changed it. Let the updater overwrite your old file, then manually paste your tweaks into its /boot/grub/menu.lst once the update’s over. If I’d just done that, my update would’ve gone smoothly.
PS–If you’re upgrading a Macbook, your sound may not work when you boot into 8.04. Try running “alsamixer” from the Terminal, then use the up arrow to max out the volume for the each of the channels it shows. That should do it.
Fixing Filenames
I use SoundJuicer to rip my music CDs into Ogg files, and play them in Rhythmbox.
Both programs work great, with the exception of stripping special characters–like ‘,’ ‘<’ or ‘#’–from filenames. SoundJuicer has an option marked “Strip Special Characters,” but it doesn’t always work. Some special characters–anything with an accent mark above it, for instance–it won’t ever strip. Since Rhythmbox chokes on filenames with special characters, you have to change the filename before it’ll play the file.
This is tedious to do manually, so I wrote a Python script to do it for me. It’s not very elegant, but it gets the job done: invoke it from the command line followed by a path to the directory containing the files you need stripped of special characters, and it takes care of the rest.
Here’s the code:
#!/usr/bin/python
# This is a simple python program to look through a directory and
# strip special characters from the filenames in that directory. I use
# it mostly to fix filenames after importing music from CDs.# Invoke this program from the command line followed by the path to the directory
# containing the filenames you want fixed.
#
# Copyright (C) 2008 Ron Toland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# long with this program. If not, see <http://www.gnu.org/licenses/>.import os, sys
def namefixer(dummy, dirname, filesindir):
for fname in filesindir:
newname = fname.replace(‘ ‘, ‘_’)
newname2 = newname.replace(‘,’, ”)
newname3 = newname2.replace(‘+’, ‘_’)
newname4 = newname3.replace(‘-’, ‘_’)
newname5 = newname4.replace(‘#’, ‘no’)
newname6 = newname5.replace(‘>’, ‘gt’)
newname7 = newname6.replace(‘<’, ‘lt’)
os.rename(os.path.join(dirname, fname), os.path.join(dirname, newname7))if __name__ == ‘__main__’:
os.path.walk(sys.argv[1], namefixer, None)
Save this file as “fixer.py” somewhere in your home directory, then use “chmod a+x fixer.py” to make it executable. To make it extra easy to use, create a link like this:
“sudo ln -s <full path to fixer.py> /usr/local/bin/namefixer”
That’ll create a link file in your usr/local/bin folder that’ll let you invoke the program from any directory just by typing: “namefixer <path to directory you want fixed>“
I’m still working on getting fixer.py to get rid of accented characters. When I figure it out, I’ll post the corrected code. Should any of you, dear readers, get it working first, please let me know!
How To Install Ubuntu on a Mac Pro
I got my hands on a Mac Pro at work over the holiday, and the first thing I did was install Ubuntu Linux on it. Everything went smoothly using the new 7.10 version of Ubuntu, so I wanted to post how I did it:
[Note: I'm assuming below that you're running OS 10.5 and have already run Software Update to make sure your Mac software is current]
1. Download the Ubuntu 7.10 64-bit install disk from here.
2. Burn the Ubuntu ISO to a CD.
3. Download and install rEFIt. (Do this in OS X). I had to use their manual install. Don’t worry, it’s not hard; you just have to copy a folder from one location to another, then enter two lines into a Terminal window.
4. Run BootCamp (It’s in your Applications -> Utilities directory). Use it to partition your Mac Pro’s hard drive to make room for Linux. You can set the partition sizes to whatever you want; I left 100 GB for my Mac OS and 140 GB for Ubuntu. When the partitioning is done, quit BootCamp. Don’t let it to do anything else.
5. Insert the Ubuntu CD you made into your Superdrive and reboot. rEFIt should pop up and let you choose to boot from the CD. Do that.
6. Choose the first option from the Ubuntu CD menu. When Ubuntu boots, play around with it for a while to make sure it sees your hardware properly. I have an ATI X1900 video card that Ubuntu found and worked with perfectly; I can’t vouch for Nvidia cards, so make sure you can set your screen resolution okay.
7. When you’re satisfied that Ubuntu can “see” your hardware okay, double-click the “Install Ubuntu” icon on the desktop.
8. Okay, now comes the one scary part. Follow the install wizard’s instructions until you get to the partitioner. Choose Manual. When you see a list of partitions, find the one you made using BootCamp (you can tell from its size) and delete it. Now create a new partition of type ext3 using the rest of your available hard drive space. Set the mount point to “/”. You’ll get some warning about not having a swap partition. Ignore it, you’ll be fine.
9. Click through the rest of the installer and let it chug away.
10. When it tells you to remove the CD and reboot, do what it says. rEFIt should come up again and see your Linux install. Select it, watch Ubuntu boot, and enjoy your new Linux system!
That seems like a lot of work, but really it’s mostly just clicking a few default options and watching the installers run.
If you run into problems, or just want more information, check out this blog on running Linux on the Mac Pro, or the thorough Gentoo Linux Wiki page, or this helpful post on the Apple Forums.