Throughout this book I've tried very hard to ensure the tips not only work but were also tested on as many computers as possible (I have several computers in my test lab and also ran the tips on virtual-ized setups). Additionally, the book has been extensively technically reviewed by some people with very large brains and bags of Ubuntu experience. However, the fact is that all computers are different, and some tips may have an adverse effect on your particular setup. Not only that but human error—not just on my part but also yours, dear reader—mean that occasionally things don't work as they should. Very occasionally, things might go really badly wrong. You might be left with a system that's unbootable.
The solution is to undo the changes you did. To do this you'll need some method of accessing your broken installation's file system, and you can do this by using your original Ubuntu install CD in live dis-
tro mode. This is done by selecting the Try Ubuntu without any change to your computer option on the CD boot menu. When the desktop appears remember that you're browsing the pseudo-file system created in RAM by the Ubuntu live dlstro mode. To fix your system, you must mount your Ubuntu hard disk partition so that it's accessible.
To do this, click the entry on the Places menu relating to your Ubuntu partition. It will be identified on the Places menu by its size—for example, if it is 160GB in size, then it will be identified as 160 GB Media. Following this, an icon will appear on the desktop, from where you can access the contents of the Ubuntu partition using Nautilus file browser.
Sometimes it's useful to make your Ubuntu partition into the root of the filesystem, as if you had just booted into it. It's not a good idea to do so while the live distro desktop is running, so you should switch to single-user mode (effectively a command-prompt and nothing else) before attempting it.
Here are the steps required:
1. Once the desktop has appeared in live distro mode, hit [Ctrl ]+[ Alt ]+ F2| to switch to a virtual console. Then type sudo telinit 1 .
2. A text-mode menu will eventually appear. Select the option that reads root - drop to root shell prompt.
3. At the prompt, type the following (note that you automatically run as root user in single-user mode so there's no need to precede commands with sudo; remember that you shouldn't type the hash before each command below, just like you shouldn't type the dollar when typing commands normally):
# mkdir ubuntu-partition
# mount /dev/sda5 ubuntu-partition
# chroot ubuntu-partition
As before, if Ubuntu is the only operating system on the disk, replace /dev/sda5 above with /dev/sda1.
You should now find that you are browsing your Ubuntu partition, as if you had booted into it, and can carry out any repair commands.
Sometimes the easiest thing if you've tweaked your system into oblivion is just to start over. It's not usually possible to reinstall Ubuntu "on top of itself" as you might have done with Windows, but if you choose to reinstall Ubuntu it will offer to shrink your existing installation and install a new one alongside. You can then delve into the partition to get your data. Ensure you use the same username in the new installation because this will avoid complications with file ownership between the two partitions.
Alternatively, you might choose to keep your existing installation but create a new user account for yourself. This can be done by using the Users & Groups tool on the System ^ Administration menu. Click the Unlock button when it starts, and then the Add User button. Type the new details in the Username and password fields of the dialog that appears (the rest can be left empty), and then click the User Privileges tab. Ensure the boxes alongside Administer the System and Manage Printers are checked.
Following this you can log in as the new user and import your data from your old /home folder. You will have to change the file/folder ownerships, however, to be able to both read and write the files. To do this, open an administrator Nautilus window (open a terminal and type gksu nautilus), and then right-click the file/folder, click Properties, and then click the Permissions tab. Then select your new username from the Owner dropdown list, as show in Figure 2.14, on the following page (note that, in the list, you will see several "non login accounts" used by the system; you can ignore these). Don't forget to close the administrator Nautilus window when you've finished.
Was this article helpful?