Archive for the 'mac' Category

OpenSUSE 12.1 on a 2011 MacBook Air

OpenSUSE on the MacBook AirThere are not a lot of guides out there on how to install OpenSUSE on any Mac. And the few guides that I’ve found on installing other Linux flavors on the MacBookAir4,2 (which is how the 2011 MBA identifies itself with dmidecode) are all incorrect in many subtle ways. So I figured I should write my own. This one is targeting the somewhat experienced Linux person. Installing Linux on a Mac may not be something a complete beginner should try. So in several of the steps I am not trying to give you every little detail and command option as I am assuming you know how to use dd or how to find out which device your USB stick shows up under…

First you need to decide whether you want to keep MacOS around. It’s easy enough to do – just shrink the Mac partition using disk utility and create a FAT partition in the free space – that’s the partition you will then later replace during the install.

While booted into MacOS, install rEFIt on your MBA. This will take two reboots before it works, but then you should get the boot manager at start.

Next, ignore all the guides showing you various scripts to create bootable USB sticks for the Mac. They all try to use some sort of FAT partition and that does not work. All it takes is to dd the iso image of one of the install CDs (I chose the Gnome Live Image) onto a USB stick. Reboot your MBA and rEFIt should show you the USB stick as one bootable device (USB sticks get a strange rectangular orange badge on their logo – not sure how that is intuitive).

On the boot screen pick Installation and type nomodeset into the line for additional boot arguments; this will avoid using the Intel gfx mode setting in the install kernel which doesn’t play well with the MBA – instead it will run in VESA 1024×768 mode which is fine for installation. Hit return and after a short while you should see the graphical installer start.

Install as usual; if you decided to go for dual boot be careful with the partitioner. For me the default suggestion included reformating /dev/sda1, the EFI partition. Probably a bad idea. But you can simply pick Create Partition Setup and then chose the partition that you want to replace (the FAT partition we created earlier). And then everything seems to work smoothly. I first tried btrfs but sadly with the new kernel we’ll build in a moment that hung my computer twice – so I reinstalled with ext4. I decided to go with an LVM based solution that encrypts data on disk – that seems to be the sane approach. YaST for some reason decided to leave most of the space unused and created only a 20G root filesystem and a rather small 2G swap volume. So I manually expanded those to more reasonable values (6G of swap as I often use virtual machines and all the rest of the space for the root filesystem as I don’t want a separate home partition).

The install runs fairly smoothly after that. One hickup is that after the first reboot you can’t pick nomodeset – so you get broken graphics. Simply ignore this – YaST will start in text mode and finish the installation. After that you can reboot and once again type in nomodeset and have working graphics.

Next we need to install some packages and get you the latest kernel. Connect to your wireless network, start YaST and install at least git, gcc and make plus gsynaptics (for the touchpad).

Get the latest kernel. Right now this means top-of-git as even 3.1 is too old (you need changes that were added during the merge window). As this guide ages you can take 3.1-rcX or a later kernel.

git clone \
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

Linus created a fairly cut down kernel config that I edited a bit more and which seems to work well so far – I haven’t played with all the devices (bluetooth, camera, etc), but the basics are there. Feel free to download that kernel.config, copy it to linux/.config and run make oldconfig – you should be able to use it as a starting point for your configuration.

Build the kernel, install it and its modules:
make
sudo make modules install
sudo make install

Edit the /boot/grub/menu.lst file to remove the vga= entry at the end of the kernel boot parameters, make item 0 (the new kernel) the default and reboot. You now should have a full resolution display and get rewarded with the full Gnome 3 experience (I still am not a huge fan of Gnome 3, but I told myself I just need to give it more time).

Login, open a terminal and setup sound.
alsamixer -c0
It seems that by default the outputs are mutted. Curser right and then m to unmute. ESC to exit.

Open System Settings (in Gnome3, click on your name in the upper right corner) and select Mouse and Touchpad. Turn on the features you want (like two finger scrolling).

I personally don’t like having to press fn to get to a function key, so I added
echo 2 > /sys/module/hid_apple/parameters/fnmode
to /etc/rc.d/boot.local which gives you function keys by default and special keys by pressing the fn key. The mapping for the special keys is still wrong (need to figure out how to fix that), but it’s just a few minor changes: F12 still gives you Eject even though there’s no optical drive, the volume keys are just one to the left of the labels, the screen brightness keys work, the others don’t seem to do much useful, yet. I definitely want to get the keyboard backlight keys to work.

I still don’t love the way the touchpad works (selecting text is a pain without real buttons, middle and right click are just weird, etc). I haven’t played with the webcam or bluetooth. But at this point I’d say the MacBook Air is functional with OpenSUSE. And it is a beautiful and very light machine…

Update: Linux-3.2-RC1 is out and it contains the changes needed to support the MBA, including the keyboard fix. I also updated the kernel .config file linked here to make it play nicer with the SUSE infrastructure (which really wants dm_mod to be a module) and to support kvm, tun/tap interfaces and ethernet bridges. We are getting there…

Kindle 2 is very slow over USB on Mac

Usually I like to post solutions to problems here – but this one I haven’t been able to figure out… maybe someone else has an idea? Please comment.

When connecting the Kindle 2 to a MacBook Pro via USB the connection is basically unusable. I get no where near the 480Mbit/s that USB2 would promise (and I checked in the System Profiler – the Kindle does show up as a USB2 device). I appear to be getting a few kbit/s – transferring a 3MB file takes 15+ minutes.

Doing some googling points to SpotLight as a potential problem. Since the Kinde 2 shows up as a FAT partition many of the usual ways of preventing SpotLight from indexing it don’t appear to work. Certainly disabling Spotlight for the Kindle through the Preferences tab failed for me (with the always helpful “an error occurred” message). What does seem to work is to create a file named .metadata_never_index in the root directory of the Kindle (something like

touch /Volumes/Kindle/.metadata_never_index

in a terminal window.

But even after doing that (and verifying that SpotLight is no longer trying to index the drive) transfer performance over USB is still abysmal.

Help?

Disk Utility Bugs with Software RAID

Looks like the Mac OS 10.5 (Leopard) Disk Utility has even more issues than the partition resize bug that I already talked about.

Fundamentally it seems to fail when trying to add members to a mirrored RAID Volume. I tried several ways to do this but every time I try I get one of these fundamentally useless error messages: “Unrecognized Filesystem”.

Turns out you need to go back to the command line and use the underlying tools that the GUI tool is supposed to use. Here’s a description of the steps that worked for me:

  • diskutil list
    Now find the Identifier of the partition or disk you want to add; it’s something like disk4 for a disk or disk4s2 for a partition. While you are at it, make sure that the disk that you want to add has the same partition scheme as the one that holds the existing RAID slide – otherwise this won’t work, anyway.
  • sudo diskutil addToRAID member Identifier /Volumes/Mountpoint
    where Mountpoint is the name under which the original RAID is mounted (TAB-expansion will give you the options of what’s there under /Volumes/, so this should be rather straight forward). Note that this command should be issued as superuser, so you need the sudo
  • diskutil listRAID
    will show you the progress of rebuilding the mirror. Depending on size and connection speed this can take a long time. I did a 500GB RAID of two external disks connected via USB and that’s estimated to take 16 hours…

I wish they paid more attention to the functionality of their tools. Being pretty and easy to use is nice – but it actually needs to work, too.

Mac Pro impressions

No, this won’t be a real benchmark comparing my PowerMac G5 Dual Core 2.0GHz with my brand new Mac Pro 8-core 2.8GHz. I haven’t spent the time to create hard numbers. But I can give you some subjective impressions.

First, things that are I/O bound are still as slow as they were. Like reading eight gigabytes of photos from the SanDisk Extreme FireWire 800 reader. Or transferring 200+ gigabytes of data from one disk to another. Not surprising, but still… darn.

Second, and much more important – Adobe Lightroom and Adobe Photoshop CS3 just fly on the new box. Especially compute intensive operations that mostly happen in memory (sync the settings of 25 pictures Lightroom; apply filters in Photoshop) – you suddenly see all eight cores busy in MenuMeters and things that took several seconds on the PowerMac are done instantaneously.

Nice – I will post more comparisons later. Promise.

Geeking out again

Instead of enduring the cold, rain and even snow in Portland, I am in Australia at Linux.Conf.Au. 24 hours of travel suck. Days filled with great talks and a chance to connect with lots of friends and many new people, all working in open source. Worth it.

I brought both the Mac and the eeePC. Surprisingly, the eeePC seemed a lot better at hanging on to the wireless connection – it keeps dropping on the Mac at times. I need to Mac to be able to access work email and connect to the VPN, but for everything else, so far, the eeePC was actually the better solution. Smaller, easier to carry around, no problem to just put it down (it’s solid state, after all).

It’s not great for kernel builds, though. Or for editing source files. Darn.

Modem scripts for Mac OS 10.5 Leopard

It seems lots of people find this site looking for modem scripts for their devices, now that Leopard has changed the script format.

While I have written about the necessary modifications to have your Motorola Ming work with Leopard I don’t know much about any other device. But it turns out that Apple actually has a really useful tool to simply convert what you have for Tiger! Go, check out their CCL Modem Scripting Release Notes – it’s all explained there.

Hope this helps some of you.

The coolest eeePC hack so far

Ok, this isn’t brand new, but I just found it… and haven’t even had the time to try it. But I have to give it extra points for coolness.

Dan at UneasySilence has figured out how to run Mac OS X on an eeePC. So after the default Xandros Linux, Fedora Linux, Debian, OpenSuSE, Ubuntu and of course Windows XP and even (Yikes!) Vista, the list of OSs to run on the eeePC is pretty complete now.

I’m still using the default Xandros install and Fedora, installed on an 8GB SD card, and switch between them via the BIOS… it’s still impressive that it’s possible :-)

Resizing Partitions on Mac OS 10.5 Leopard

Leopard moves the ability to resize partitions from BootCamp (which is no longer supported) to the disk utility. But there are some pitfalls.

  • You cannot have booted from the partition that you want to resize. This should be obvious, but there’s no documentation that appears to point that out, nor is the error message you get really useful (either “not enough space” or “the resource is temporarily unavailable”, both after the program works for quite a long time – come on, this is the first thing the application should check!)
  • You cannot have files larger than about 1GB on the partition if you want to shrink it. Again, no useful error message (only the “not enough space” one).
  • Related to the last point, on MacBooks and MacBook Pros there is a hibernation image /private/var/vm/sleepimage that is the same size as your system memory – 4GB in my case. Which you cannot delete unless you turn off hibernation and sleep support.

So here’s what you need to do.

  • Back up your data. I mean it. All of it.
  • Find all files larger than 1GB. I assume that you want to resize your / partition – if it’s another one, change the starting point of the following command accordingly. In a terminal window run
    sudo find -x / -regex /dev\* -prune -o -regex /net\* -prune -o -size +1G
    and look at the output. Since you made a full backup, delete the files that are 1GB or larger (which are the ones that should be listed by this command).
  • The one you can’t simply delete is the the sleepimage mentioned above. Follow these steps:
    • Save the current hibernation mode
      sudo pmset -g | grep hibernatemode > ~/current_mode.txt
    • Turn of hibernation
      sudo pmset -a hibernatemode 0
    • Delete the file
      sudo rm /private/var/vm/sleepimage
    • Don’t forget to restore the hibernation mode after you are done resizing your partition:
      sudo pmset -a hibernatemode `cat ~/current_mode.txt`
  • Now boot from your Leopard DVD
  • After selecting the language wait for the menu bar to show up and under Utilities pick the Disk Utility.
  • Click on your disk on the left, and click on Partition in the header of the main area of the window.
  • Now you can resize the partitions, add new partitions, etc.
  • Click Apply, wait for it to finish, and reboot the system.

Surprisingly hard – I think Apple could have solved this one better…

Using the Motorola Ming (A1200) as GPRS / EDGE modem on a Mac running Leopard

This is an update to an older post of mine that dealt with this same issue under Tiger. Since I wrote that post I have upgraded to Leopard and found out that things are once again different. So her are the instructions for Leopard.

Let’s start with something that has nothing to do with the OS your are running on your Mac. The Motorola Ming (or A1200) supports EDGE! It seems all phones shipped so far have this feature disabled, but there’s a detailed post that explains how to enable EDGE on Motorolahelper. Using EDGE appears to drain the battery even faster than using GPRS, but it does give you a nice speed boost (still nowhere near 3G speed, but at least now you are on par with an iPhone…).

But let’s get to the real story – making this work with Leopard!

Leopard changed the format of the Modem Scripts and brings many new configuration options. That’s all nice and well, except that the initialization sequence it uses for Motorola GPRS phones is simply wrong! So the first thing you need to do is to update the modem properties in
/Library/Modem Scripts/Generic GPRS.ccl/Contents/Info.plist. Double click it in Finder and the Property List Editor will open. Click on the little triangle in front of Root, then on the little triangle in front of CCL Personalities and then on the one in front of Motorola GPRS and finally CCL Parameters.

Now double click on the value that is there and replace it with &FE0V1&C1S0=0 and hit return. Click Save in the File menu and close the application.

Next you go through the steps to pair with the phone and setup the connection details.

  1. Enable Bluetooth on your Ming (you can do this with the Bluetooth application that you can find in the Home folder or via the the status screen that you get when clicking on the status bar that includes the battery indicator and time). Make sure you set it to be discoverable.
  2. On the Mac, open System Preferences -> Bluetooth.
  3. Click on the ‘+’ sign in the lower left corner which opens the Bluetooth Setup Assistant. Click Continue, select Mobile Phone and again click Continue
  4. You should now see your phone listed – if not, make sure it is still discoverable (that lasts only for 3 minutes) and make sure Bluetooth is turned on on your Mac.

  5. With your Ming highlighted click on Continue again. The Mac is “gathering information on your device”. If this is the first time you pair the computer with the phone via Bluetooth you’ll be asked to enter a numeric passphrase on the phone. Once that is done once again click Continue.
  6. On the next screen make sure that “Access the Internet with your phone’s data connection” is enabled and click Continue again.
  7. Now you are at the “Bluetooth Mobile Phone Set Up” screen. Select Phone Vendor Motorola, Phone Model GPRS (GSM/3G) (that’s the one we just fixed). Username tmobile, Password tmobile, APN internet2.voicestream.com and CID 2. Make sure that “Show Modem status in the menu bar” is selected.

The screen should look like this:

Bluetooth Mobile Phone Set Up

Clicking Continue again gets you to the final screen that sums up your settings.

Now you can click on the little phone symbol in your menu bar, select Bluetooth and connect to the internet!

Postfix and SpamAssassin on OS X Tiger

I wrote about setting up Postfix on Tiger before. But after quite a while of procrastination I decided I also wanted to do something about the flood of spam that was sent to hohndel.org. SpamAssassin seems to be the preferred method to go (if you are in the open source camp). It’s bundled with Mac OS X server – but why spend that money… it’s easy enough to set up from scratch.

These instructions are based on a posting by Kalinga Athulathmudali where he describes a similar setup, but not for OS X.

First make sure you have your CPAN setup straight. Some hints to make sure all is well are here.

Next, install SpamAssasin.
$ sudo perl -MCPAN -e shell
cpan[1]> install Mail::SpamAssassin
quit

Use the System Preferences of OS X to create a user named spamfilter. Give it a random password and make sure the user isn’t allowed to administer the system.

To work around a couple of issues with the way postfix deals with the return values of filters we’ll create a little script that will do the filtering.

# Clean up when done or when aborting.
trap "rm -f /tmp/out.$$" 0 1 2 3 15
# Pipe message to spamc
cat | /usr/bin/spamc -u spamfilter > /tmp/out.$$
/usr/sbin/sendmail -i "$@" < /tmp/out.$$
# Postfix returns the exit status of the Postfix sendmail command.
exit $?

Next we make sure that spamd is started whenever the system boots. For this we simply create an entry in the StartupItems – a tar file with the necessary instructions can be found on the SpamAssassin Wiki.

Now you need to make sure that SpamAssassin is called from postfix; edit /etc/postfix/master.cf with the following two changes. First make sure that smtp over inet looks like this

smtp inet n - n - - smtpd
    -o content_filter=spamfilter:dummy


and then add an entry for the spamfilter:

spamfilter unix - n n - - pipe
    flags=Rq user=spamfilter argv=/usr/local/bin/spamfilter -f ${sender} -- ${recipient}


the last line starting with flags=Rq is actually one line; this WordPress theme makes it a little hard to render this correctly.

Run postfix reload to force postfix to read the new configuration and watch your logfiles to make sure that spamd is called correctly (remember that you need to start spamd as root in the background – or you can just reboot which will take care of that as well). Your /var/log/mail.log file should contain entries like this:

spamd[???]: spamd: connection from localhost [127.0.0.1] at port 49671
spamd[???]: spamd: setuid to spamfilter succeeded
spamd[???]: spamd: processing message for spamfilter:???

The final step is now to filter the spam mail from your normal mail flow. I prefer to use procmail for that. A simple entry like this in your .procmailrc file should do the trick (but that depends on the folder layout of your preferred mail client… as I mentioned before, I prefer mutt. In that case this should work:

PATH=/usr/bin:/bin:/usr/local/bin:.
SPAMMAIL=$HOME/Mail/spam

:0:
* ^X-Spam-Level: \*\*\*\*\*
$SPAMMAIL

With this all mail with a Spam-Level of five or more will not be in your normal inbox but instead in a mailbox named spam in your mail folder.

As always, corrections and suggestions for improvement are welcome.

Next Page »