Friday, January 16, 2015

Mint 17, hibernate, plymouth

According to time-honored tradition I took advantage of time off over the holidays to upgrade my home computer from Mint 13 to Mint 17.

It's been about 2 1/2 years since I first tried Mint and I'm really feeling upbeat about this distro.  When Mark Shuttleworth went out of his mind and started ruining Ubuntu around 2010, it created a real vacuum.  For the first time since the Red Hat years there wasn't a Linux distro choice that was obvious.  I tried some different things, Mandriva, Magiea, Lubuntu and Xubuntu, Fedora... the magic just didn't seem to be there.

I was hearing good things about Mint so I gave it a shot.  Mint started out in a relationship with Ubuntu that you could compare with the old Mandrake - Red Hat relationship.  MATE gave me a way to cling to the familiar Gnome 2-ish desktop framework and continue to use all the same Ubuntu packages as before.

Anyway, things went smoothly.  This was kind of a big project due to the many purposes I use this computer for.  It's where I read my mail.  It's my 'file pig' where I keep movies and music.  It's my games box (dual boot with Windows XP).

You can now install Netflix practically out of the box.

I had a little trouble with Google Earth.  (Cool program).  Don't use the Google PPA.  Instead, install googleearth-package from the default Ubuntu repositories, then google-earth-stable:i386 as described here.

I used to just keep this computer up and running 24X7, but a few years ago I started hibernating it at night or when I was at work to keep the power consumption down.  After the upgrade, I had some trouble with hibernate.  Previously I had been using uswsusp, but now that didn't work at all.  I would get through a successful-looking hibernate and resume, then the computer would just lock up and I'd have to power cycle to bring it back up.

I took a shot at using swsusp instead.  uswsusp has several advantages over swsusp.  With uswsusp you get some output on the console showing the progress of the save or restore.  Swsusp just gives you a flashing cursor.  Uswsusp gives you a config file.  It gives you compression.  So uswsusp is my first choice.  But with a little configuration effort (notably building a swap file bigger than my RAM, since it doesn't use compression), swsusp seemed to be working.  But after a couple of weeks I had to admit it wasn't stable.  The longer my computer was up, the more likely hibernate was to fail.  It failed during the 'suspend', and shortly afterward X would lock up and I would need to reboot.

Around this time I started taking a really close look at a package called plymouth.  The purpose of plymouth is to display some eye candy while your system is booting.  By default, it gives you the Linux Mint logo but there are some other things you can configure.  The trouble with this is, if you're trying to troubleshoot something that happens during the boot process, like resuming from hibernate, all that dmesg output is hidden and you can only guess what's going on.

No problem, just remove plymouth, right?  Uh-uh.  For no reason that makes any sense, hundreds of packages are dependent on plymouth.  Packages like apache2, cron, cups, the kernel itself, mysql-server... This appears to come from Ubuntu since my buddy was able to easily remove plymouth from Mint-Debian.

So, a bit of frustration there, but the solution is easy enough... just remove "splash" from the boot line.

OK, did that.  Now I can see that my resume from uswsusp hibernate is proceeding to 100% completion, but right after that the computer locks up.

I did some more googling and found this.  Oh, that's interesting, plymouth itself is breaking the resume?  Here's another page documenting how to fix this.  I tried it and it worked.

So, plymouth was the real villain of this task, first blinding me to the output I needed to troubleshoot a problem, then it turns out plymouth itself caused the problem!  Plymouth is teh sux.

Update 2/17/2015:

I was continuing to have some instability with this system.  Every week or two I would have a lock-up and be forced to reboot.

I was just poking around in the motherboard manual kind of at random looking for clues when I noticed a feature called AHCI.  AHCI is a protocol for accessing SATA hard drives.  The BIOS menu has an option to either use AHCI or to cause the SATA drives to emulate IDE protocol.

Linux is fine with AHCI so I decided to try this.  I changed the BIOS setting to AHCI and Linux stayed up for 2 weeks.

There was a slight problem in that this computer was dual boot with Windows XP which is my games box for stuff I can't play in Linux.  Windows XP was on a SATA drive, and it does not support AHCI.  There are some hacks to enable this which I tried without success.  Finally I decided to just upgrade the Windows partition to Windows 7.  Windows XP was going on a year past its EOL date so this was probably something I was going to want to do eventually anyway.  This went smoothly and left me with a system I could just leave in AHCI mode all the time.

This issue predates my Mint 17 update as the computer has been having these freezes and lockups since the middle of last year. I actually was hoping Mint 17 would fix this.   My current theory is that I was running in AHCI mode for most of the lifetime of this motherboard (since October, 2009!), but after one of the changes I made last year, the BIOS was reset to its defaults, which includes IDE mode for SATA drives.

I'm not observing any disk I/O performance improvements or any other differences besides this system stability improvement as a result of switching to AHCI.  It is said to improve performance for SSDs.