Sunday, July 21, 2013

LMDE

As long-threatened, I've finally followed the crowd and move from Ubuntu to Linux Mint. The main attraction was Mint's use of the MATE desktop, which is enough like Gnome 2 to keep me happy indefinitely, but I also liked the fact that the Debian edition, hereafter LMDE, is a rolling release, meaning I'm not going to have to do a complete upgrade in 6 months. The price is that some software is going to be a little behind the times, but, hey, at work we use CentOS. At least with LMDE it's unlikely that I won't be able to run Google Chrome or Chromium.

So a brief review:

Installation was simple enough. After several hours of backing up my /home partition (twice, to two separate USB disks), I downloaded the DVD and did the initial install. I left my /home and /usr/local directories, which were on separate partitions, intact, and let LMDE overwrite the root directory and install its version of Grub to run through the boot process. This took less than an hour, which was a pleasant surprise.

It then took me another couple of hours to pick out all the packages that weren't automatically installed, and get them up and running. Not too bad, really.

There were, of course, a few things that didn't quite work perfectly.

After a week, those are all the problems I've found. The system is stable, MATE is as good a Desktop as you're going to find these days, and I've had no difficulties in installing other software that I want.

This could be the beginning of a beautiful friendship.

Sunday, November 11, 2012

Ubuntu Grows Up

Meaning, if you do an update, you get an update, not a complete change of your desktop or default programs. I just upgraded to Ubuntu 12.10 (Quantal Quetzal). In the fifteen minutes since the reboot, I haven't notice any difference in the machine. The Gnome desktop survived intact, even the tweaks I did to make it look like Gnome 2. Thunderbird and Firefox are at the current version. So is Flash. The Intel Fortran compiler even works.

Boring. And that's a good thing.

My Linux blog posts are usually about problems, and we just haven't had that many lately. I'll have some spare time over Christmas, maybe (don't count on it), we'll get to the statistics and baseball stuff I owe you. Maybe.

Saturday, July 21, 2012

Updating to Precise Pangolin

I finally got around to updating Hal to Ubuntu 12.04, Precise Pangolin. (No, I never heard of it before, either.) You could have followed the whole thing on Twitter.

Good news: the only thing that broke was the color scheme on my panel bars, which changed to black text on black background. I fixed that right away, and I'm still running a pseudo-Gnome2 desktop.

So, I'm happy with it. Besides, this is an LTS release, so if I don't want to bother updating I can keep it for a couple of years.

Just a bit later: OK, one bug. For some reason the permissions on the directory

$HOME/.config/nautilus-actions

had been reset to 555, meaning I could read or execute files in the directory, but not write to it. This meant that backintime wouldn't back up my disk. Fortunately, backintime has an excellent error log, available from inside the program, that told me what was going on. (Unlike Google-Earth, which is still failing to launch in 64-bit mode after all these years.) I just ran the command:

chmod 755 $HOME.config/nautilus-actions

and all was well.

Sunday, May 20, 2012

Insert Joel and Ethan Coen Reference Here

So in today's paper there's an Office Depot ad for a Brother HL 2240 Monochrome Laser Printer for $69.95. We really need a BW printer, and Laser is obviously the way to go to keep the price per page down. The thing got decent user reviews on Amazon, as long as you remember:

  • It's Cheap.
  • It's USB.
  • You have to replace the drum at 14,000 pages (like we'll get to that any time soon).
  • The initial cartridge only lasts for 700 pages (though you can apparently fool the printer into printing more)
  • It's cheap.

So I went out and bought the thing — the closest thing to an impulse electronics buy since I got that $20 Canon Printer/Scanner when I was at Duke. (The scanner still works, the paper feed mechanism for the printer is broken.)

I read all of the installation instructions, plugged the thing in, printed the test page, got the USB cable from the $20 printer and used it to connect the printer with Hal, and turned on the printer. Ubuntu's auto print installer came up, recognized the printer, and …

Wouldn't you know it, CUPS doesn't have a driver for the Brother HL2240. (Obviously I didn't do a lot of research.)

No problem, Brother provides proprietary drivers for the printer. (Forgive me, St. Richard.)

It's not a difficult process. Go to Brother site, and download the .deb packages for the HL-2240:
LPR Driver (hl2240lpr-2.1.0-1.i386.deb) and
CUPS wrapper drive (cupswrapperHL2240-2.0.4-2.i386.deb).

Install both drivers, in order:

sudo dpkg -i --force-all hl2240lpr-2.1.0-1.i386.deb
sudo dpkg -i --force-all cupswrapperHL2240-2.0.4-2.i386.deb

At some point during this you'll get a message that the Brother printer has been found, and if you click on System Settings (under your name in the upper right of your screen), followed by Printers, and then Brother HL2240, you'll be able to print out the test page.

It works fine. Except …

I also want to be able to access the printer from Harlie, the machine upstairs. I previously alluded to doing this before (see rants, uh, points, 35 and 36), but that was with native CUPS drivers. I'll provide a bit more detail this time. Remember that the printer is installed on Hal, and we want Harlie to be able to use it.

So on Hal:

  • Open up a browser and go to http://localhost:631/.
  • Click on the Administration tab.
  • Under Server on the right, click the box that says Share printers connected to this system, and then click Change Settings.

Go upstairs to Harlie:

  • Install those same Brother Printer Drivers. You'll get some message about a printer being found. Ignore it.
  • Open up a browser and go to http://localhost:631/.
  • Click on Administration and Add Printer.
  • You should see a box which says something like
    Brother HL2240 BW Laser @ harlie (Brother HL2240 series)
    Click its radio button and then click Continue.
  • Fill in the information you want to use to identify the printer. Click Share this printer if you want others to be able to use it from Harlie. Again click Continue.
  • Now for the trick. The next screen will ask you for the location of the CUPS driver. It won't be in the list, since it's proprietary, but after a bit of searching, I found it. Where it says Or Provide PPD File: click Choose File, and search until you find the file
    /usr/share/ppd/HL2240.ppd
    Choose this, then Add Printer.
  • If the Force is With You, your printer will now be installed.

Note that you can use CUPS to change the behavior of your printer. For example, if you go to Administration, click on Manage Printers, and click the name of your printer, you'll see a page that has two pull-down boxes, one labeled Maintenance and the other Administration. Click on the Admin box and you'll see a bunch of things you can do. In particular, under Set Default Options you can choose your paper size, print resolution, ink toner usage, etc.

Saturday, January 07, 2012

Joining a Group

In an effort to make Ubuntu less scary to users (i.e., more Mac/Windows like), Ubuntu 11.10 removed some graphical system administration utilities that were previously available. One of those was a called Users and Groups, which let you see groups and make changes to group memberships.

The new Ubuntu would rather you just forget groups, so it includes no graphical tools for handling them. Fortunately it's still Linux, so you can fix it up yourself. Liberian Geek has details, but the first hint (using groupmod) didn't work for me, so here's my modified version. In this example, I want to add myself to the group vboxusers, which should allow me to get USB access for my Virtualbox installation. More on that some other time. For now, return with us to those thrilling days of yesteryear, before the GUI:

  1. Look at the file /etc/group. Specifically, we want to see who belongs to the group vboxusers:
    $ grep vboxusers /etc/group
    vboxusers:x:125:
    
    Nobody, as we expected.
  2. Now to follow the Geek and add myself:
    sudo usermod -a -G vboxusers rchawk
    
  3. Finally, confirm the addition
    $ grep vboxusers /etc/group
    vboxusers:x:125:rcjhawk
    

You'll need to log out and log back in before the system will recognize the new group setting.

Thursday, December 29, 2011

Installation Notes and Rants for Ubuntu 11.10

A few weeks ago I updated Hal to Ubuntu 11.10 (Oneiric Ocelot). This was relatively easy because Hal was already at 11.04, allowing me to do a distribution update from the update manager. Our other Linux box, harlie, was running Ubuntu 10.10, so that option wasn't available unless I updated first to 11.04 and then to 11.10. Instead, I downloaded 11.10 to a CD, and did an install more or less for scratch.

Now, mind you, the Ocelot has what are supposedly a lot of nifty features, including the not-quite-Mac-like-enough-to-be-sued (you might want to ask Google about that) Unity desktop interface. And, if you don't like Unity, you can get Gnome 3! I didn't really want any of that. What I wanted was a machine that had all the modern software but looked and acted exactly like the old Ubuntu. I didn't quite get that, but I came pretty close.

BUT: This release of Ubuntu sets computing back at least 10 years. In the effort to make everything super friendly, they have dumbed down the user interface so much that you MUST use the command line to make even the simplest changes: For example, up through 11.04 you could easily change theme colors through a GUI widget. This is an appropriate use of the GUI, you can see what the current colors are, select the colors you want, and if they aren't right you can fix them right then and there. But now, guess what? THE ONLY WAY TO CHANGE THEME COLORS IS TO EDIT A FRAKIN' TEXT FILE. AS THE SUPERUSER! (I only shout because I'm mad.) This is (pick one):

  • Dumb
  • Dumber
  • So stupidly idiotic that one expects that there must be a malevolent being doing this, someone who wants everyone to throw up their hands in exasperation and switch to OS X. Or worse, Windows 8.

And this kind of idiocy exists all over the place: Things that were easy to do before are now hidden. Usually you have to edit a text file that hasn't appreciably changed since 1999. OK, I can do that, but until last month I didn't have to. Hence my frustration.

The worst of it is, this isn't just Ubuntu, a lot of the changes are driven by Gnome 3. It's enough to drive one back to the ugliness that is FVWM, where at least you know you have to edit menus going in.

But not just yet. Click below to see how I overcame the obstacles, at least so far.

Friday, November 25, 2011

I For One, Welcome Our New Canonical Overlords

I've just updated Hal to Ubuntu 11.10, Oneiric Ocelot.

I don't regret it — quite. It is however, going to take a long time to get it to where I want it to be, e.g., something that looks like my old Gnome 2 desktop.

Why not just change to a distribution that still uses Gnome 2? Because Gnome 2 is going away. openSUSE 12.1 is out now, and it uses Gnome 3. Fedora uses Gnome 3. You see where this is going.

So this post, and probably many more, will be rough notes on how to make Hal's desktop look like it did before. I'm not going to go cursing Mark Shuttleworth. (I've learned from the last ten years of cursing Dan Snyder — it just doesn't work.) Ubuntu is, for now, a useable distribution, and I can, eventually, tweak everything to get to where I want to go. That's the beauty of Linux.

Besides, it makes for a lot more blog posts.

Hal, I should point out, is just fine. He can still do fancy LAPW electronic structure calculations faster than the Cray XMP of my youth, and he still reads my email and browses the web with aplomb. He can still develop code with Emacs. He just doesn't look very good right now, but we're dealing with that.

Eventually I'm going to update the spouse's computer, Harlie. When I do that I hope to do one of those step-by-step guides, which will be more coherent. But for now, think of this as a set of Google Notebook entries. Oh, wait, Google pulled the plug on that and is now moving all my files to Google Docs.

Oh, well, let's just get on with it.

Oneiric comes with the brand-spanking new Unity desktop, which, as I said once before, is so like Mac OS X that it comes with a lawyer to deflect lawsuits from Cupertino.

I was wrong — it's worse than Mac OS.

Like OS X, Oneiric comes with a dock, or maybe it's called a Launcher. On the Mac the dock can be moved, it can change size, it can automatically hide if you don't want it on the screen, and it's quite easy to drag applications over to it. In Oneiric the dock is fixed on the left, you can't change its size, it only hides itself when a window pushes it away. You can drag applications onto the dock, but it seems harder, somehow, than on the Mac — that's my subjective point of view, of course.

So I quickly changed over to Gnome 3.2. Well, not quickly, because Gnome isn't installed in Oneiric. And since my 11.04 distribution used Gnome 2, the upgrade process ripped out all of that software as well. So one must install all things Gnome. I used to do this with Synaptic, but, guess what, Synaptic isn't installed either.

So first open up a terminal window. Can't find a terminal? Click on the Dash Home icon at the top of the dock, click More Apps, click to show all of the installed apps, scroll down and find the terminal, and click it. (First you might want to drag the icon over to the dock, for later use.)

With the terminal finally open, you can install Synaptic by typing

sudo apt-get install synaptic

You could then find synaptic in the Dash Home menu, but it's easier to just say:

sudo /usr/sbin/synaptic

and go from there.

Once in synaptic, search for Gnome and install it. You'll probably want to install some Gnome themes, etc. While you're there, also install the Gnome Tweak Tool as well.

Then log out. When the login screen appears, click on the little gear by your name and select Gnome Classic (no effects) or whatever other version of Gnome you desire.

It's OK to throw up your hands and go off to figure out Unity at this point. Really.

Because when you log in, you'll see something that looks only vaguely like your old Gnome desktop, sort of like the difference between Darrel Hammond and Bill Clinton. There's a menu on the top, but it only says Applications and Places. And the clock seems to be stuck to the middle of the upper panel, neither movable nor removable. Also the Theme will be hideous. You can fix that, sort of. Click Applications/Other/Advanced Settings, (that's the Gnome Tweak Tool), click Theme in the box that pops up, and play with the Window Theme and the GTK+ Theme until you get something you like. One of my missions is to figure out how to edit the theme colors, to create what used to be called a Custom Theme. No luck, so far, but if I find it I'll let you know.

You should have two toolbars, one at the top and one at the bottom of your window. You add things to these bars, change their properties, etc., as before, but instead of just right-clicking on the bar, you have to hold down the Alt key and right-click. That's easy enough.

You'll also have to search for some of your options. The old Gnome menu used to have a Preference section and an Administrative section. Those functions are now hidden in the Applications menu, under Other and System Settings, apparently with neither rhyme nor reason. Play around with that until you're comfortable in finding things.

Finally, for now, go to Things to Tweak After Installing Oneiric Ocelot 11.10, and see what's useful there. And don't forget 10 things to do after installing Ubuntu 11.10.

More as I find more stuff.

Monday, May 30, 2011

The Natty Narwhal Upgrade

Like Travis McGee, this week I'm taking an installment of my retirement. Unlike McGee, my retirement seems to consist of fixing up computers.

So today, Ladies and Gentlemen, Boys and Girls, Desktops and Netbooks, we're going to talk about upgrading Hal here to Ubuntu 11.04.

Yawn. This shouldn't really be that big a deal, should it? You just hit the update button, or type do-release-upgrade at the command line, right?

Well, it's not always that simple. A friend of mine did that, and he seemed to have a lot of problems. I'm not sure why, as I never got to examine his system before he reinstalled 10.10. Maybe it was the change from the Xorg window system and Gnome desktop to Wayland and the Unity desktop. Or not. Maybe it was just the way the wind was blowing that day. But I decided not to take the chance on the upgrade, but rather install 11.04 from the ground up.

I didn't have to be pushed hard, because I was leaning toward a clean install anyway. When I bought this version of Hal I was in a hurry to get Linux set up, but wanted to keep Windows 7 around. As a result, I let Ubuntu do the repartitioning of the disk, and ended up with the entire Linux system in one giant partition.

This is less than optimal. (Thanks, Dave. Don't mention it, Hal.) Ideally one wants /home and possibly /usr/local and /opt in partitions separate from the root operating system. That way when you upgrade the OS, you don't lose your previous data. (That doesn't mean you shouldn't back up that data before upgrading. There's a word for people who don't. The polite form of it is idiot)

But this requires repartitioning Hal's disk. Fortunately, all of Hal's memories reside in the extended partition, so I don't have to fiddle with the Windows partition. After about 30 secons of thought, I decided to repartition Hal's big Linux partition into 15GB for /, the root system, another 15GB for /usr/local, /opt, and /scratch (more on how to do this later), and leave the rest for /home. That's probably too much for /, and maybe not enough for /scratch, depending on what I right there, but that's how I'm going to do it this go-round. Ideally gparted would leave the data on /home as is, but that takes forever because of all the data that needs to be moved around, so we're just going to repartition everything and hope the backup holds.

Preparation

First, get the software we'll need. I downloaded and burned CDs for the 64-bit versions of:

OK, Gparted is obvious: that's what's going to do the disk repartitioning. But why the alternative distributions?

Because you never know. The largely hypothetical long-time reader will remember that I used to use Fedora, but that I switched to Ubuntu when the installation of Fedora 5 failed miserably, and Ubuntu was there, ready and waiting. So having alternative Linux CDs on hand seems to be a really good idea. Besides, we bought 100 CDs maybe five years ago and still have a bunch left. They just aren't used much anymore. (That's right, rcjhawk is still a trailing indicator for device popularity.)

OK, we've got hopefully every bit of software that we need, so let's go.

Find out what's on your machine

I never remember which packages are installed from one upgrade to the next. So let's make a list:

dpkg --get-selections > installed.txt

Edit installed.txt, leaving out any packages you think will be installed by the system (e.g., kernel, window manager, etc.). If you can't remember what a package does, delete it too. If you need it, it will eventually show up as a dependency to a package you want, or you can reinstall with apt-get or synaptic. The important thing to do here is to remove cruft from the system. For example, I have the bsd-games package on here. I never play those games, so why leave them in place?

It would have been nice to make a copy of /etc/fstab, but some dingbat forgot to do that (more on this later).

Back it all up

Well, not everything. No need to back up the kernel, or Emacs, or latex, or any of that. The distribution will provide. No, I want to back up my data (basically $HOME), the Intel Fortran compiler, a royal pain to install, and my renegade version of SoX. So do the following (/backup is my ext4 formatted USB disk):

$ cd
# -rpv == recurse directories,
#  preserve permissions and timestamps,
#  and speak up about it verbosely.
$ cp -rpv dave /backup
# Assuming you're named dave, of course
$ cd /usr
$ cp -rpv local /backup
$ cd /
$ cp -rpv opt /backup

To be safe, I also had backintime, my backup manager, do an additional labeled backup, which should keep it on the disk forever and a day, or at least until the end of 2012.

Repartition

The next step is the scariest one. I've taken what was an 800+GB partition and broken it up into three parts: 15GB for /, 15GB for what will be /usr/local, /opt and /scratch, and the remainder for /home. It's scary because this wipes out the primary data, so you are now relying on the kindness of backups. It's theoretically possible to gave gparted to keep all the data in what's going to be the /home partition, but that requires moving a lot of stuff around, at least the way I tried it, and an estimated 18 hours to get it done. So I just said a prayer, bit my lip, and reformatted. Fortunately it all went well.

Installation

Not much to say here. I told Ubuntu that I wanted to do an install with a custom installation, had it mount everything where I wanted it, and let it go. The usual waiting around occurred.

Copying Files

This was rather easy: turn on the backup USB disk drive, and copy the files back. I copied back configuration files I knew I wanted to keep, e.g. things like .emacs and the .devilspie directory, but I'm letting Ubuntu set up the desktop. This means I'll have to play with preferences later, but it should get eliminate any conflicts between old and new configuration parameters.

Mounting the Backup Drive

I could just plug the backup drive in and access it at /media/really_long_hexadecimal_string, but what I really want to do is have the backup drive mounted to /backup. I've covered this before, but as I mentioned above, I forgot the UUID of the drive. You get that with the command:

blkid

which gives you all the UUID of all connected disks.

Restoring /usr/local and /opt

This is awkward. Add-on programs that you compile yourself generally go into /usr/local. Other programs, such as the Intel Fortran compiler and Google's Picasa, end up in /opt. I want both to stick around between upgrades, so they need to be out of the / partition. But I don't want two extra partitions. So here's what I did:

  • Create a partition /usr/local
  • Create a directory /usr/local/opt
  • Copy all of the /usr/local files where they belong.
  • Copy all of the /opt files to /usr/local/opt
  • Then, as root, run the command
    ln -s /usr/local/opt /opt
  • If you want a /scratch directory, do the same thing, but don't forget to make the original world writable:
    # mkdir /usr/local/scratch
    # chmod 777 /usr/local/scratch
    # ln -s /usr/local/scratch /scratch
    

Restoring your add-on packages.

Now we want to get back all of our old packages, the ones that aren't installed by default, at least so far as Ubuntu will let us. Remember that file installed.txt I mentioned you should create and edit? Here's how we'll use it:

  • Select System => Administration => Update Manager
  • Click on Settings in the lower left corner
  • Under Ubuntu Software make sure all of the sources you want enabled are. If you don't want proprietary drives, etc., turn them off. Do the same under Other Software
  • Open a terminal window and go the the directory where you have that installed.txt
  • Run the following commands:
    sudo apt-get update
    sudo apt-get install `awk '{print $1}' installed.txt | xargs`
    
  • You'll probably get some error messages, but they're pretty clear about what you need to fix. Edit the installed.txt file to match.
  • This will take a while, as all the packages have to be downloaded from the net.

What Works

Pretty much everything. I selected Gnome-classic for my desktop, and after a little fiddling to with System => Preferences => Startup Applications got the system to look pretty much as it did before.

As for third party software, the Intel Fortran compiler still works fine. I was able to reinstall Picasa from Google's supplied 64-bit .deb.

Wayland seems to work just like Xorg, at least from my point of view. It pops up windows in the same way as before, and I can run, say
ssh -X majel
to get me to another machine, and then run
firefox
on majel, and the window pops up here on Hal. So no major problems for me there.

What doesn't work

Google Earth. Maybe this is a 64-bit problem, I don't know. I tried using Google's .deb file, and the official Ubuntu method. Neither worked.

By default Ubuntu installs the 3-D version of Unity, which requires a pretty good graphics accelerator. Hal lives in 2-d, so that wouldn't run. (Funny, the Unity desktop shows up when you run the live CD.) I installed the 2-D version and that works. Which brings me to

What Sucks

Unity. From my limited experience (about two minutes, after which I ran away screaming), it's an overblown and somewhat hideous version and of the Mac desktop. But don't mind me, I was the last person on Earth to use fvwm. I suppose if I played around awhile I could make Unity behave the way I wanted it to, but why bother, since Ubuntu still supplies the classic Gnome desktop. Mind you, I've seen Gnome 3, and I don't like that, either. (The word you're looking for is Luddite.)

Summary

All in all, a successful update, as long as I stay way from Unity. I have one more computer that needs updating to 11.4, I think I'll just try that as a distribution update. If it doesn't work, I can always do a full install.

More Later

Troubles will surface, they always do. When they do, I'll write about them here.

Saturday, November 27, 2010

Finding Your Header Files — A Better Way

I should really read my own posts. Especially since that's the original purpose of this blog.

The other day I was looking through old posts with the Ubuntu label, and found this comparison of dpkg/apt-get and rpm/yum commands. The relevant one is

dpkg -l '*'

which lists all of the packages available in your repository, installed or not.

Duh

This makes my header file lister a lot simpler to write, towit:

#! /bin/bash

# First make sure you've got all your repositories updated:
sudo apt-get update

# Now search through every repository database, looking for lines that
#  start with "Package", and end with "-dev".
# Pull out the package name, look through each package, and print out
#  the header files:  those that end in "-h"

# No matter how it wraps on your screen, this next line starts with
# "for" and ends with "awk '{print $2}'`"

for hfile in `dpkg -l '*' | grep dev | awk '{print $2}'`
do
# echo $hfile
apt-file list $hfile | grep "\.h$"
done

It's still going to take a long time to go through every package, but it's a lot neater now.

Monday, November 08, 2010

Find Every Header File in Your Ubuntu Repositories

Last night I was following a thread on Penguin Pete's blog where Pete uses Ubuntu's dropping the Dillo browser from the distribution as a launching pad for a discussion about — heck, I can't describe what it's about, read it yourself.

Anyway, in the course of reading the discussion — if that's the word, Pete gets worked up about certain things — I was possessed by the moral imperative to install Dillo from source.

This would seem to be straightforward. You go to the Dillo home page, click Download, and follow the instructions.

Except (there's always an except) — the first install you have to make is the FLTK2 (Fast Light Toolkit) library.

Now Ubuntu offers FLTK1.1, which might well work, but hey, we need the latest and the greatest, right? So I downloaded the tarball, followed the instructions, and the make command crashed and burned with:

fatal error: X11/extensions/XInput.h

I looked on the web, found that XInput.h is in the package libxi-dev, installed that, reran make,

fatal error: GL/glu.h

and so on. It took about an hour to find every single header file needed. And that was just to install FLTK2, after which I still had to install Dillo.

So what's going on here? Well, first we have to know what a header file is. Basically, it's a file that defines a bunch of variables and statements that can be used by multiple routines. See Wikipedia for a better explanation. In particular, header files tell a program's source code what variables are used in a particular library. Thus the header XInput.h defines variables available in some X11 libraries.

OK, suppose I'm compiling a program and I find that I need a header file GrantsTomb/Buried.h. All I have to do is find the package that has that header, install it with apt-get, and I'm good to go. Right?

Well, without prior knowledge you're pretty much doomed here. I was able to find XInput.h and glu.h by web search, but who's going to tell you where is Buried.h in GrantsTomb?

Yet there has to be a solution, because:

  • I know that when I use synaptic or aptitude to install packages I can see every package that is, or can be, installed on my system from my selected repositories.
  • After searching around a bit, I find that apt and its children list the available files in /var/lib/apt/lists, each repository has its own file, and each file name is on a line starting with Package.
  • I know about the program apt-file, in particular that the command
    apt-file list foobar
    will give me a list of all of the files in the foobar package.
  • Header files are traditionally located in packages ending with the string -dev.

Given all of that, I should be able to write a script which will list every header file available in every Repository I've accessed. I can then save it in a file, and the next time a program says I need bojangles/tambourine.h I can just search the list, find that the header file is in the NittyGritty-dev package, load that up, and I'm ready to compile:

  • First, install apt-file, if you don't have it already:
    sudo apt-get install apt-file
  • Then run this script:
    #! /bin/bash
    
    # First make sure you've got all your repositories updated:
    sudo apt-get update
    
    # Next sync apt-file's database.  Note that if you do this without
    #  the sudo you'll write the data into your home directory, which is
    #  probably OK
    
    sudo apt-file update
    
    # Now search through every repository database, looking for lines that
    #  start with "Package", and end with "-dev".
    # Pull out the package name, look through each package, and print out
    #  the header files:  those that end in "-h"
    
    #! /bin/bash
    
    # No matter how it wraps on your screen, this next line starts with
    # "for" and ends with "xargs`"
    
    for hfile in `find /var/lib/apt/lists -type f -exec grep '^Package: ' {} ';' | awk '{print $2}' | grep -e '-dev' | xargs`
    do
    apt-file list $hfile | grep "\.h$"
    done
    

Be warned, this takes a long time, since every call to apt-file goes out over the network. On my system, with FIOS broadband, it took over an hour. So you'll only want to run this file once in a while, probably only when you update your repository list. You may also get an error message like
grep: /var/lib/apt/lists/lock: Permission denied
Don't worry about that.

This script should work pretty well for Debian. There are also equivalent commands for RPM-based distributions. And, of course, you can modify it to list any subset of files in any subset of repositories you want. I'll leave all of that as an exercise for the reader.

Friday, September 24, 2010

Ubuntu and Flash

I've been running the 64-bit version of Ubuntu 10.04 for about five months, and have had few problems. Most of them you've heard about. Lately, though, I've had a major problem — Ubuntu's unbranded version of Google Chrome, aka chromium-browser, wouldn't run Flash.

If I tried to visit a flash site, I'd get something like this:

Annoying.

The apparent cause is a corrupted profile. Exactly what's corrupted, I couldn't say. Basically, to get Flash running again you need to wipe out all traces of chromium and start over. I did this, but I wanted to at least save my bookmarks. Here's how. Open a terminal and type in everything to the left of the # signs:

cd # Go to your home directory
mv .config/chromium chromium_old # save your old configuration, at least for now
chromium-browser # start the browser up.  Exit immediately.
cp chromium_old/Default/Bookmarks* .config/chromium/Default # restore you old bookmarks
chromium-browser # surf normally.

Of course, you've lost all your saved passwords, surfing history, etc. Think of it as a way of weeding out the chaff. A project, for someone who has the interest and time, would be to go through each file in the old profile and determine which one got corrupted. If you do that, feel free to let us know what you find.

Thursday, July 29, 2010

Updating the un-updatable

In my post on the relative easy of updating Linux I used Ubuntu's graphical Update Manager to do the work.

Of course, in Linux/Unix you can always do this from the command line. In Debian based systems the relative commands are:

sudo apt-get update
sudo apt-get upgrade

The first line compares the packages available online with those installed on your machine, and the second line upgrades the packages that aren't current. Easy, huh?

Except that sometimes you get messages like this:

The following packages have been kept back:
  linux-generic linux-headers-generic linux-image-generic

This is more or less a are you sure you want to do this now? message. You'll note that the kernel is involved here, so you're going to have to reboot the machine once the packages are installed.

All right, I'll reboot, so what do I have to do? Well, it turns out the the packages can be explicitly installed:

sudo apt-get install linux-generic linux-headers-generic linux-image-generic

This will take care of everything. Just remember to reboot the computer to get the new kernel up and running.

Sunday, May 30, 2010

Return With Us Now to the Thrilling Days of Yesteryear

I'm not very good at doing disk backups.

OK, let's be honest: I'm terrible at doing disk backups. Oh, back in the day, every once in a while I'd copy as much of the disk as I could onto CDs or DVDs. But that takes a lot of time, and, as disks become larger while DVDs don't, requires a lot of picking and choosing to figure out what goes where.

To be fair, I haven't needed to. In all the years I've run computers here at home, I've never had a disk crash that lost data, even after our most serious disk mishap. So not having a backup hasn't been that big a problem. (Insert your favorite ominous foreboding music here.) Anyway, backups are a pain in the neck.

My view of backups has changed, though, primarily because they're so much easier now. Easiest, of course, is Apple's Time Machine. Plug a second disk (USB, Firewire, internal, if you've got such a thing) into your Mac, let it format to Apple's HFS format (or not), and start Time Machine. Tell it which directories you want to back up, and it will do that, every few minutes. Then you can actually scroll back through time (Tardis sounds not included) and pick out a file you might have deleted a year ago — assuming you were running Time Machine back then. It's an extremely neat and easy-to-use utility, and takes the pain out of doing backups, as long as you remember to leave the external disk plugged in, if that's what you've got.

Then, last week, Office Depot ran a sale where you could get a Terabyte Verbatim USB disk for $79.99 + tax. I bought three, one for Hal, one each for the college students.

Now the disk comes with Nero backup software for Windows (taking care of student I), and Apple's got Time Machine (taking care of student II). But what about poor Hal, stuck in Linux?

I called up the Synaptic package manager and typed backup in the search box. That brought up, among other things, a package called backintime, which is a front-end which uses the utilities cron (to schedule backups), diff (to find which files are changed), and rsync (to copy files that have changed to the backup disk). Perfect. I installed the program — actually both backintime-common, the guts, and backintime-gnome, the graphical front end, then went to get the disk.

Problem: Verbatim formatted the disk to the lowest common denominator, FAT32. This is not suitable for low-volume backups, because it does not allow multiple hard links to the same file. What backintime does, you see, is create a copy of your chosen disk directories every time you schedule a backup. The trick is that unchanged files are hard-linked from one backup to the next, taking a minimum of space. Only the changed files are stored in multiple copies. Since the FAT format doesn't do multiple hard links, it can't do the trick, and so we need to reformat the disk to a better file system.

So I installed gparted from Synaptic, launched it (using sudo gparted), and formatted the Verbatim disk to ext3 format.

Second problem: If you just plug a USB disk into a Ubuntu box, it auto-mounts, but is usually only accessible to the user who did the mounting (to be fair, I haven't tried this with a USB ext3 disk). That's unacceptable in a backup system that needs to be accessible to everyone. So we have to set up /etc/fstab. To reflect this. Ideally, we'd add a line which looks something like this:

/dev/sdd /backup ext3 errors=remount-ro 0 2

(Note added after the fact: The last entry on this line should indeed be a 2, not a 1 as previously listed. This this tells fsck to check this file system after any file system with a 1 in the last column. The only file system with 1 there should be the boot partition. Everything else can be a 2, unless you don't want fsck to look at the file, in which case you put in a 0. Got that?)

create a directory entry /backup, and then doing

mount /backup

would load up the disk drive.

However, since you usually have multiple USB ports on your system, there's no guarantee that this disk is going to always get /dev/sdd as its port. The solution is to use the ext3's UUID, which was created when gparted did its thing. You find the UUID with the command:

sudo blkid
[sudo] password for hal:************
/dev/sda1: LABEL="PQSERVICE" UUID="0A72323D72322DB7" TYPE="ntfs" 
/dev/sda2: LABEL="SYSTEM RESERVED" UUID="CCA811C2A811AC48" TYPE="ntfs" 
/dev/sda3: LABEL="Gateway" UUID="7E143E7F143E3A8B" TYPE="ntfs" 
/dev/sda5: UUID="2eec3fff-73d2-419c-8a3c-b92733d46da2" TYPE="swap" 
/dev/sda6: UUID="f3781533-d891-46e1-b9f0-839e8a538d35" TYPE="ext4" 
/dev/sdb1: LABEL="Verbatim" UUID="9deee42d-539b-45c5-8683-e95f889c1792" TYPE="ext3"

Verbtim is how I labeled the disk partition of the USB drive, so that's the UUID we want. Fill out the line in /etc/fstab as:

UUID=9deee42d-539b-45c5-8683-e95f889c1792 /backup ext3 errors=remount-ro 0 1

and we're ready to go. Note that this will automount so that everyone can read it every time the disk drive is plugged in and turned on.

That settled, setting up backintime is easy. You can specify the directories you want to back up, and the file types (say, those ending in ~ or .o) and directories you want to exclude. You can then select a backup time interval: minutes, hours, days, weeks ... Once you have a set of backups, you can use the graphical interface to look through your files of any snapshot, and restore a file that was deleted or moved on your main system, or copy it to another location if you like. It's very nice and easy to use.

You can see your backup schedule using crontab:

crontab -l
@daily nice -n 19 /usr/bin/backintime --backup-job >/dev/null 2>&1

Note the @daily there. That means the backup will start every night at midnight, and it's the only choice backintime gives you if you select a daily backup. This is unsatisfactory for me, as someone is frequently using the computer on and after midnight. So I used crontab -e to edit this entry, changing it to
0 3 * * * nice -n 19 /usr/bin/backintime --backup-job >/dev/null 2>&1
which launches the backup at 3am. backintime accepts this, but note that every time you change your setup it will reset the time to @daily. Just watch it.

Anyway, now I have a disk backup. And since I've never had a major loss of disk data from one disk, having two disks copying the data should mean that it can never, ever, ever happen, right? (Insert even more ominous and foreboding musing here.)

Saturday, May 29, 2010

Rob Pegoraro Talks About Ubuntu

The Washington Post's tech columnist reviews Ubuntu 10.04 in his Sunday column and adds more comments in his blog.

I love the first line:

No Windows viruses. Free. Any questions?

Friday, May 28, 2010

hosts.deny

Ubuntu, and most Linuxes, by default come with an empty /etc/hosts.deny file. I'd argue that by default it really should look like this:

$ cat /etc/hosts.deny
ALL: ALL

Because:

  • If you don't know what how the /etc/hosts system works, you shouldn't allow others to access your machine.
  • If you do know how it works, then you know enough to edit the files to do what you want.

Comments?

Monday, May 24, 2010

Ubuntu 10.04: Things I Forgot

Things I forgot when I was listing my useful programs from Ubuntu 10.04:

  • The gimp: Manipulate images just about anyway you want, without paying Photoshop prices. For example, you can make transparent PNG images.
  • xsane: Scan documents (scanner not included).
  • chromium: the unbranded version of Google Chrome. This is my current browser of choice, and I forgot to list it before because it was the very first thing I installed. Note that it's available in the repository. If you want the branded version, you can get a .deb file directly from Google's site.
    For some reason, Ubuntu only distributes the unbranded version of chromium, but it offers, by default, the branded Firefox browser and an unbranded version, which it calls abrowser.

I'm sure there are more to come, I'll either add them here or start another post. Stay tuned.

Sunday, May 23, 2010

Ubuntu 10.04: Update Notification Icon

One thing that doesn't seem to be present in Ubuntu 10.04 is the little notification icon that shows up on your panel when the update manager has found programs to install. If there is some notification I haven't seen it.

Apparently this has been going on since 9.04, but for that version of Ubuntu I was running IceWM rather than Gnome as my window manager and so missed it. But Watching the Net didn't, and shows the way to restore the Update Icon by turning off the update notifier, whatever that is.

Apparently once the new improved update notifier (which I've never seen in action) is turned off the old style notifier kicks in. This is in the province of gconf, that all-seeing, all-knowing application that tells other programs what your likes, wants, and needs are — sort of like Facebook.

So to turn off the new-improved version and go back to the thing that works, open a terminal window and type (or cut and paste):
gconftool -s --type bool /apps/update-notifier/auto_launch false

Alternatively, launch gconf-editor, click on the + sign next to apps, scroll down to find update-notifier, click on that, and then uncheck the box that says auto_launch.

Either way, you're done, and the old icon will come up the next time you have an update available.

Saturday, May 22, 2010

Ubuntu 10.04: Installing the 64-bit Intel Fortran Compiler

OK, let's get take care of this right up front: Warning: This page discusses the installation of free-as-in-beer, but not free-as-in-speech, software. If you want to keep such software off your system, then don't install this compiler. Also note that the license is pretty restrictive, i.e. Non-commercial means you are not getting compensated in any form for the products and services you develop using these Intel® Software Development Products. However, the installation process should work for the commercial version of this compiler.

I first learned to program in Fortran. I still have my original WATFOR/WATFIV textbook, though I later graduated to Fortran 77 and occasionally write some Fortran 90. I still do a lot of things in Fortran 77, just because I'm comfortable writing code starting in column 7.

Now there is an open-source Fortran 77/90/95 compiler, gfortran. It's reasonably fast, portable, nice — did I mention free? But it has a few quirks. For example, one of my old codes has a subroutine second which measures elapsed time. gfortran assumes that I'm calling the intrinsic function second, and bombs the compile because I don't have a proper calling statement. So I have to go in and declare

      external second

in every subroutine that calls my second.

But Intel makes its Linux Fortran compiler free-as-in-beer for non-commercial development. And the 64-bit version of the code includes Intel's optimized Math Kernel Library (MKL). It's a fairly simple registration, and you don't sign over much of your soul. However, in Ubuntu it's a fairly difficult installation. What's more, it changes every time you install a new version of the compiler.

The installation steps for the current compiler and Ubuntu are straightforward, but there's a lot of fine print, and the 64 bit version has a couple of quirks in the install. So let's go over it step by step. Note that I'm only referring to the 64-bit install in all of this. If you're running in 32-bit mode, your mileage will vary.

  1. Register. It's easy. You'll get a link to the download page an a serial number. Save the email, you'll need it.
  2. Download the appropriate tar file. I used the Genuine Intel® 64 bit version. There's another one called IA64, but I didn't try that.
  3. Now set up your machine to compile code. Run:
    sudo apt-get install build-essential gcc g++ rpm ia32-libs
    and either
    sudo apt-get install sun-java6-jre
    which requires you to accept Sun's Java license, or
    sudo apt-get install openjdk-6-jre-headless.
  4. Now you need a package called libstdc++5 which isn't included in Ubuntu. Worse, if you're on a 64 bit machine, you need to install the 32-bit version as well. So click on these
    the 64-bit code, libstdc++5_3.3.6-18_amd64.deb
    and
    the 32-bit code, libstdc++5_3.3.6-18_i386.deb
    
  5. Install the 64-bit version:
    $ sudo dpkg -i libstdc++5_3.3.6-18_amd64.deb
  6. DO NOT INSTALL THE 32-BIT VERSION. Instead:
    $ dpkg --extract libstdc++5_3.3.6-18_i386.deb ./
    $ cd usr/lib
    $ sudo -i
    # cp libstdc++.so.5.0.7 /usr/lib32
    # cd /usr/lib32
    # ln -s libstdc++.so.5.0.7 libstdc++.so.5
    # exit
    
  7. Now we can do the install. Go back and find your Fortran tarball
    $ tar xvzf l_cprof_p_11.1.072_intel64.tgz
    $ cd l_cprof_p_11.1.072_intel64
    $ sudo -i
    # ./install.sh
    
  8. Take all the defaults, and enter your registration number when asked. Note that you'll get some error statements to the effect that you're running this on an unsupported system (Ubuntu) and the option
    1. Skip missing optional pre-requisites [default]
    take that.
  9. Your compiler is now installed in /opt/intel/Compiler/11.1/072/ (the last number will vary), but you're not quite finished.
  10. If you use the bash shell, add the line
    source /opt/intel/Compiler/11.1/072/bin/ifortvars.sh intel64
    to your ~/.bashrc file.
  11. If you use the tcsh shell, add the line
    source /opt/intel/Compiler/11.1/072/bin/ifortvars.csh intel64 to your ~/.cshrc file.
  12. Now you're done. Look at man ifort to see how to use the thing.

My preliminary test indicates that the Intel compiler is about 10% faster than gfortran for a fairly CPU intensive calculation, without the MKL. Not all that much faster, really. If you're not doing a lot of serious computations, installing the Intel compiler might not be worth the trouble.

Thursday, May 20, 2010

Ubuntu 10.04: Remove the Chat and Mail Icons but keep the Volume Control

I don't chat. I can find my email on my own, thanks. But I do like the volume control up on the panel. Thanks to Short IP Recipes for the fix: Remove the indicators from your system:

sudo apt-get remove indicator-me indicator-messages

Log out, log back in, and voilà!

Tuesday, May 18, 2010

Ubuntu 10.04: Getting Started

I thought about putting in installation instructions for 10.04, but someone beat me to it, did a better job, and added a lot more information:

Getting Started with Ubuntu 10.04

Downloads a PDF manual.

Disclaimer: I haven't read it all the way through, it may be chock full of errors. But it's cheaper than going out and buying Ubuntu for Dummies, and covers the current version.