Fedora 27 Beta

Some Informal Notes

Fedora

I've been using the Fedora Linux distribution since, well, since there was such a thing as Fedora. (Wikipedia dates this as November 2003.) Over the past couple years, I've taken to installing pre-release versions. Occasionally Alpha releases, but they stopped doing that. Fedora 27 Beta (F27) was released on October 3, I installed it on my home workstation that very day, and it has been "in production" since.

This is not an installation tutorial—other people out there do that better—but I did run into a "gotcha" that may affect a handful of folks. Unfortunately, it requires some background explanation.

I would probably fail a Linux geek purity test, because I don't install Fedora on "bare metal". Instead, I run Oracle's (free) VirtualBox software on a Windows 10 host, and install Fedora as a virtual guest. I started using this method back on my pre-retirement work computers, and it worked so well-like having two computers, one Windows, one Linux, at my fingertips—I continued the scheme at home, post-retirement.

Also: over the past few releases, I've grown fond of the Cinnamon desktop over the default GNOME desktop Fedora provides. Your mileage may vary, and that's fine, but there's a reason that (as I type) Googling "arrogant GNOME developers" gets "about 85,900 results".

I have, by now, ritualized the upgrade method. Which, oddly enough, doesn't involve an upgrade of the existing system. There are a lot of advantages to virtualization, and one of them is that it's easy to generate a new OS installation from scratch, keeping the previous one in reserve in case you mess up.

One of the goodies of Virtualbox is its so-called Guest Additions, which installs into the guest OS and provides (among other things) "shared folders", directories available to both the host and the virtual guest. That's useful to an easy upgrade, as we'll see.

An outline of my upgrade process:

  1. Save my custom configurations and data from Fedora N to a shared folder. (I have a script to do this, so I don't forget anything.)

  2. Shut down Fedora N.

  3. Install Fedora N+1 in a new virtual guest. (The sainted Fedora developers make this easy for Cinnamon-preferers: they provide a Fedora Cinnamon Spin on the same release schedule as default Fedora.)

  4. Install any and all necessary custom packages not included in the default install.

  5. Install VirtualBox's Guest Additions and restore the shared folder configuration.

  6. Restore the saved configurations and data from the shared folder in step 1 into the new guest.

And that's it! I'm eliding a lot of gory details. But…

In Step 4, it's not always obvious what non-default packages you should install, for two reasons: First, the default installation package set always changes between releases, so you might need to explicitly install something you didn't have to previously. Second: You don't want to install something you don't need. So, in practice, it's an iterative process; you observe some breakage due to something you missed, you go back to figure that out. (To a certain mindset, this detective work is kind of fun. As long as you're not racing against the clock to fix something critical to your organization. But I'm not in that position any more.)

But what happened this time is Step 5 failed silently. Why?!

Two reasons:

  1. Cinnamon (apparently) has a new default terminal emulation application: tilix. Which is fine (this isn't Russia) but as near as I can tell, they don't install any other terminal applications.

    Problem occurs when the Guest Addition script runs: as it turns out, it looks for a terminal emulation program using a list of fixed names: Konsole, gnome-terminal, mate-terminal and xterm. So the script fails. Silently.

    So: install xterm and try again…

  2. And we fail again, because the Guest Additions installation requires the dkms (Dynamic Kernel Module Support) package to be installed. Also no longer in the default set of installed packages. So install that and try again. (This also drags in the C compiler and kernel development packages.)

And then things worked. Yay!

Finally, not that it matters, but: tilix is not my cup of tea. I've grown used to/fond of a gnome-terminal feature: tabbed sessions in a single window. You can't do that in tilix, and the developers say: Sorry, no.

Reading Schedule Generator

[http://farm1.staticflickr.com/119/281194868_23e0c0e390_n.jpg] October 2017 Update: I regret that I let this article get badly out of whack with reality. Notably, most of the links to my code, which were on the old UNH "pubpages" server, went stale when I retired. In addition, I've cleaned up the code some and fixed a nasty Daylight Savings Time-related bug. I hope. Further notes at the bottom of the article.

Note: this post is out of whack with normal Pun Salad content. Only recommended for:

  1. computer geeks who (like me) tend to approach everyday issues by asking: how could I write code to make this easier?; or
  2. psychologists who might be interested in whatever mental aberration causes the behavior exhibited in (a).

A few years back I noticed I was doing a miserable job of reading the magazines to which I was subscribed; the new issue would show up and I would have just read few if any articles in the previous one.

A similar problem with books: I would check them out of the library and return them unread. And my to-be-read pile of owned books just was getting bigger.

What worked for me was to set up a reading schedule for each "new" book or magazine. Simply read through a reasonable, fixed number of pages each day, until done. Lather, rinse, repeat.

I'm currently implementing this scheme by generating a calendar-format schedule for each item in HTML. Example for a book I read back in 2014, Freedom™ by Daniel Suarez:

[Sample Reading
Schedule]

I (1) print the schedule from my web browser, (2) cut it out, (3) attach to a card, and (4) use the result as a bookmark for the item. And each day, I try to meet the page goal for each item.

(Not that it matters, but for magazines I staple the schedule to one of the subscription cards that invariably accompany each issue. For books, I tape it to one of the plastic advertising cards the Yankee Candle company sends us, which are significantly more substantial.)

Now I'm not psycho about this: it's OK to get ahead of the goals if the material is compelling and I have the time. It's also OK to fall behind if there's just too much other stuff going on. (However, in my experience, just knowing that I've "fallen behind" is just enough self-nudging motivation to carve out some extra time to catch up later.)

Enough for the mechanics, on to the code. For a long time I ran a Perl script from a Linux command line to generate a schedule. But I realized that it would be (slightly) more flexible to set up an HTML form to get the schedule parameters, calling a CGI backend to display the result.

The form I'm using is here. (Do I have to mention that you can use your browser's source-viewing capabilities to view the HTML source? Nah, probably not.) What it looks like:

[Reading
Schedule Generator Form]

The only remotely interesting thing is use of the Javascript jQuery UI datepicker widget for getting the schedule's start and end dates. I didn't know nothin' about jQuery before I did this. (And I only know slightly more now; if you examine the source code for the form, it's not very complicated.)

The form also uses a CSS stylesheet found here; I originally wrote it to make the documentation I wrote at UNH look better, and it has a lot of cruft. Feel free to steal and clean it up.

So you fill out the form, for example:

[Reading
Schedule Generator Form]

… hit the submit button and the resulting page should produce the appropriate schedule. (I'm pretty sure it would work for you if you want to try it.)

The real work is performed by the Perl CGI script, which relies heavily on the smarts contained in the CGI.pm, HTML::Template, and Date::Manip modules. If you'd like to look at that (feel free to adapt it to your own preferences if you are so inclined): the plaintext Perl file is here and the html-prettyprinted version is here. The HTML template used by the script is also important and that's here.

Additional notes (October 2017).

  • As previously mentioned, the original version of the CGI script lived on the UNH "pubpages" webserver, where I enjoyed root access. It's now on the Pun Salad server, where I don't. This is problematic when you need to install some random CPAN perl module.

    Solution (or, at least, what I'm doing): use cpanm to install necessary modules "unprivileged" and put use local::lib; in scripts to find them. (This seems to work for CGIs, surprisingly.)

  • The most recent bug squashed was one I've struggled with for years: if your timezone does DST, not all days are 24 hours: the "spring forward" day has only 23; the "fall back" day has 25. This resulted in strange behavior when a reading schedule traversed one of those days.

    The fix turned out to be relatively easy: tell the script to pretend it's in the UTC timezone. Duh. That's accomplished by (for example) the line

    $startdate->config( 'setdate', 'now,UTC' );


Last Modified 2017-10-13 7:58 PM EDT

Fedora 19

fedora poker chips I’ve been using Red Hat flavors of Linux since 1996 (with a brief flirtation with Slackware in 1995), and I’ve been married to the offspring Fedora distribution since early 2004. I’ve been tempted to stray to some other distro, but I’m just not adventuresome that way. In theory, some major malfeature could make me file for divorce, but that hasn’t happened yet.

[Notice the strained analogy in the above paragraph? It’s not far off.]

Fedora 19 is their latest version, in Beta as I type (scheduled for actual release on July 2). On a whim I decided to install it on machines at work and home. (The work machine is a VMWare virtual machine run under Windows 7 on a Dell Optiplex 780; my home box is an older Dell running Linux-only.)

Some notes:

  • Well first, an important one. Your mileage may vary. Poor Rand Simberg, for example, encountered display problems and data loss during/after his upgrade. (Although the latter can’t really be blamed on Fedora.)

    Bottom line: no matter how knowledgeable you are, an OS upgrade is good time to wear both suspenders and a belt. If you have a working environment with precious data, you’ll want to be able to fall back to it if things go wrong.

    But things didn’t go wrong in my case. So yay.

  • The Fedora 19 installer is not much changed from the Fedora 18 installer. Which at least one guy found to be “counter-intuitive, dangerous and useless, all at the same time.” But once I figured out what the deal was, I thought it was OK.

  • I made things slightly more challenging by opting to use the MATE desktop environment instead of the Xfce environment that I’d been using for the past few iterations of Fedora. (Cinnamon might have been another candidate, but I arbitrarily passed.)

    I’d switched to Xfce after hitting and bouncing off Gnome 3, which became the default with Fedora 15. What an awful decision for the Fedora honchos to make! And it didn’t help that the Gnome developers came off as snooty and unsympathetic; if we puny users could not appreciate their brilliant design, it was our fault. True fact: Googling gnome arrogance brings up 2.7 million hits, and they’re not all talking about the garden statues.

    I understand Gnome may have gotten better since then. Don’t care. Fortunately, you can easily choose which environment to install. And you can have multiple environments installed if you want to compare and contrast.

  • As stated, the work machine was a spankin’ new virtual machine; the only tricky part was setting it up to use a different IP address than the Windows host; VMWare makes this pretty easy, although you have to remember where it is and when you have to do it.

    The minor tricky part: getting all the necessary Perl modules back. I didn’t want to mindlessly re-install everything I had before, since that might well contain some unused cruft built up over the last few months with Fedora 18. I settled for an incremental approach (wait for things to break, then fix them). I really should come up with a better method the next time around.

  • My home machine isn’t virtualized, but has a tricky disk partitioning scheme: I divided the disk into three parts, each holding boot and root partitions: current release, previous release, and the one before that. So pre-upgrade I had Fedora 16, 17, and 18. The upgrade reformatted and replaced the F16 partitions with 19. Again, the installer made this pretty easy. (As above: just pay attention to where it is and when you have to do it.)


Last Modified 2013-06-27 5:18 AM EDT

Pun Salad Makes Wikipedia; More Perl Geekiness

Not that I sit up nights and ponder my referrer logs, but I noticed an odd one today: the Wikipedia entry for songwriter P. F. Sloan. And sure enough:

Well, … sometimes. If you keep an eye on the subtitle under "Pun Salad" at the top of the page, you'll notice it changes from time to time. Specifically: the subtitle on the primary page at punsalad.com changes whenever the page changes; clicking permalinks or archive links generate pages on the fly, and they get a random subtitle.

The subtitle is picked via a standard Perl idiom that chooses a random line from a text file (here called subheads):

    open( F, "<subheads" ) || die "Can't open subheads: $!\n";
    while (<F>) {
	rand($.) < 1 && chomp( $subhead = $_ );
    }
    close(F);
After that bit of code, the $subhead variable contains the chosen random line.

There are (as I type) currently 46 possible subtitles, so you have about a 2% chance (1/46) of seeing the one referred to by Wikipedia:

… has been seeking P. F. Sloan, but no one knows where he has gone.

This is a reference to an old Jimmy Webb song, described in the Wikipedia article as a "catchy, bittersweet composition, which seems to be about the costs and disappointments of being a creative groundbreaker." Yeah, I guess; I just like the song (you can probably give it a listen here). Wikipedia also describes some weirdness associated with it:

While Sloan helped Webb get started on his career, it was because of a personal dispute with him that Webb denied the existence of "P.F. Sloan" when asked about the song's title character during an article interview, saying that he had made the name up. Ironically, this led Eugene Landy, the controversial psychologist, to lay claim to being the real P.F. Sloan when he was asked by reporters why he considered himself able to direct Beach Boys lead singer Brian Wilson's musical career. Landy claimed to have written the songs attributed to "P.F. Sloan", and this soon led to his losing his license.

P. F. Sloan wrote some pretty decent songs, but he also wrote "Eve of Destruction", a three minute and thirty-eight second demonstration of how stupidly self-righteous the 1960s were.


Last Modified 2012-10-08 7:57 PM EDT

Perl Date Geekery

Last August, Pun Salad moved from its UNH host (specifically, the workstation under my desk) to Arias Web Hosting. They've been great, and if you're looking for a provider that allows you a decent amount of control over your site, I can recommend them.

However, the server is (apparently) located out there in the great US/Central time zone. (At least that's what the shell command date +%Z claims.) And so the timestamps at the bottom of each post dutifully reported US/Central time.

But Pun Salad's heart and soul (and, arguably, brain) is almost always zoned on US/Eastern time. So the discrepancy has been something I've been meaning to fix.

The first whack was pretty easy. The script that generates Pun Salad is written in Perl, and Pun Salad's host is running Linux. And (it turns out) in that environment, you can tell Perl to imagine it's in a different time zone by setting the TZ environment variable at the top of your script:

    $ENV{'TZ'} = ':/usr/share/zoneinfo/US/Eastern';
Hey, that worked great!

But, there was still a minor problem, one which Pun Salad has had since its inception: the timestamps would show up as EST or EDT (or CST/CDT) depending on when you looked at them. (Specifically: when the script generating the page was run.)

Irritating! If I posted an article at 6pm EDT on July 15, it should always show up as being posted at 6pm EDT, even when viewed in EST-February.

This turned out to be surprisingly difficult using my Perl date manipulation package of choice, Date::Manip. Ordinarily, this package is awesome. And (to the author's great credit), the problem shows up prominently in the documentation, under "Known Bugs": "Date::Manip does not handle daylight saving time." Rats!

Fortunately, this is fixable using the standard Perl localtime and POSIX::strftime routines. Roughly, I replaced Date::Manip code that looked like:

    use Date::Manip;
    ...
    # given Linux timestamp $ts, generate human-readable date/time
    $date = UnixDate(ParseDate("epoch $ts"), "%Y-%m-%d %i:%M %p %Z");
with something like this:
    use POSIX qw/strftime/;
    ...
    # given Linux timestamp $ts, generate human-readable date/time
    $date = strftime("%Y-%m-%d %-I:%M %p %Z", localtime($ts));
Ahhhh, that's better. If you want to check out what I said last June on the hysteria about "speculators", you'll note that it was posted and modified on Eastern Daylight Time, which it was.

Now if only I could get decent Google ads. As I type, due to my stimulus-bashing over the past few weeks, they are titled "Obama Is Giving You Money", "$37,383 Stimulus Checks", "Your Stimulus Check", and "Free Stimulus Grants Kit". Google not only hates America, they also think you're pretty stupid. (But feel free to click away, if you'd like to be amused or disgusted, at the same time sending a few pennies this way.)


Last Modified 2012-10-08 7:55 PM EDT

Rotating GNOME Wallpaper in Fedora 10

We don't usually talk programming here on Pun Salad, but …

I wrote a small Perl script a number of years ago that would rotate the "wallpaper" background on my Linux boxes, changing it to the least-recently-used JPEG file in a directory collection I've maintained. I stuck the script in my crontab file to execute every hour, and—voila!—I was mildly entertained by the automatically-changing background of scenic vistas, cute animals, etc.

This stopped working when I upgraded to Fedora 10. And, eventually, I noticed: my background was stuck on the same picture throughout my login session.

Telling symptom: the script worked fine when I ran it from the command line, but it was not working out of crontab.

Explanation: In GNOME (Fedora's default desktop software), the actual background-changing work is performed by a program called gconftool-2; the latest version requires an environment variable (specifically, DBUS_SESSION_BUS_ADDRESS) to be set in order to affect the current session's configuration. This environment variable is automatically provided to programs run from the command line, but aren't normally available to programs run out of crontab.

So I had to add some lines to my script to dig out the value of this variable and make it avaiable to gconftool-2; fortunately, this article from the Srijith Unplugged blog showed a technique for making that happen in a Bash script that wasn't tough to translate to Perl.

More information and a pointer to my script is on my "Hacks" site here.


Last Modified 2012-10-08 8:25 PM EDT

Linearly Regressed Movie Watching

Although I know all the cool kids use Netflix, I've been a customer of Blockbuster Online for awhile. I have a hopelessly long queue, both movies and TV shows. I can, of course, move things up and down in the queue.

I started wondering if there was some way I could optimize the queue. All the movies have ratings at the Internet Movie Database (IMDB); most also have ratings at Rotten Tomatoes (RT).

Hm.

So I did the Statistics 101 thing, aided by some Perl web-crawling scripting and Gnuplot: a scatter plot for each movie in my queue that had both an IMDB rating and a RT rating. (click to embiggen):

bbq1

I've seen worse data! They look kind of correlated, so let's also put in the linear best-fit line:

bbq2

Looks almost like science! For anyone who knows what "correlation coefficient" means: it's 0.79 for this data.

Some miscellaneous observations:

  • The data should not be taken to represent anything general about IMDB and RT ratings. For example, I've either already seen, or decided I don't want to see, very high-rated movies. Similarly, there aren't a lot of dreadful movies in the queue. So the movies in the data aren't necessarily representative of movies in general

  • RT advertises their "Tomatometer" ratings prominently, but I used their fine-print "Average Rating" instead. The Tomatometer is (roughly) the fraction of critics who liked the movie; the Average Rating is more comparable to what IMDB does: each movie gets a score between 0-10.

  • Fun facts: although IMDB rates movies from 1-10, there are only two movies at IMDB with ratings greater than 9: The Shawshank Redemption and The Godfather. And there are only 38 movies with ratings under 2. I'm pretty sure the lowest-IMDB-rated movie I've ever watched is Epic Movie, which has a 2.2.

  • The movie up there in the northeast corner of the plot is The General, a silent Buster Keaton movie from 1927. It gets an 8.3 at IMDB and an 8.8 at RT. I'll move that up in the queue.

  • Down there in the southwest corner with IMDB ratings under 5.5 and RT ratings under 5.0: M. Night Shyamalan's The Happening; The Mummy: Tomb of the Dragon Emperor; and Balls of Fury (the ping-pong comedy with Christopher Walken). Maybe I shouldn't bother with those, at least not until I've seen every other better movie.

  • Somewhat interesting are the outliers: Eagle Eye was relatively despised by the critics (RT rating: 4.6) but the rankers at IMDB didn't think it was that bad, giving it a 6.8. (In the same boat: War, with Jason Stethem and Jet Li, 6.2 at IMDB, 3.9 at RT.)

    The other way around: the RT critics adored Sidekick, a direct-to-DVD underperformer (7.3 Average Rating, 100% on the Tomatometer). But the IMDBers were like, eh!, giving it a mediocre 5.7.

    Not sure what to do with those.


Last Modified 2012-10-09 8:20 AM EDT

Fedora 10 Impressions

Posting has been light the previous few days because of… Thanksgiving? No! Well, at least not that much. Instead, a lot of my time has been devoted to explorations of Fedora 10, a new version of the Linux distribution I use at home and work, released earlier this week. Some random notes:

  • I opted for fresh installs on unused disk partitions. Although an "upgrade" path is available, the docs say "In general, fresh installations are recommended over upgrades." And for once, I decided to go that way.

  • That's fine, although my old Fedora 9 systems had accumulated months worth of tweaks, addons, and customizations. And also some forgotten now-worthless experimental cruft. So: distinguish the "good stuff" from the cruft, and carefully fold it back into the familiar-yet-new system. Maybe come up with better ways to do things, like integration of my mail program (Mutt) with LDAP and a local address book. This is an ongoing process. Fortunately, to the certain sort of geek I am, it's also fun.

  • Booting the installation DVD still did not recognize the USB keyboard on my work system, a Dell Dimension E510. I was presented with a nice, attractive menu from which I could select… nothing. Fortunately, it had the default behavior I wanted, after waiting for a minute.

    (There's apparently a workaround if you're fast enough with your fingers before the GUI menu appears. I didn't really need it.)

  • It finally did the right thing with my Dimension's display chipset (ATI Technologies Inc RV516). This has been a major toothache with previous versions of Fedora.

  • But post-install, the system locked up twice, necessitating a finger on the power button. Both times after I had left for the day. Grrr, major inconvenience.

    Possible source of the problem: I had deleted the installed GNOME screensaver, and installed the superior 'xscreensaver' and associated packages. My speculation is that there was some weird incompatibility with the X video driver and one or more of the packaged screensavers, which triggered the lockup. After (regretfully) removing xscreensaver, and reinstalling GNOME screensaver, the system has remained up. Albeit with a lame screensaver.

  • In contrast, my home system (an older Dell Dimension 4500) installed with only one hitch: installing from multiple CDs, the system demanded Disk 2 be inserted, but refused to eject Disk 1. Arrgh. After some fumbling, the only solution was to shut down, resulting in an unbootable system. Fortunately, starting the install up again worked fine.

Bottom line: I can't recommend Fedora to non-geeks, but I like it.


Last Modified 2008-11-30 6:20 AM EST

Fedora 9

Pun Salad is now coming to you via a shiny-new upgrade to the Fedora 9 distribution of the Linux operating system. Notice the improved clarity of my prose, a new feature contained in the Apache 2.2.8 web server!

A semi-serious note: this machine's video uses an ATI chipset and the pain in the wazoo experienced in my initial Linux install was reintroduced post-upgrade: a less-than-native-resolution video screen. Don't buy ATI!

The issue was finally resolved by some blind hacking away at configuration files and installed drivers that I could not begin to reproduce in a million years. But all this caused some unusual downtime, so my apologies if this inconvenienced any readers.

Quote du Jour

2007-12-10

Geek God Larry Wall discusses the difference between programming and scripting:

Suppose you went back to Ada Lovelace and asked her the difference between a script and a program. She'd probably look at you funny, then say something like: Well, a script is what you give the actors, but a program is what you give the audience. That Ada was one sharp lady...