Upgrading to Fedora 16

I upgraded my Fedora installation from Release 15 to Release 16 today. It was a very smooth upgrade, although I don’t run much on Fedora — mostly trying things out for teaching in class. I was very impressed, though, with how well the upgrade went.

It wasn’t completely seamless, though, but that was my fault. Let me explain. I’m running Fedora in a virtual machine on my Mac, using VirtualBox. My primary Linux box is a Xiao Hu thin client computer, a MIPS processor based system, and I run Debian on it. But, because I’m teaching a Linux class using Fedora, I wanted to be able to test things out and make sure that things I was used to doing in Debian worked similarly on Fedora. Anyways, because I don’t use Fedora full-time, I created a small 8GB disk to hold the OS. Unfortunately, I needed more than that much space to upgrade, and that caused a slight, but easily manageable, hiccup.

My disk is configured with a 500MB /boot partition, a 6GB / partition, and the rest of the disk is used as swap space. With all the packages installed that we use in class, I’m using just under 4GB on my root partition, leaving a couple gig free.

To upgrade from Fedora Release 15 to 16, I installed and ran the preupgrade package. As part of its installation process, it checks to make sure that there’s enough free space available to do the upgrade. Of course, with all the crap I always seem to accumulate, there wasn’t, and it warned me that I needed to free up about half a gig of space. When I did that, the installation process continued, downloading all the upgraded packages (1130 of them!), then the system rebooted and began to install the new release. Unfortunately, during that installation, it again detected that there wasn’t enough space available, and reported I needed to free up another ~800MB of space! I just didn’t have enough available, so I had to stop the upgrade. Amazingly, I rebooted the VM, and I was back in Fedora 15 with no problems! That was a pleasant surprise, because I was worried that I’d be in a half-installed state, but that wasn’t the case.

It was an easy solution; using VirtualBox’s modifyhd command, I was able to increase the size of my virtual disk, increasing it to 12GB, and I created a new partition with that extra 4GB in it. Now, I needed to free up space on the root partition, and most of the space was being taken up in /var/cache/yum, where the upgrade was storing the updated packages. That was easy — I created a yum directory on my new partition, moved the contents of /var/cache/yum into there, then mounted the new partition on top of /var/cache/yum. That freed up enough space on the root partition to proceed.

At that point, I restarted “preupgrade”, and that quickly detected that I had already downloaded all of the updated packages, AND it saw that I now had enough disk space, so it automatically continued the upgrade. That ran without further input from me, so I wandered off to do something else, and when I came back, I had a nice Fedora 16 system running!

Screenshot of new Fedora 16 desktop

So, although I had a problem, I was very impressed by how well the upgrade process recovered from the problem and finished up the upgrade with little intervention from me. Good job, Fedora!

Replacing a forgotten root password in Fedora 15

At school, one of the classes I teach is the Linux class. In this class, we use Fedora 15. One of my students had forgotten the root password of his machine, and despite trying everything he could think of, he wasn’t able to guess what he had set the password to. He came to me looking for a way to reset the password.

The easiest way to do this is to boot into single-user mode. In single-user mode, you don’t need to log in; you’re automatically logged in to the root account. From there, you just need to run the “passwd” command, and you can set a new password for root.

It was a little more difficult than I expected. When Fedora 15 is installed, by default it installs the GRUB bootloader. If we have a choice of more than one operating system to boot into, the Fedora installation gives us a few seconds to select which one. During these few seconds, we can stop the boot process, then tell GRUB that we want to enter single-user mode (via a Linux kernel command-line argument), and away we go. However, if we only have a single OS on the computer, as was the case for my student, GRUB boots immediately into Linux, and we don’t have a chance to modify the kernel arguments. I knew there was some way to stop the boot, and after a little googling, I found the answer. I thought it was worth a blog post in case anyone else runs into this situation.

Short answer: hold down the shift key as the computer is booting, then GRUB will allow you to specify single user mode.

Here’s the longer answer.

Turn on the computer, and as the computer is booting, press and hold the shift key. If you time it right (if you press and hold too early, GRUB won’t recognize the keypress), you will see the following screen:

Initial GRUB screen

That’s GRUB. OK, we want to edit the kernel command-line arguments (you can find a complete list of them here), so at this point press the “a” key. You’ll go into a screen that allows you to edit the arguments:

Editing the kernel parameters

To enter single-user mode, you just need to append an “S” to the end of the command line, being sure to leave a space between the previous last argument and the S. See the screenshot below for what it should look like.

After adding the single-user kernel parameter

Once you’ve got that, just press the Enter key, and you’ll boot into single-user mode (also known as rescue mode — because it will rescue you from the forgotten root password!). You’ll be at the console, not the GUI, and your screen will look like this.

In single-user mode

Now, we can run the “passwd” command, and enter in the new password. The password won’t be displayed on the screen, but we’ll be asked to enter it twice, to make sure we didn’t make a typing mistake. After running the command, your screen will look like:

After changing the password

Once that’s done, you’ll be able to use your new password to log in to your root account. Now, just type CTRL-D, and the system will boot as normal, and away you go!