Saturday, May 30, 2015

Updating Ubuntu for the Unexperienced and

Time has come to update one of our Ubuntu boxes.  I can never remember how to do it and always have to go lookup the commands.  Maybe if I write them down here it'll help me remember them for next time.

I started with a lsb_release -a to see what version I was on.  Which happened to be 12.0.4.5 so I wasn't too far out of date.

Then I ran sudo apt-get update and then sudo apt-get upgrade to update all the packages that were available on the current version.  That brings me up to a fully patched system that needs to be upgraded to the latest LTS version (this is a production box running applications so I like to stick with LTS versions, I've never had a need to utilize the long term part, but it makes me feel better).

Next step I did was sudo apt-get dist-upgrade.  I'm no expert and I probably could have skipped this step and it's possible this step caused my later troubles.  Hind sight is 20/20 they say.

Now I just need to make the plunge and upgrade to the next release.  That's pretty easy,  sudo do-release-upgrade handles that.  And then the fun started.

Part way through this it prompts me because some of the apache configuration files have been modified from their originals.  I look through these changes and it really doesn't seem to like too big of a deal, but I don't want to stumble into something since most of these tweaks were done 2 years ago so I make a backup.  This machine is virtual and I didn't have the machine integration plugin installed so I couldn't switch between consoles there.  No problem though, I just SSH'd back into the machine and made a quick copy of the config file in question and then told the updater to replace it.  

The update gets done, I give the box a reboot, it seems to come back up normally and I think all is right in the world.  Then I pull up one of the websites hosted on the box and it just displays the content of the php file rather than processing the php file.  Maybe it's just this one site, nope, all the sites are equally broken.

No sweat, I've got a backup of that configuration file.   So I compare my "custom" file to the new file and don't see anything obviously wrong with it.  Obviously some of my tweaks are gone, but those wouldn't affect php not running.  I try restarting apache and it complains about a line in a configuration file (if I had noted the file I would have shared it here), that line looks like it has sometihng to do with php.  I did a bit of Googling and came across a reference to enabling php module with this command sudo a2enmod php5.  No luck, restarted apache, still no luck, same error and web pages still aren't right.

I find the command apt --installed list to show which packages are installed. I see a lot of php5-something else packages, but no php5 package.  I run sudo apt-get install php5 and let it install (it doesn't complain that it's already installed).  I restart apache and it works.  No error.  My web pages are back to normal.

I run apt --installed list again and it shows php5 is now installed.


In hind sight I think maybe the apt-get dist-upgrade may have been what did me in.  I'm not sure why, but none of the other commands should have removed any packages.  I guess if I had paid more attention to those apt-get message about packages being updated and being removed I would have been on top of this.  Lesson learned.

No comments:

Post a Comment