Tag Archives: linux

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

Haiku: Barriers to Acceptance

haiku logoHaiku is a continuation of the 90’s project BeOS, a novel operating system with emphasis on multimedia and a clean interface, basically Mac OS.

According to Practical File System Design, an excellent book by Dominic Giampaolo that used to be available for free on his website but now must be pirated, BFS is faster than FAT32 and more reliable than ext2. BFS is more powerful than both, offering features such as live file system searches and complex queries. BFS is able to do these things because the file system is organized as a database rather than a simple directory list.

Haiku does indeed have a clean interface. The main elements are the desktop and the Tracker.


BeOS lost out to Mac and Windows. Later, Haiku revived BeOS as an open source project. It has a simple installer and a Bash terminal. In a world where Linux and Unix are commonplace, why is Haiku still marginalized?


Haiku is currently where Linux was in the 90’s: few applications are available. The computer illiterate are loathe to leave the likes of Microsoft: Windows, Internet Explorer, Office, Express, and a trove of other popular applications. They’re hesitant to try out Ubuntu with its Linux, Chrome, OpenOffice, and Thunderbird. Many are too cautious to try these out on Windows, let alone Ubuntu or Haiku.

Haiku doesn’t have Internet Explorer. Haiku doesn’t have Chrome. It barely has Firefox. The default browser is WebPositive, a horribly incomplete thing (can’t minimize easily, no backspace navigation).

Haiku doesn’t have Office. It doesn’t have OpenOffice. It has AbiWord, a word processing system (no Excel, no PowerPoint) so buggy that there’s a Google Summer of Code 2011 project to reduce AbiWord’s screen flickering.

Haiku doesn’t have Express. It does have Thunderbird, but not by default. You have to search Haikuware for it. Some few ports are available, but they’re hard to install.


How do I add icons to the desktop?

  1. Click the Haiku leaf at the top right.
  2. Select Applications.
  3. Right-click the desired application.
  4. Drag to the desktop.
  5. Release.

How do I open a terminal?

  1. Click the leaf.
  2. Select applications.
  3. Select Terminal.


  1. Right-click the desktop.
  2. Select Add-ons.
  3. Select Open Terminal.


  1. Press Option+Alt+T.

The hotkey doesn’t work in VMware Fusion / Mac OS

How do I resize the browser in full screen mode?

  1. Open a new window with Alt+N.
  2. Close the old window.


  1. Click and drag the edge of the current window.

How do I type tilde (~), backtick (`), and other special characters?

  1. Press them twice (~~).
  2. A single character will appear (~).


  1. Click the Haiku leaf.
  2. Select Preferences.
  3. Select Keymap.
  4. In Select Dead Keys, set the characters to None.

How do I cut, copy, and paste text?

Where Windows uses Control, and Mac OS uses Command, use Alt instead. So:

Cut = Alt+X
Copy = Alt+C
Paste = Alt+V

Currently, WebPositive has trouble pasting text in websites like Gmail. So:

  1. Right-click the text.
  2. Select Cut, Copy, or Paste.

How do I install software?

  1. Visit Haikuware.
  2. Search for an application.
  3. Navigate past “Choose which categories to include”.
  4. Navigate past several dozen pages that have nothing to do with your search.
  5. Click Download.
  6. Locate the installer you just downloaded (probably in Home).
  7. Discover that this version is outdated.
  8. Open a terminal and type installoptionalpackage -a SOME_APP.
  9. Discover that the app is missing critical functionality (git has no curl).
  10. Become a software developer.
  11. Port the application.
  12. Use mailing lists, fora, and IRC to debug Makefiles.
  13. Realize the exact same problems were reported and ignored years ago.
  14. Package the binaries.
  15. Upload them to Haikuwhere and wherever the hell installoptionalpackage packages are kept.
  16. Take a vacation.
  17. Format and install Linux.


All these issues will plague new Haiku users. Only Google after Google can solve them. Whereas many Linux distributions explicitly offer Windows-style preferences, Haiku doesn’t care. Haiku doesn’t care that millions of users have come to expect certain behaviors from their operating system, and Haiku’s popularity suffers as a result. And it doesn’t document them in central places where users can easily find them.

BeBook doesn’t count. It’s for developers, not users. README would have been more useful.


For developers, Haiku does not make your life any easier. Missing applications like vim are available after some searching. But they’re out of date. You have to use installoptionalpackage to get a recent version. For some reason, Haikuware and installoptionalpackage do not sync with each other.

Haiku/BeOS is not Linux. It’s not a Unix. It’s almost a POSIX. Because Haiku is not Linux, Unix, or POSIX, many C/C++ projects fail to compile. They fail to configure, because Haiku is rarely added to the various configuration scripts.

Developing for Haiku is easy in Python and Perl, platform-independent scripting languages lucky enough to be ported to Haiku, but hard in C, C++, or Java. There is an OpenJDK port project for Haiku, but the page is too old to matter. The Haiku Java Team is a dead link. And good luck developing in thousands of less popular languages: Node.js, Common Lisp, Erlang, Haskell. If you want it on Haiku, you’ll have to port it yourself.

Haiku has promise, but it needs several man-years of ports before it will be widely used by developers, and much better documentation before it will be considered by consumers.

Just how obscure is Haiku? There’s a subreddit on BeOS with only three links.

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.

Cabal Woes

cabal logoProblem

Compilation errors? Installation issues? Upgrade issues? Uninstallation issues? Dependency issues? Broken packages? U JELLY? U PUDDI?


Uninstall Cabal packages

  1. rm -rf ~/.ghc
  2. rm -rf ~/.cabal

Reinstall Haskell Platform

  1. Download Haskell Platform.
  2. Install GHC and Haskell Platform.

Dependency chain companies will go bankrupt!

Broken package companies will go bankrupt!

Hackage companies will be forever in business!

In Pursuit of a Minimal and Useful Unix

unix license plateUbuntu is the most useful flavor of Unix available today. It has drivers for most hardware you’re likely to encounter, including wireless cards and camera memory sticks. Installation is a breeze, there are tons of ports, and tutorials for anything involving a terminal and an incantation of shell commands. There’s some bloat: Solitaire, instant messagers, OpenOffice, but most apps that ship with Ubuntu have their uses.

At the other end of the spectrum is Gentoo, which sucks. I won’t sugar coat it. Starting from scratch is naturally a difficult task, but it needn’t be that hard. The documentation is too general to be useful–you’ll just have to guess which drivers, libraries, and flags to use. And recompiling KDE every week is a pain, if it compiles at all.

Then there’s Damn Small Linux. It’s small (50MB), maybe too small. While it’s perfect for loading onto a thumb drive, it’s missing critical apps. PowerPoint: no. Java: no. Of all things, Damn Small Linux includes a VoIP client. What the heck?

OpenSUSE is cool for one reason: SUSE Studio. The Studio allows users to make custom livecd SUSE ISOs online for free. I love X software, hate Y, and loathe Z, so that’s perfect. SUSE Studio lets me create JeOS (“Just enough Operating System”) livecds and gigantic app-upon-app carnivals of bloatware, if I so choose. I’d looove to make an OpenSUSE livecd with my critical apps (to be listed shortly), and nothing else, but SUSE Studio still has its bugs.

My Critical Apps

  • Web browser, either Firefox or Chrome. Others like Dillo don’t count, for various HTML5/CSS3/JavaScript/tab support/hotkey-related reasons.
  • File browser. Drag and Drop should move files, because THAT’S WHAT I ALWAYS AND FOREVER WANT TO DO WHEN I DRAG AND DROP. Also, opening a directory should not open a new window. Directories are well nested.
  • USB flash drive support, including reading AND writing to NTFS and HFS+ partitions.
  • MS Office 2007 editors for Word, PowerPoint, and Excel documents.
  • PDF viewer.
  • Flash and Java support for the web browser.
  • Image, audio, and video codecs. Failure to include JPEG, GIF, PNG, BMP, music CD, MP3, WMV, MP4, MPEG, and DVD support is FAIL.
  • BitTorrent client, preferably Transmission.
  • A sane package system such as apt. MINIX‘s numbered list of 80-something packages does not count.
  • Terminal with bash.
  • Graphical text editor. Fuck you, I like to copy, paste, drag, and drop my code.
  • CLI text editor, either Vim or Nano. I also like to edit code remotely.
  • Graphical WiFi manager with support for wireless B, G, and N. Should work with Apple WiFi cards, not because the API’s easy, but because Macs are some of the most common wireless devices on the market.
  • Whichever driver makes the volume buttons on my keyboard work.
  • Programming languages. Minimum: C, Java, Perl, and Python. Strongly desired: Ruby, Haskell.

Update: So it turns out Haiku (based on BeOS) is awesome. The livecd is small (500MB in an age when livecd’s are actually livedvd’s). Tracker and BFS are perfect for each other: Files can be searched while they’re being edited or even moved. It’s got a bunch of the requirements, but some aren’t installed by default (a poor decision, e.g. users must Google their hearts out to find a BitTorrent port for Haiku).

Arch Linux Promising, Disappointing

Arch Linux looks promising. The installation is easy, the documentation is helpful, and the package manager interface is simple.

“Pacman” is Arch’s package manager. Its interface is friendly: pacman -S sets up packages, pacman -R removes them. The Official Arch Linux Install Guide aids the process of installing a graphical interface. Arch offers several: Gnome, KDE, XFCE, LXDE, Fluxbox, and others.

Trouble starts here. pacman -S xfce4 is not enough to get XFCE running. It turns out the xfce4 package requires several xorg packages, but does not automatically install them. Dependency issues prevent XFCE from starting.

The same problem occurs with Slim, a graphical login manager. Slim requires xorg packages, but does not request them. As a result, I never got XFCE or Slim working. The log files report errors starting /usr/bin/X, which does not exist.

In summary, the helpfulness of the Arch docs is directly proportional to the brokenness of Arch packages. To me, Arch is yet another distribution inferior to Ubuntu.

Comments are closed due to numerous straw man arguments. I’m not asking for Arch to include ridiculous dependencies, only the bare minimum.

XFCE needs Xorg to run. XFCE’s dependence is not preference but reality. By not installing Xorg automatically, the Arch devs have created an unnecessary hassle.

And I’ve used a dozen Linux flavors. What about the crazies that can’t figure out how to drag and drop?

Wireless Hotspots Relieved: Ptunnel Broken

ptunnel is an ICMP proxy. More generally, it hides communications such as HTTP and FTP inside ping requests. Of course, this process measurably slows down communication–don’t expect to stream HD movies with ptunnel. But plain web browsing and small file downloads are easily within the limits of ICMP steganography.

Most network devices allow ping requests. This ubiquity is the reason for ptunnel’s existence. In hotspots where proxies such as Tor are blocked, ptunnel may be a user’s only recourse.

A hypothetical situation:

You are at a bookstore. A new book has caught your eye, and you want to compare prices online. The bookstore offers WiFi, but not for free. You cleverly installed Tor before arriving, so you faithfully double-click the Tor icon and await your illicit online connection.

Instead of the normal green tint, the Tor icon is yellow, or even red. This color indicates that the bookstore has blocked Tor. How will you ever get online?

Fortunately, you also installed ptunnel. You connect to a ptunnel server and direct your web browser to lookup book prices, some of which are less than the bookstore’s. Mission accomplished.

ptunnel presents a problem for wireless ISPs: if users can ping before paying, users don’t have to pay at all. But ping provides a vital service for engineers maintaining network devices. Fortunately for hotspot businesses, and unfortunately for wardrivers, ptunnel is broken.

The ptunnel home page exhibits massive information overload. Obtaining ptunnel is actually easier than obtaining information about ptunnel. The Ubuntu/Debian install information is out of date, now that apt-get ptunnel works. The man page is horrendous, the CLI deplorable. There is no ptunnel service; you have to write your own init.d scripts. Worst of all, ptunnel has no SOCKS interface.

That’s right, ptunnel has no SOCKS interface. Instead, ptunnel users specify a listening host, a listening port, a destination host, and a destination port. This is enough for SSHing to a server, but not enough to open a web page. Most websites load resources from several sources. Pictures and videos are often hosted elsewhere. This means yahoo.com will load, but none of its images will.

Until ptunnel gains an interface for SOCKS, the de facto proxy protocol, hotspots will cost whatever they cost. Users must go elsewhere for cheap and free WiFi.

Though ptunnel is still experimental, ICMP proxying will continue to bother network administrators. In the future, proxying will be as ubiquitous as network procotols. We should expect to see ICMP, DNS, and a host of other kinds of proxies in the coming years. Wardrivers, suit up.

An OS is only as good as its package manager

ubuntu logoWhy is Ubuntu so popular? It’s not the fastest flavor of Linux, the smallest, or the most secure. Gentoo, SliTaZ, and OpenBSD beat it in these categories. Ubuntu hardly changes from update to update, it just adds a new theme or two. You could say Ubuntu has many drivers, and that’s true, but so do Knoppix and OpenSUSE. What distinguishes Ubuntu from other flavors is its packaging system.

Ubuntu is based on Debian, so it uses a package manager called aptitude. This system allows users to easily add and remove software. Without a package manager, Ubuntu users would have to compile and install software from source code.

gentoo logoThis is exactly what portage does in Gentoo. Portage searches for source code online, determines its dependencies, and begins compiling each piece. This process can take several days if, for example, a user installs Gnome or KDE. Compiling code allows Gentoo users to customize their software for their hardware, so it runs faster and installs lighter.

The downside to Portage is that users spend a lot of their time managing their software. Ubuntu users tend to be new to Linux. They are scared easily by complicated installation procedures (some don’t even know how to use apt-get). They just want Linux to work, which means:

  • Software installation and removal should be simple operations.
  • Drivers for common hardware should already be installed.
  • The package manager should require little user interaction.

This is exactly how Ubuntu behaves. Users specify software to install, such as ghc6 (Glasgow Haskell Compiler). Aptitude finds its dependencies, then downloads and installs everything. Aptitude typically requires users to press [Enter] to confirm installation. Once this completes, users can run Haskell.

Back to Portage. Before Portage can be run with emerge, users must edit their USE flags to customize which features are enabled. If they forget to supply important flags the software will be unusable and they’ll have to start at the beginning. Example: If you forget to include ext2 in your kernel, Gentoo will be unable to mount ext2 partitions.

xorg configurationOnce the correct USE flags are set, Portage can start looking up dependencies. For KDE, there are many. Portage will display the long compilation process to the user, who could have been tweaking a LAMP system in Ubuntu by now. The Gentoo users waits for days, and then…

In my case, KDE installed but failed to run. In addition to installing it, I had to configure it, which I don’t have the time or knowledge for. I figured startx or startkde would solve all my problems, but they didn’t, and xorgconfig failed to run. So I began looking at other distributions.

opensuse logoWith VMware Fusion in hand, OpenSUSE was quickly setup. YaST is apparently like Yum but better. Oh really? Minus a point: running yast as a normal user results in a generic error, instead of a message advising running it as root. YaST is meant to be run in graphical mode anyway.

At this point I began running out of distributions. Most Unix flavors are based on Debian, Red Hat, Gentoo, or FreeBSD. Out of the depths of obscurity rises a more secure, more stable version of Unix called Minix. “Maybe microkernels are worthwhile after all,” I think and download a copy.

minix logoMinix uses packman for, what else, package management. This thing is even worse than Portage. Gentoo users simply type emerge ghc6 to install Haskell. In contrast, Minix users use packman as a kind of Chinese menu, ordering software by number rather than name. No dependencies are resolved, either.

At the moment, Minix is focusing on the kernel rather than utilities. They’ll likely get a real package manager someday. By now, I’m depressed about the state of operating systems. I haven’t even discussed Windows’s next-next-next-next-agree-next-quit methodology or Mac’s drag & drop methodology. It’s a wonder people try out software at all.

Ubuntu shines for this very reason. Whereas other operating systems punish users for installing software, Ubuntu rewards them. Whereas other operating systems are filled by the dead carcasses of uninstalled software, Ubuntu remains clean and lithe. After evaluating dozens of distributions for potential in a minimal hardware system, Ubuntu is the only one I would consider. apt-get is my buddy, and I wouldn’t trade him for any other package manager. I just run apt-get install some-package and everything works, without configuration, without USE flags, without ordering from a menu.

Update: Fitzcarraldo recommends Sabayon Linux, based on Gentoo. Instead of compiling everything from source, Sabayon uses pre-compiled binaries. Instead of taking days to setup, Sabayon took minutes. As with Gentoo, Sabayon prefers KDE.

There were several minor hurdles for setting up Sabayon: the default resolution was ludicrously high, so high that moving the mouse from one end of the screen took a few strokes. The minimize/maximize/close buttons are way too small. The default theme, Oxygen, uses an ugly pastel layout that runs titlebars together with the rest of the windows. As a result, it’s hard to click and move windows, because there’s no way to tell where the titlebar begins.

More hiccups include the monitor size and rotate tool. This thing runs as a tiny daemon in the bottom right. I didn’t see it there for a while, so I thought it had crashed. As with more popular distributions, Sabayon fails to include a terminal shortcut on the desktop or the panel. You have to hunt for it in the Utilities menu.

Once a terminal was running, I ran df -h to estimate available free space. Sabayon is hefty, weighing in at 5-6 GB. Initially I used a virtual hard drive of 8 GB, but the installer complained. Another bug: the installer refused to let me return to the partitioner to provide more free space.

Notice that I haven’t even mentioned the package manager. It’s called Sulfur, and it sure stinks! It’s like a retarded version of Synaptic. There’s no way to view currently installed software without trudging through the entire universe of software. The first five times I tried to open Sulfur–Sabayon notified me many times to apply updates–it complained that it was already running and could not be allowed to interfere with itself. Synaptic, the Update Manager, and apt-get share this feature in common in Ubuntu, but they don’t lock each other out when none of them are running! This annoyance alone would normally make me call it quits, but I perservered.

Eventually, I opened a terminal and typed emerge ruby as a test. It complained that I wasn’t root, which is the right and proper thing to do. An su later, and I was root. I ran emerge ruby again. This time it said it could never satisfy my request. Phooey on Sabayon.