KDE, aRts, and VMWare

VMWare Server has the, rather nice, ability to allow you to connect “sound cards” to virtual machines and then play the sound on the host machine. In essence, it tunnels the output to the virtual sound card to the host machine. This is nice for me, as one of my main home uses of VMWare is for use with Napster (the legal one; I never used it as a P2P) and game playing. The last several times I have set up a computer with KDE and aRts, I have had some miscellaneous issues getting sound to run. So, I thought I would document the resolution here.

After setting up VMWare, I also install the ESD/aRts wrapper. This is necessary on Gentoo, but I never had to do it separately on Ubuntu. After starting VMWare through the ESD wrapper, you should be able to connect a digital sound device. Under KDE, however, this usually fails initially. This is the nasty little trick you have to remember (that I never do, since I only do it once for each install I do): go to audio options in the KDE Control Center and check “Enable suspend if idle after ” and fill in some number of seconds. This is important, because if it is not done, KDE will never release the sound device and VMWare will never be able to acquire it.

The Use, Unuse, and Abuse of Scripting

Ah, good old scripting. The way to quickly automate those obnoxious, drawn out tasks. That is what bash (or zsh, ksh, csh, etc. ad infinitum) is for, it is what Python is for, it is what Ruby is for, it is what Perl is for. At my current job, I get a lot of those little tasks that need to get done, but would be tedious (not to mention very, very long) to do by hand, but are superbly suited for scripting. Fifteen or twenty minutes spent writing the script and I can do other things while the input is getting crunched. I’ve had times were the script took about fifteen or twenty minutes to write, but I had enough input that it took hours to finish crunching.

Yet I continue to be amazed at the number of people who will simply rush in and do the task at hand, spending many tedious hours doing little details without even stopping to wonder if there is a better way. I admit it: I would go insane doing the same thing. These are the unusers.

Then there are people on the other end. There are the people who want to write a 3D engine in Perl or a massive enterprise application in Python.
These are the abusers. Any and every conceivable task must be done in scripting language XYZ. Heck, there are even wiki engines written in bash. While the line between applications development and scripting has been somewhat blurred, there are still things that it is just not a good idea to script. Anything where performance is key would be a place where you do not want to script or anything that is going to be expected to scale way up.
The proper use of scripting, in my every so humble opinion, is the automating of tasks, usually through the gluing together of other components. Personally, I use bash for most of this type of work and, when bash can’t do it, Python. For actual development, I usually use C#, Haskell, or Scheme, with a smattering of C/C++. I don’t use Perl at all if I can avoid it. Not to upset anyone or anything, but Perl looks like line noise. It is just way too kludgy a way to do things for my taste.

Where do the culprits come in? The unusers tend to be in corposphere where the vast majority of the people who get these little tasks don’t know anything about programming and hence don’t even know that there is a better way. The abusers tend to be the h4x0r types. No sense of larger aesthetic, just quick and dirty get the job done. Sadly, there aren’t too many users out there. Many IT staffs are shackled from doing this sort of thing and most of the admins couldn’t do it anyway. The places where it tends to get done right, I think, are in individuals’ homes where they have free creative lease, acadamia (I had a professor who more or less graded work on scripted unit testing), and *NIX shops.

Gentoo — for the Ubuntu/Fedora/etc Linux user

When I first used Gentoo, it was after I had been using Fedora Linux already. I saw a great deal of potential in Fedora, but I found it too bloated. I started stripping things out, but I figured then, as I believe now, that it is easier to start minimal and build up then to strip out what is unwanted. The other thing I knew was that RPMs were unacceptable. I was able to break the system way too easily. By nature, I am a tinkerer and I can crash anything once I fiddle at a low enough level, but I was able to break down the packaging system too easily. A couple guys at school told me about Gentoo. So, I started using it. As advertised on its website, it took a long time to build all of the necessary components. Not really knowing what I was doing, I did things the Wrong Way (TM). When the mess got big enough, I switched to Slackware. After doing a bit more reading (and managing to get lost in my own Slackware box), I went with Gentoo. The point here is that my time with Gentoo has been interspersed with Fedora, Slackware, and Ubuntu. In short, I know what it’s like to jump into Gentoo and get in over your head. Also like with Linux, I could see the power and potential from the beginning so I hung with it and now I am here to share my wisdom with those who are used to the more friendly side of Linux.

First, the thing you have to understand is that Gentoo is, in essence, a semi-automated Linux from scratch. Gentoo’s idea of eye candy is having the prompt colored by default (which is cool). As time has gone on, the Gentoo team has tried to introduce an installer written in Python to take some of the pain out of this process. I must say, as much as I wanted to love the installer, last time I tried it I couldn’t get it to do jack. It was quicker and easier to go the old-school way. With that in mind, the first thing to do is to sit down and (preferably on paper) write down what you want to be on the machine because Gentoo’s philosophy is, as much as possible, if you don’t ask for it you ain’t getting it. We’ll come back to this point shortly.

Secondly, USE flags. They are, with portage, the most touted feature of Gentoo and well they should be. They offer unprecedented flexibility and power. “With great power comes great responsibility” a tired old phrase in our Spiderman infested world holds true. Good USE flags are the difference between a fast, stable system and a buggy crashing one.

Thirdly, READ THE MANUAL! Like probably every one of you, my first instinct is to think that the stupid manual is overrated and I will figure it out later. Well, you won’t get away with it here. Read the manual every step of the way. It’ll save your life.

So, with that in mind, here are my tips for getting started (note: at least skim the handbook first; this will all make more sense then):

  • Go to the USE flag reference page and read through the list. Add the use flag for any functionality you will want throughout the system. So, for example, if you are setting up a desktop system, you will almost certainly want the X use flag throughout the system.
  • Unless your goal is to experiment with multiple kernels, pick your kernel and install that kernel and ONLY that kernel. Since I was doing all of this on a laptop, I wanted hibernate capabilities, so I needed the Suspend2 kernel sources. In one of my earlier installs, I went with a default not thinking about it and got myself into trouble later when I had multiple packages built against different kernel sources.
  • If you are using genkernel this won’t matter as much, but otherwise figure out what you will need in your kernel before configuration. What kinds of power management will you want? Do you want a splash screen available? Do you have wireless cards (even if you use ndiswrapper, you will need to compile some support into the kernel)? What hardware will you be using in general? Have answers to questions like this and you will be able to get things done much cleaner the first time around.
  • Install Gentools. You’ll love it.
  • Install eix. Searching for packages and displaying packages is so much faster.
  • Before emerging anything, check the use flags. There will be packages for which you want functionality that is not necessary on the hold or functionality you will want to strip out. Check the use flags first and make adjustments as necessary to packages.use
  • Keep the system up to date. It makes that whole compile from source paradigm less painful. If you do it daily, you will usually have 1-3 packages, usually smaller libraries, that need upgrading. If you do it once every few weeks, you will tend to have a bunch of the smaller builds plus one or two of the bigger ones. Just schedule it and keep the system up to date.
  • Prowl the forums. I admit I don’t do this as much as I would like, but you never know when something interesting will pop up.
  • If you have issues, google, the gentoo wiki, and the gentoo forums are your best friends. With a little skilled searching, you will often not even need to post anything yourself.

Well, that’s about it. I’m sure I’ll add more as I think of it.

Finished changing…for now.

I finally threw my hands up in despair. When dealing with Sabayon, I finally got so fed up of trying to strip out what I didn’t want (and there was a ton) and the fact that updates get failing for odd reasons, that I gave up and have spent the last few days rebuilding my old machine as good old fashioned Gentoo Linux. Forthcoming on this site will be my quick tips for those who are Linux veterans, but Gentoo n00b’s as well as the first published versions of my Lambda Overlay (see the projects page). Forgive the delays (hey, compiling a useful desktop takes time) and stay tuned!

The Ideal Distro

After switching distros a couple of times and writing about it here, it seemed appropriate (especially given what I wrote at the end of the last post) to define what, exactly, I want in a distro. The answer is simple.

  1. Relatively simple to get up and running. Gentoo is awesome, FreeBSD is awesome, but they both suffer from the same problem: it takes too long to go from nothing to fully ready and operational desktop. Bear in mind what I amĀ  saying here. It is not that it is too hard or done the wrong way. It just takes too long. Setting up the OS should not itself be a minor hobby.
  2. Powerful package management tools. Apt-get/aptitude is inflexible, but stable yum & company is inflexible and not stable, and Gentoo is flexible but a little more flaky. All in all, I prefer Gentoo’s system, but the long and short is that I want powerful, flexible package management tools. I don’t want a psychic “I’ll do it for you” system. I just want good tools.
  3. A full system after install. I don’t want to have to do a lot of low-level work on the system after installing it. I want to be able to add software and go.
  4. Sleek, but not emaciated. Following point 3 above, I want a system that is set up (desktop, splash screens, bootloader, etc.) but not bloated. Fedora is bloated. SuSE is bloated. Heck, Sabayon is bloated and I never thought I’d see a Gentoo-based bloated distro.

It’s a relatively simple list. Most distros swing too far to one end or the other. Raw Gentoo is a semi-automated Linux from scratch. SuSE is everything and the kitchen sink. I want something that helps me get started, but puts me at the controls thereafter. Of the items on that list, number four is, I think, the only left that could use a bit of explanation. What do I consider “sleek, but not emaciated?” Well, like I indicated above, I want a bootloader, splash screens and a desktop, but what else? I think that the answer should be:

  1. GNU autotools/automake–despite all of the calls to make Linux more user-friendly, the only tried and true install method is still ./configure, make, and make install.
  2. A good shell (bash)
  3. A web browser
  4. An office suite
  5. A media player
  6. A couple of simple games.

The problem with the bloated distros is that they usually provide several versions of each. Actually, this is something that I think Ubuntu does fairly well on the whole. It covers the bases, but it doesn’t add seven web browsers, four bittorrent clients, three office suites, ad nauseum.

That said, I can assure you that MCPLinux will not be entering production anytime soon. Why? Well, I would want to bring something new to the table. You can get what I advocated above with a properly tuned and configured distro. So why go to more work? There are quite enough distros in the world. Moreover, it is a problem that I just don’t consider interesting. The whole point of rolling a distro is to do all of the dirty work for someone else. Truth be told, in this arena, I just don’t want to do the dirty work. Hopefully someone else will do it. I have my own projects to complete (like Ocean).

Time for a Change…Again!

Well, I mentioned in an earlier blog post that I was switch Gentoo for Ubuntu. Well, I have had enough of Ubuntu. It is a nice, well integrated distro. The problem is that I don’t want a nice, well integrated distro. I want one that is pleasant (i.e. has a medium amount of eye candy),. minimal, with a powerful package manager. I guess that’s the core of my complaint against Debian and its derivatives. I find the whole apt-get system a little rigid. After poking around a few days ago, I came across Sabayon. Sabayon is a Gentoo-based distro, but it is the quick and easy way to get Gentoo running. Sounded like just my cup of tea, so I grabbed a bittorrent and awaited the arrival of the ISO. Just last night, I burnt it and installed it. So, how was it?

The graphical install was painfully bad. It was very well laid out, but it crashed each time through. Finally, I gave up and went with the text installer. All was well. I selected a KDE desktop (farewell, GNOME, forever!) and let ‘er rip. It took a while to complete, the reason for which which will soon become clear.

I rebooted the system. The splash screens and logins are particularly slick, but when I logged in an OSD covered my screen, started at 100%, counted down to 0 and froze. It refused to go away. The rest of the system was fine. This is after a default install, mind you. I hadn’t restored anything or started tinkering with software yet. A bit of trial/error and googling told me that I needed to kill KMilo, the special keypress service. After doing so, the problem went away.

After getting passed that hurdle, I soon realized why the install took so long: Sabayon is as bloated as Fedora. I installed one desktop: KDE, but I got all of the “accessories” (small games, utilities, and such) of two: both KDE and GNOME. Why on earth did it install two desktops’ utilities, but one desktop? That is besides all of the other software it installed by default. I spent more time removing all the software I didn’t want then adding what I did want.

Beyond that, the system is nice. Good artwork, Gentoo toolset (is there a better one?), and all. Sabayon seems to be mostly what I’ve wanted in a distro: quick install, low level eye candy preconfigured, with a down ‘n dirty toolset so that I could manage it all myself afterwards. My big complaints were the OSD problem above and just how bloated the system was by default. Coming soon: my fantasy distro and why you probably won’t see MCPLinux (mad computer scientist linux) anytime soon.

Running Knights of Honor in VMWare

As is quite evident by the topics and articles on this blog, I am not a fan of Windows. Give me just about any *NIX system, and I’ll be happy, but not Windows. Everybody needs to relax, right? Well, every now and again, I enjoy a good video game, preferably strategy or card/board. So, I picked up Knights of Honor (KoH; I also enjoy Rome: Total War, but that won’t run under VMWare on my box due to the lack of hardware acceleration) and tried to install it on a VM running Windows XP Professional. So, what’s the big deal? You might ask. Nothing much–except that KoH uses some DRM which doesn’t always play nicely in its virtualization lockbox. Here, then, are the steps I took to get KoH installed and running:

1. I ripped Disc 1 to an iso (e.g. dd if=/dev/mycdrom of=myiso.iso). From the various boards and such that I have been reading, it appears that Disc 1 has no copy protection built in, whereas disc 2 does. Yet, I tried running disc 1 straight from the drive in VMWare and could not get around the “setup.exe is not a valid win32 application” exceptions. For some reason, of which I am not even sure, ripping the disc and running setup from the ISO works like a charm. Run the setup right up until the point where it asks for Disc 2.

2. Put Disc 2 in the physical drive. “Eject” the ISO and replace it with a reference straight to the physical drive. Make sure that “Enable legacy emulation” is checked. Once again, that last sentence was learned through trial and error. I assume the issues have something to do with the SecurROM DRM that relies on reading some sort of subchannel (no, I don’t remember the specifics).

3. Finish the install. If you have problems, ensure that your IDE adapter is set to use DMA whenever possible, rather than PIO, and continue.

4. To run the game, make sure that the IDE adapter is set to use DMA whenever possible, that the virtual CD drive is pointing to your physical one, and that legacy emulation is UNCHECKED.

Well, that’s what I did. Doesn’t sound too hard, does it? Well, if you knew how much time I spent trying random options and surfing DRM cracking boards to figure it out, you might just appreciate why it is that I am posting this (which is, in part, for my own memory and so that I have a record of the steps taken). In the end, this is a perfect example of what bugs me about DRM. I don’t mind that some kid in Bangladesh can’t get a quick and easy torrent to the studio’s work. What I mind is that I, a legal paying customer, have to resort to tricks and games use the software that I PAID for. When I bought KoH, I was buying software from Sunflower, not their hardware/software platform preferences.