Saturday, October 20, 2012

Going on Safari in Linux-world

Now that Firestorm is settled, and the system can do its primary task of running a Second Life viewer fast, I'm turning my attention to other things. After all, part of my motivation for this box is to evaluate Linux on the desktop in general, in preparation for the day my Mac Pro can't run a currently supported OS X.

The application I run most, as with damned near everyone else, is a web browser. On OS X, I'm a Safari user. Safari provides the cleanest experience on the Mac, and does the least to break the OS X application design standards. By comparison, Chrome and Firefox are terrible OS X applications, wedging their own UI into an OS X window.

Of course, Safari isn't available on Linux. So I 'm stuck with another browser. I decided to try Chrome; Firefox seems to me to be clunky and bloated, and Chrome appears to be the emerging standard. The ability to sync bookmarks and history through the Google cloud across systems is also attractive to me. I'm not interested in Opera just because it has too small a market share for people to make sure their pages work on it; most do, but many don't.

There are a few things that Chrome does that annoy me, though.

The biggest is that there's no equivalent to the Safari Top Sites page (or the Opera Speed Dial page). This is a page that shows thumbnails of most commonly visited sites. You can also pin a site to the page. I have Safari set to show 24 pages, and they're all pinned in place.

Chrome has a Most Visited selection on the New Tab page, but it comes up short in two respects: it only shows 8 pages, and you can't control what it shows.

Another annoyance is that I can't seem to get it to stay open when closing the last tab. What I want to do is when I close the last tab, have it open a New Tab; I only want it to exit when I close the entire window (with the X on the window frame). What I'd really like is to have it simply open the Most Visited page if that could be made to work the way I want.

I'm also not a fan of tabbed browsing. I never saw why people raved over it so much; it's just another UI choice that's not consistent with the rest of the system UI. Even so, I seem to be stuck with it.

Another minor annoyance - and this one's really, really strange to me - is that the default application selection doesn't include one for fast access to Google+! There's one for Gmail, but to get to G+, you have to go somewhere else. There doesn't seem to be one in the Chrome Web Store, either.

I do like the ability for Chrome to manage multiple Google accounts and do the Right Thing with them even when the site doesn't handle multiple sign-in properly (Blogger, I'm looking at you!). That's a Big Win, and one more reason to like Chrome. Unfortunately, there's at least one account I have that I can't sign in to! I tell it the username and password - and even copy and paste the password, and that password logs in to Gmail fine - and Chrome says that it can't log me in. WTF?

Finally, one more UI annoyance: The application menu is in a non-obvious place. The UI convention is to have an application menu, dammit, not a button that kinda leads to one.

I'm sure I'll get used to it, but it's still annoying.

Observations on fragmentation

I've been away dealing with things other than getting Linux working as a desktop user system for the past week or so. I just got back to it today.

The biggest thing that strikes me, now, in comparing OS X to Linux on the desktop is that there's no one thing that can be called Linux. This is true in ways both obvious and hidden but no less real. An OS X user knows exactly what he will be getting on his desktop. A Linux user? Uhm. KDE 4, KDE 3, GNOME 4, GNOME 3, GNOME 2, Xfce, MATE, Cinnamon, LXDE, Unity, e-i-e-i-o. None of them work the same, none of them are configured the same - or even configurable to the same degree - and none of them provide the same capabilities.

There's an argument to be made that this diversity is good. Certainly, if you don't like, or can't adapt, to the OS X way of doing things, then you're not going to be happy with the fact that you can't change many things about the OS X desktop. My roommate is in this camp. He uses Xfce, and tweaks it to his liking.

There's a bigger cost here, though, and that is that developers don't have a single target to aim at. I was reminded of this when I saw a Slashdot article yesterday about how Good Old Games was just announcing OS X versions of its games, but not Linux versions:
If we're able to bring GOG.com games to Linux--and we're constantly evaluating ways that we can do this--we want to make sure that we're doing it the GOG.com way: simple, easy, and it 'just works.' I'm not telling you guys to give up hope--we know how much you want this--but what I am saying is that this is harder to support than it might seem initially, and we're not ready to move to support Linux officially just yet.
"Harder to support than it might seem initially" is an understatement.  I've commented before on the plethora of audio standards on the Linux desktop. (Come on, folks, the old saw "the great thing about standards is that there are so many to choose from" is not intended to be prescriptive!) There are more problems, though. The list of libraries that are present on most systems and yet must be statically linked into a shipping program in order to make sure it works right is insanely long. I got help from one of the Firestorm development team in building a 64-bit version just so audio would work correctly, and the resulting wiki page shows just how daunting a task this is.

Right about here is where the Linux hardliners say "but everyone should build from source instead of installing binaries!" Wrong. The average user will take one look at that page and head to the Apple Store.

There's also the minor matter of putting the program in whatever the desktop environment calls the equivalent to the Windows Start Menu. (Dock? What's that? I've resigned myself to a Windows-style menu and taskbar, bleh.) 40 zillion desktops means there's no single way a program's installation process can automate adding it to the menu. For that matter, there's no real reason to install at all, and it seems many programs don't, leaving the user's home directory cluttered with dot-named subdirectories.

People talk about Android fragmentation in the smartphone/app tablet space. Compared to Linux on the desktop, Android is a model of unity.

Thursday, October 11, 2012

A dangling web

You'd think, in this day and age, something as simple as clicking on a link in another application would fire up the user's preferred browser and open the linked URL, right? Not on my Mint system.

One of the first things I did was install Chrome. Firefox just seems clunky to me. Chrome does too, but it seems less clunky, and also seems to be the next big standard in browsers. I'll whip it into shape, or at least to the point I'll be used to it.

But all is not well in browserville. You guessed it: clicking on a link in Firestorm does nothing at all. There's some bit of low magic I've apparently missed, or that Mint doesn't get right, or that didn't get set up somewhere during the install.

Firestorm does know how to open URLs in an external browser. My roommate's systems do this fine. So do the folks on the Firestorm support team, when I asked them. (Digression: Firestorm has a kick-ass support team inworld. They know all, or can at least find out, not just about Firestorm, but about Second Life in general.)

I'll have to look into the mechanism Firestorm uses to open a URL in an external browser to see where the disconnect is. Of course, (this is a familiar refrain now, isn't it?) this Just Works on OS X.My guess is that this is one of those things that is different from one desktop manager to another.

That leads me to an overall observation: there's no such thing as Linux. There are forty zillion different Linuxes. (Linuces? How come Linux doesn't get this hackish plural?) I should probably say something at this point about "trapped in a twisty little maze of Linuxes, all different". Each one has its own way of doing things, and the differences cause seams that things fall into, like opening URLs from applications.

Just as annoying is that this works better after the reinstall than it did before it. The first time I set up the system, the default browser selection didn't work. When I asked for help in Banshee, for example, Mint opened up Firefox to show me the documentation page instead of Chrome. That much at least works this time around, though I have no idea why.

I expect that I'll be tripping over this kind of thing throughout my Linux experience, and it will continue to annoy me - because I know it can be different, and the difference is between having something Just Work and having to dig and tweak and fiddle.

Saving my sanity

Grrrrrrr...The system is so thoroughly screwed up that I'm just going to scrub it off and start over.

I decided I'd try building Firestorm myself, just to see if I could. The problem is that I tried building the release version as a 32-bit binary. This was a major mistake, and exposed a serious problem in how Linux - at least the current Linux toolchain - handles 32- vs. 64-bit support.

I guess I was lulled into a false sense of security by developing on OS X. There, libraries can have both 32- and 64-bit flavors, and the Right Thing Just Happens when you use them. Not so on Linux. Debian et al have what they call "multiarch" support, but there are lots and lots of holes.

When I tried launching the build last night, it complained about the 64-bit libraries being the wrong architecture. Fair enough. A quick Google showed that I needed to install the library package suffixed with ":i386". I did, and did so a few more times when it tripped over them. Eventually, though, I got to a spot that couldn't be fixed that way.

I Googled. I installed more packages. I reran. It blew up. I installed still more packages. I installed packages with ":i386", and without it. The system got more and more screwed up, and I lost track of where I was. Finally, I gave up and went to bed.

Just now, I tried running the release version of Firestorm. It gave me the same complaint that it did when I first installed it and the 32-bit libraries weren't there. I tried reinstalling them. No luck.

That's when I decided that it would be easier for me to just scrub it all off and start over. Less cussing for my roommate to listen to, too.

The release version of Firestorm is built on a 64-bit Linux system, apparently without problems. I'm not going to try that myself again, though. If I do build on Linux, it'll be 64-bit. Period, the end.

It's simply not possible to screw up OS X this way unless you use lots of commands that begin with "sudo". It shouldn't be possible to screw up a Linux box this way, either.

Wednesday, October 10, 2012

Fun with remote control

For now, the new machine is set up on the coffee table in the living room. That was the easiest place to set up and build, and my roommate's already got things placed there for a machine he's building up for a friend. My office is upstairs, though. While running up and down the stairs whenever I get some time to work on the new box gives me a little badly-needed exercise, it's nicer if I can just drive it from the desk I sit at most of the day.

On OS X, this is simple. VNC and sshd and the rest are all built into the system. Want to enable them? Just go to System Preferences->Sharing and turn them on.

Not so with Mint. VNC is installed, but I had to turn to Google to find out how to enable the included vino server. It turns out that previous versions included a Desktop Sharing menu item, but Mint 13 with MATE doesn't. I added it, and then set up a startup application entry to actually start the server. That got it working, with one not-so-minor flaw: the VNC session doesn't have the taskbar in it! That makes it damned hard to use the system. So far, I haven't found out why.

Connecting to VNC on the system connects to my already-logged-in desktop. I don't know if it's possible instead to set the VNC server up as another X display with a different login; that may fix the missing taskbar problem.

While I was adding things to the menu, I also added a menu entry for Firestorm. That was easy enough until I went to ad the corresponding icon. Googling wasn't any help, and it wasn't till I randomly clicked on the icon panel in editing the menu entry that I found out how to make it work.

At least sshd was easier. I did have to install it, but there's a virtual package that includes it. Once that was done, it Just Worked.

I haven't installed an FTP daemon yet. I assume that it's probably vsftpd, or something similar, and will require setting up before it can actually be used for anything.

This is all emblematic of the major difference between the OS X philosophy and the Linux philosophy. Linux is full of choices, and full of different ways to get to the same point, and leaves it up to the user to decide - and install. The kinds of folks who build Linux distributions understand and know and expect to install packages right and left. They also understand that they'll need to go several places to configure things, and even edit config files in /etc. An OS X user doesn't have to fiddle with any of that. It's there in the system. All they have to do is go to one unified system preferences application, where panes all act the same way and provide enough control easily, with more esoteric settings hidden behind an Advanced button.

Once you get Linux set up, it works well enough, but getting it that way takes much more work.

Addendum: While Chicken of the VNC doesn't show the taskbar, Apple's Remote Connect (the VNC client built into OS X) does. Weird. It saw that the Linux box was offering a VNC service and showed it to me as a remote desktop in the Finder's Shared list.

Tuesday, October 9, 2012

The sound of silence

So far, everything went about as well as could be expected. That changed when I tried to get sound working.

After I got Firestorm installed, and poked around with it a while, I broke away to take care of other things, like dinner. By now, my roommate had woken up. I mentioned that I hadn't tried sound, and he pointed out that he had put a pair of speakers near the new machine to use for testing. I went back downstairs and hooked them up.

The good news is that Firestorm's own sounds worked well with the default configuration.
The bad news is that streaming music is an unmitigated mess.

I should point out here that Second Life allows each parcel of virtual land to have a Shoutcast stream URL associated with it. This is most commonly used for the purpose I wanted it: to be able to go to a club and listen to a set spun by a DJ. My friend Avril Korman, better known as DJ Bronxelf or by her inworld name Axi Kurmin (and no, I'm not giving away any secrets; she publicizes it herself) runs one such club by the name of Gothika. It was watching my roommate there that first got me to thinking about a new machine.

On Windows or OS X, this Just Works: you go to the club, and when the DJ starts the set, you click on an icon of two musical notes, Firestorm connects to the Shoutcast stream, and the music starts playing. On a 64-bit Linux system, this is a major nightmare. It turns out that Firestorm is a 32-bit application; it can be built as 64-bit, but that takes serious hackery. This is why the 32-bit libraries needed installing. The problem is that Firestorm and all other Second Life viewers use gstreamer on Linux to do this job, and apparently gstreamer has its own set of weirdnesses.

Firestorm is built with support for both OpenAL and FMOD. OpenAL is used by default, but you can force it to be turned off by uncommenting one line in the shell script that launches the viewer. With OpenAL, Firestorm's built-in sounds, and sounds not coming from a stream, work fine, but streaming audio is totally silent. With OpenAL disabled, falling back to FMOD (which uses version 3.75, old enough that it's no longer available for download), the streaming audio works, but the other sounds are badly lagged. Very badly. As in they are heard over a minute after the event that should be triggering them.

All right, so I can deal with that by kludging around it: I could open the stream URL in the Banshee media player and listen that way, leaving Firestorm set to use OpenAL for its own sounds. That led to another problem, though. The sound from Banshee was very, very loud, and the sound from Firestorm was not. If I set the system master volume to make Firestorm audible at my preferred level, Banshee badly overdrove the speakers.

"Turn down the volume control on Banshee", I hear you saying. Yeah, that's what I thought, too. I finally found Banshee's volume control after an hour: I tripped over it while I was looking at every display on the program. It turns out that the volume control is only accessible from the "Now playing" screen, which doesn't make a lot of sense to look at when playing a stream.

Still, I got it all evened out and usable, and went to the set before Bronxelf's. (Hers is at midnight US Central, and I don't usually stay up that late.) That took turning Banshee's audio output all the way down to 11%. Firestorm performed well, and overall I was happy.

But still, it wasn't Just Working, as I have come to expect. So this morning, I went back to poking at it. What I found is that sound on Linux is an unholy mess. OSS and OpenAL and ALSA and PulseAudio and bears, oh my! I don't know what's current, what's deprecated, what's supposed to work, what's not, what's the intended way to get things running, and what's an unholy kludge.

I do know what works: nothing.

I spent the day piddling and trying different configuration parameters and rebooting and tweaking and got exactly nowhere. The most promising approach, the one my roommate uses to get it working on his Ubuntu 12.04 system, consists of running Firestorm with FMOD under the control of another program, padsp. That didn't work: Firestorm refused to start because it couldn't preload the library that padsp places in the environment to do the magic. Nothing else I tried could get it to quit lagging with FMOD or to produce streaming audio with OpenAL.

Yes, I know that FMOD 3.75 is old, old, old. It's still what we have to work with. It Just Works on Windows and OS X. It should Just Work on Linux. Linden Lab is starting to work on integrating FMODEx 4.whatever into the viewer; this is not a straight drop-in, as the APIs changed. That doesn't change the fact that, for this purpose, Linux does not fail to suck.

I'll probably stick with the OpenAL/Banshee configuration for now. At least that way, the sounds I'm used to getting as I use the viewer happen when I expect instead of enough later that I wonder what the hell I clicked to make it make that noise.

Installing the OS

With the box together, the next step was to pick and install a Linux distribution.

I'm not plugged into the Linux world, and the whole hooraw over which distribution is best bores me for the most part. Again, I'm used to one OS: you install it, it works, you go on about your business. Still, I do have opinions.

The very first one is that any distribution that calls itself GNU/Linux is automatically disqualified. If I wanted to run a GNU OS, I'd run Hurd. Oh, right, you can't, can you? For Richard Stallman to insist on horning in on the credit that rightfully belongs to Linus Torvalds is on par with the rest of his approach, and speaks poorly for him as anything but a fanatic. I'm not doing this as a political statement, and I will not support Stallmanite politics in any way I can possibly avoid.

There's also another battle I want to stay out of: Unity. Canonical seems to shift positions, and UIs, with each major release. I'm staying the hell off that treadmill. Unity seems to be universally reviled. This entire affair is different for me: one OS, one UI. You can customize the UI, though, something my roommate prefers greatly over OS X; me, I have no particular plans to do so.

That rules out the most popular Linux distribution, Ubuntu. Nevertheless, there are advantages to following the crowd, most notably in finding answers on the net. When your support comes from Googling things, the more people using the system, the better.

I also want a system with all the moving parts included, or at least easily integrated from standard sources. I don't care if my graphics drivers are open source. I just care that I can install them and they work. The same goes for multimedia codecs.

Fortunately, there's a distribution that's based on Ubuntu that doesn't kowtow to Stallman and has a wide user base, with all the moving parts included or easily added: Linux Mint. I haven't seen any real complaints about it anywhere. Being Ubuntu-based, Ubuntu and Debian packages will install on it cleanly. I also found a fair amount of hits when I randomly Googled around.

I actually made this decision a few weeks ago. I downloaded Linux Mint 13 with MATE, since that seems to be their preferred UI, and set it up on a virtual machine under Parallels. The install went cleanly and quickly. I wasn't able to run Firestorm under it, but that's because Parallels 7 doesn't virtualize the graphics adapter completely and the Catalyst drivers wouldn't install. It seemed reasonable enough to me, so I burned a DVD.

Fast-forward to yesterday. I had this shiny new machine all set up and ready to run, so I stuck the DVD in the drive and brought the system up. I was quite pleased to see Mint start right up with no problems, and recognize the hardware with no fiddling. I started an install to the hard disk, and it rightly complained at me when it discovered the machine wasn't connected to the net - and when I plugged the Ethernet cable in, it quit complaining, without my having to tell it to check again. I did partition the hard disk myself, to create an 8 GB swap partition just because running out of RAM is catastrophic without one. I gave the rest of the disk, 992 GB, to one gigantic root partition. From there, the install went along smoothly.

I did have a bit of trouble installing the Catalyst drivers, but it was PEBKAC: I tried installing the post-release updates first, and it didn't work. I then tried installing the originals, and that worked fine. The system called for a reboot after that, but I had a doctor's appointment, so I just shut it down instead.

When I got back to it, it came right up off the hard disk. The next step was to install Firestorm. I sucked it down off of the official download site and exploded the tarball. When I tried to run it, though, it complained at me about missing libraries. I should have remembered that from running it in the VM: the ia32 compatibility libraries needed to be installed. A quick trip through synaptic - and I do mean quick; it downloaded 243 packages and installed them in under five minutes - and that was done. Firestorm then came up with no further complaints.

I poked around a few places I use for framerate testing, and got a quite pleasant surprise: one scene at my home that gives me about 24 FPS if I'm lucky on the Mac Pro did better than 50. Even better, the scene that I notice most on my roommate's computer ran at 46 FPS with nobody else in view, and later that night, at 34 FPS with six avatars around.

For a Mac user, the installation was about as easy as installing OS X from scratch. An OS X user wouldn't have to install the 32-bit compatibility packages, though; they'd already be there. On the other hand, optional packages that need installing take slightly more work than synaptic requires; there are very, very few of them, however, so the user only has to do it maybe once for a standard system. The update process works as well as the OS X Software Updates, though again there are more of them; Apple bundles them in bigger bundles instead of updating 162 different packages.

So far, so good. It does what I set out to have it do.