Tag Archives: nix

rEFIt Troubles Resolved

refit logoMaybe you dual boot. No, maybe you triple boot. Maybe you have a complicated partition scheme juggling multiple boot record tables, and it just isn’t working.

I use Boot Camp and rEFIt to dual boot between Mac OS X and Windows 7. I recently added Ubuntu to the mix. But rEFIt has trouble synchronizing the GPT and MBR records, and as result, Mac OS X and Ubuntu boot fine, but Windows boot fails with the message:

Windows failed to start.

ENTER=Continue ESC=Exit

Ubuntu’s GRUB overwrote the Windows boot loader, corrupted the GPT-MBR tables, and crashed the GUI every ten minutes. Now I remember why I used to install Ubuntu in a VMware virtual machine. It’s less hassle. I decided to uninstall Ubuntu, fix GPT-MBR for rEFIt, and fix the Windows MBR.

It’s worth trying to sync GPT one last time. Install gptsync, either with Synaptic/apt-get, or if you’re like me and Ubuntu fails to recognized either of your network interfaces, by manual download. Assuming you have only one hard drive, you will target /dev/sda.

$ sudo gptsync /dev/sda
Status: Analysis inconclusive, will not touch this disk.
Error: Not Found returned from gptsync.efi

Rats, that’s the same error rEFIt displays. We might as well use GParted to remove Ubuntu.

You’ll find GParted under System -> Administration -> GParted. After a few minutes, GParted will identify the partitions. If you decide to remove Ubuntu but keep Mac OS X and Windows, you’ll want to delete the ext4 partition then grow Windows to the remaining free space. Don’t forget to apply the changes.

The MBR still needs to be fixed. If you have a Windows or FreeDOS CD handy, you can reboot, use Repair mode, and run fixmbr. I don’t know whether FreeDOS comes with fixmbr, the website’s downright confusing. If you don’t have some sort of livecd with fixmbr, I recommend the ms-sys Ubuntu package. I’ve used it to remove Ubuntu and restore the Windows bootloader on two computers in the last week.

$ sudo ms-sys -m /dev/sda

Then reboot, use rEFIt to sync the GPT-MBR tables, and enjoy Mac OS X and Windows again. In the future, I’ll stick to virtual machines for Linux. Partitioning is not worth the trouble.

A Quaint and Curious Distro

ubuntu logoUbuntu is Linux’s best bet for mainstream adoption. The distro has oodles of drivers, an intuitive interface, an automated installer, a livecd, thousands of apps, and a massive community support.

And yet, in late December 2011, Ubuntu, Linux’s premier desktop environment, still has fatal flaws.

  • The latest version, 11.10, exhibits glaring bugs such as random system freezes.
  • 10.04 lacks crucial drivers, including WiFi and Ethernet drivers for ASUS computers, and WiFi drivers for MacBooks.
  • Many Ubuntu packages (e.g. clisp) are out of date.
  • By default, vi can’t handle arrow keys.
  • Audio is often quiet/muted.
  • One of the first things a user sees in a fresh installation is an annoyingly long list of system updates.
  • It’s unclear whether users should install software with Synaptic, apt-get, aptitude, ppa, or build from source. This is worsened with aptitude competing with specialized package managers such as RubyGems.
  • Grub has way too many menu items. We haven’t needed RAM tests since… ever.
  • GParted lists partitions in terms of MB instead of GB.
  • Ubuntu found zero proprietary drivers for an ASUS A35E. ??

Individually, these problems are fairly Googlable/solvable. However, the aggregate effort required to configure a decent Ubuntu installation is a daunting task. It’s hard to convince nontechnical friends, or even yourself, of the usefulness of Linux. Windows is suboptimal and Mac OS X isn’t all that it could be (try managing packages between Fink, MacPorts, and Homebrew), but for many people, the dollars paid are worth the endless hours saved: Windows and Mac OS X provide basic, reliable functionality. NICs work, speakers work, finding and installing apps is a cinch.

Ubuntu will get there, and we can all save a buck once it happens, but for now I treat Ubuntu the same way I treat Haiku. They’re experiments, worth checking in on every six months, but not worth adopting for everyone.

If you’re lucky enough for Ubuntu to perfectly suit your needs (it really does have a lot of built-in drivers), then enjoy it. If not, maybe hook up an Ethernet cable and check for proprietary hardware drivers. If that doesn’t work, you might as well switch to Gentoo for all the configuring you’ll be doing. Otherwise, I recommend Mac OS X. It’s an expensive FreeBSD clone that seems to always have the right drivers for the hardware. It’s something about how Apple makes the software for its own hardware. Hmm…

Here’s a thought: Bollocks everything but a terminal, a web browser, a media player, a pack of every free/libre media codec known to man, and a pack of every free/libre Linux ethernet and WiFi driver known to man. That way, users can watch a movie while Linux silently installs relevant drivers and system updates.

How to install Haskell Platform in Ubuntu 10.04 Lucid Lynx

sudo apt-get install ghc ghc-prof cabal-install

top: The poor man’s performance analyzer

hunchentoot logoFor the sake of the future of all mankind, I wrote a tiny web server for proving that Hunchentoot works with certain system specs. “doeshunchentootwork” is only 77 lines long, serves a singe page and its favicon, and the application is compiled, not interpreted. So why does top show it using so many CPU cycles?

Daemonization may have been a bad idea, at least this early in development. The process spends a lot of time… doing what exactly?

Since the app is only 77 lines long, debugging wasn’t that hard. Long story short, CL loads the program and quits, so I was using (loop) to keep the program running. I know, I know, terrible. (read) is a better choice, since it doesn’t waste CPU by looping but merely blocks for command line input that will never arrive to a daemonized web server.

With the new code, top shows almost no activity for doeshunchentootwork unless someone is currently requesting the webpage. Whew! Now the resources can be wasted on other servers.