The Official Ubuntu Book, 4e: Support and Typical Problems
Chapter 6. Support and Typical Problems
- The System
- System Administration
DESPITE THE FACT that the Ubuntu developers work tirelessly to make the Ubuntu user experience as fluid and problem-free as possible, there are always going to be bugs, glitches, and errors in software. This is nothing unique to Ubuntu; it is a characteristic that applies to all software. Anything created by humans is subject to error.
One of the many benefits of the open source development process is that errors and bugs are typically reported, found, and fixed in a far shorter time than is usually the case with proprietary software. This ensures that the software included with Ubuntu is far more solid and stable than some proprietary alternatives.
Although typical bugs are fixed quickly, there is still the case of user error. Even if a piece of software is completely bug-free, it can be used incorrectly, be misconfigured, or otherwise not work as expected. This is perfectly normal, and the aim of this chapter is to discuss some of the most common problems faced by users and to explore how to fix or otherwise resolve these issues.
This chapter is presented in a cookbook format, presenting each problem followed by a concise solution. If you have read through the other chapters in the book and not found the solution in this chapter, the next option is to try the superb Ubuntu forums at www.ubuntuforums.org. In recent years, the forums have proved to be a gold mine of useful information. Not only do they include discussion about problems and issues that other people have, they are also laden with community-contributed how-to articles that cover a wealth of different areas.
Your Ubuntu system is a little like an ecosystem. For certain things to work, other things must be already working. When you are new to any OS, it can often be a little difficult to get to know how some of these core system functions work.
In this section we cover the core system technology in Ubuntu and problems that can crop up when using it.
Ubuntu Won’t Start!
When Ubuntu first starts, the GRUB bootloader loads an OS for you. If you have only Ubuntu installed on your computer, it is loaded automatically. Otherwise, if you have more than one OS (e.g., both Ubuntu and Microsoft Windows), you can pick the one you want from a menu. If you don’t see the menu, restart your computer, wait until you see the word GRUB, and press Enter. Then use your arrow keys to select an option.
The core piece of software that is loaded when Ubuntu starts is the kernel, and sometimes there are a few different kernels installed on your system. On the menu, each kernel version (such as 2.6.28) has two options: the stock kernel and one called recovery mode. Try booting the newest kernel that is not a recovery mode one, and see if your system starts.
If your system still fails to start, it is likely that your bootloader is broken. When you use a bootloader such as GRUB, a tiny file (called the boot sector) is copied into the very first part of your hard disk. If this file is broken or corrupted, your system often won’t boot. Don’t worry, though, you can fix this by reinstalling GRUB using a live CD, such as the regular Ubuntu installation CD! To reinstall GRUB, boot your computer using the Ubuntu CD. Go through the process using all the default options until you reach the disk partitioning step. Select Manual Partition. Mount your Linux partitions like /, swap, and /home. Do not format them, or you will lose all your data. You are merely telling the installer where your partitions are. Finish the manual partitioning step and save the changes. You will receive an error message saying that the system couldn’t install. Ignore the message: You don’t want the system to install itself. Instead, select Continue until you get to the Ubuntu install menu. From there, select Install Grub. When the process is complete, reboot the computer, removing the CD from the drive at the appropriate moment. You should boot normally using a fixed bootloader.
There is a lot more that may be done to configure GRUB, and there are other ways to repair or reinstall GRUB in the unlikely event that problems come up. Unfortunately, we don’t have the space to cover GRUB configuration here, so we recommend that you consult the excellent documentation on the GRUB Web site at https://help.ubuntu.com/community/GrubHowto.
Backing Up and Restoring Your Boot Sector
When GRUB runs, the boot sector part of your hard disk contains information about which OS you can boot. This sector sometimes gets corrupted due to a system crash or power loss, and then your computer won’t boot. Luckily, with a few carefully chosen commands, you can back up and restore this important sector.
Back it up using this command:
foo@bar:~$ sudo dd if=/dev/hda of=MBR-backup bs=512 count=1
The dd command copies the sector from the first disk (/dev/hda—change this to your disk) and saves it as MBR-backup in the current directory.
To restore the sector, run this command:
foo@bar:~$ sudo dd if=MBR-backup of=/dev/hda bs=512 count=1
When you boot your computer in rescue mode, you can use these commands to manage your boot sector.
Ubuntu Loads but Keeps Restarting
If Ubuntu boots beyond GRUB but keeps rebooting, here are two issues you might be running into.
One possible problem is that your computer has faulty memory in it. To test this, restart your computer, and at the GRUB screen, choose Memory Test. Let this run for at least several hours. If your memory has any problems, this test will bring them up.
Sometimes you will get the wrong kernel with your computer. This might be because you have an older computer and are using a server kernel, which does not work with early Pentium computers. To fix this, install an appropriate generic kernel.
The Ubuntu Logo Appears Corrupted or Just Looks Odd While Booting
When your system starts, it uses a special splash image to make the boot process more attractive, as shown in Figure 6-1.
If you have problems with this splash screen, you can disable it. To do this, load the /boot/grub/menu.lst file into a text editor, and scroll to the bottom of the file. You should see a line such as this:
kernel /boot/vmlinuz-2.6.20-9-generic root=/dev/hda1 ro quiet splash
Just remove the splash word from the line and restart your computer. Now plain-text boot messages are displayed when the system starts.
When I Start My Computer, I Get Text Instead of a Graphical Interface
The graphical interface used in Ubuntu comes in two parts: X and GNOME. The X server is an underlying chunk of software that ensures your graphics card and monitor work, and it provides a base for GNOME to run on. The GNOME desktop uses X as an engine to create the rich desktop platform you have been using. If you start your computer and can see only text and no graphical interface, this is a problem with X.
First restart your computer to see if that fixes the problem. If that doesn’t work, restart your computer again and choose the recovery mode option in GRUB. You may have to hit Esc to enter GRUB. After the loading sequence, you will see a window with a number of options, as below. Choose the xfix option, which will change your video drive to a more generic one. You will then be returned to the same menu, where you can choose Resume normal boot to get back to the login window.
If this doesn’t work, there is likely some deeper problem. Unfortunately, we don’t have the space to cover X configuration in more detail, so please refer to http://help.ubuntu.com/community/DebuggingXAuto configuration for more help.
I Tried to Use a Word or PowerPoint Document, and the Fonts Are All Wrong
When loading Microsoft Office documents in OpenOffice.org, the documents may not look the way the author intended unless they are displayed with Windows fonts that are not on Ubuntu systems by default. While these fonts are proprietary, several of these are available online and can be downloaded with the msttcorefonts package from the multiverse repository.
When you install msttcorefonts, it automatically downloads and installs the following common Windows fonts:
- Andale Mono
- Arial (bold, italic, bold italic)
- Arial Black
- Comic Sans MS (bold)
- Courier New (bold, italic, bold italic)
- Georgia (bold, italic, bold italic)
- Times New Roman (bold, italic, bold italic)
- Trebuchet (bold, italic, bold italic)
- Verdana (bold, italic, bold italic)
With the installation complete, restart X to make the fonts available.
I Want to Add TrueType Fonts to My Desktop Quickly
Fonts have a huge impact on how attractive and usable your desktop is. Although Ubuntu comes with a range of high-quality fonts, you may want to install some additional fonts. This is often the case when you need to use a specific company font. On modern operating systems, most fonts come in the form of TrueType fonts. Ubuntu offers full support for TrueType fonts, and it is simple to add new fonts.
To add a font, open your home directory using Nautilus and create a hidden directory called .fonts. Don’t miss the . at the beginning because this is what makes a directory hidden. It is also the name that Ubuntu will expect for your personal font directory; if you use any other name, neither the directory nor your fonts will be found. Open .fonts and drag and drop your new font(s), as you can see in Figure 6-2. You may need to restart any applications, such as the GIMP, to use the new fonts.
My Fonts Don’t Look Good on My LCD Screen
If your fonts don’t look good on your LCD screen, it is possible that a quick change to your configuration may make a large difference. LCDs use what is called subpixel hinting to make the fonts look best. Open the System > Preferences > Appearance tool, and under the Font tab, choose the Rendering option that looks best on your monitor. The Details button opens a further dialog to control DPI (dots per inch), smoothing, hinting, and pixel order. Try various options until you arrive at an optimal configuration.
How Do I Install a Package?
See the section Adding and Removing Programs and Packages in Chapter 4.
How Do I Install Another Desktop Environment?
By default, Ubuntu comes with the GNOME desktop environment. Other variants of Ubuntu come with different desktops; for example, Kubuntu comes with KDE and Xubuntu with Xfce. All of these desktop environments are easy to install on the other variants, via convenient metapackages. The Ubuntu package is called ubuntu-desktop, the Kubuntu one is kubuntu-desktop, and the Xubuntu one is xubuntu-desktop.
I Want to Install an Application That Is Not in the Repositories
Although the repositories contain a huge selection of packages, sometimes the package you need is not included. The first thing you should check is that you have enabled the additional repositories such as universe and multiverse. You can do this from your menu at System > Administration > Software Sources. In the Ubuntu Software tab, ensure that the boxes are checked for main, universe, restricted, and multiverse. (See help.ubuntu.com/community/Repositories/Ubuntu for more details.)
If you have enabled these extra repositories and your package is still not there, have a quick hunt around with a search engine to see if you can find a repository (known as a Debian or APT repository) for your package. If you find one, use the Repositories dialog box you have just played with to add the new repository, and then use Synaptic to install the package.
If no repository is available, look for a Debian package (.deb) for the application. If you find one, download it, and double-click it to install. If no Debian package exists, look for an Autopackage. (An upcoming subsection, I Downloaded an Autopackage, but I Don’t Know How to Run It, provides details about Autopackage installation.)
Finally, if all else fails, download the source code and compile it.
I Want a Local Copy of the Ubuntu Repositories
If you have a number of computers to administer or do a lot of package maintenance, having a local copy of the Ubuntu repositories can make your life a lot easier. There are two primary ways to do this: via debmirror and via rsync. Both are fairly lengthy processes to undertake, so the full recipe is hosted on the Ubuntu help wiki at http://help.ubuntu.com/community/Rsyncmirror and http://help.ubuntu.com/community/Debmirror.
The File Manager Is Slower Than I Would Like—How Can I Make It Run Faster?
You can deactivate a number of options to make using the file manager a faster process. First, click Edit > Preferences, find the tab marked Preview, and click on it. If Show Text in Icons (the first option) is enabled, it will preview some of the contents of text documents in their icons. Set this option to Never. Next, there’s an option called Show Thumbnails. This option will preview image files as thumbnails. Set this option to Never to further improve the speed of the file manager’s browsing. If enabled, the option Preview Sound Files will make it possible to preview sound files without actually opening them. Set this to Never as well. The last option, Count Number of Items, shows how many items are within the folders listed in the directory you’re currently browsing. Set this to Never.
If you are still not satisfied with the speed of the file manager, you could check out some other file managers, such as Rox Filer or Thunar.
I Can’t See the Hidden Files and Folders in the File Manager
Files and directories that begin with a dot (such as .bashrc) are typically used to store settings and configuration details for a particular application. By default, the file manager does not show these files. So how do you view, move, and copy them? Simple. Just click View > Show Hidden Files, or press Ctrl-H, and your hidden files are displayed, as shown in Figure 6-3.
How Do I Restore Something I Deleted in the File Manager?
When you delete something in Ubuntu, the files are not deleted immediately and are instead moved to the trash. If you accidentally deleted your important report and want to avoid limb removal by your boss, open the trash by double-clicking the small trash icon in the bottom right-hand corner of the screen, and then drag your files back into the file manager. The world now returns to the happy place it was before you accidentally deleted your files.
How Can I Check If an .iso File Fully Downloaded?
Whenever you download a Linux distribution such as Ubuntu, you typically download an .iso file, a file that contains an image of a CD. You then use this file to create an installation CD for installing the distribution. After downloading the file, you may want to verify that the file you downloaded is the same as on the server. To test that you have the same file as on the server, you need to verify the .iso file. Open a terminal and run the following command:
foo@bar:~$ md5sum my_iso_file.iso
Wait a little while and Ubuntu will print a “word” that is 33 characters long. Now go to the site from which you downloaded the file, and compare this word with the md5sum given by the owner of the .iso file, usually a file named md5sums. The words should match. If they do not match, you should redownload the file and test it again.
I Downloaded an Autopackage, but I Don’t Know How to Run It
Autopackages are software packages that install on any Linux distribution, including Ubuntu. Autopackages offer a way to install software on your system that is not available via Synaptic. If you need something Synaptic can’t offer, Autopackages are an alternative.
When you find an Autopackage that you want to install, download it to your desktop. Now, right-click the package, and select Properties. In the Permissions tab, select the Execute checkbox on the Owner row. Now close the dialog box, and double-click the package.
The installation program now begins, and you can just follow the on-screen instructions.
How Do I Compile an Application?
When a distribution package is not available, the source code is always available to compile with open source applications. Compilation is the process of converting programming code into a program that you can run and use. Although it sounds like a devilishly difficult process, it is typically fairly simple.
You should first have a look on the application’s Web page, or in the INSTALL or README file included with the code, to see what software the application needs to run. When you know what is required, use Synaptic to search for the required tools. Many of the requirements will be software libraries (software that applications require to run), and these libraries typically have lib at the start of the package name. As an example, if you need to have the Ogg Vorbis audio codec installed, do a search in Synaptic for Ogg Vorbis, and libvorbis will be one of the packages. You should also install the package with -dev at the end of the name (such as libvorbis-dev). These packages allow you to compile software for that library.
The process of compiling software involves three steps: (1) configuration, (2) compilation, and (3) installation. Open a terminal, move into the directory from which you extracted the source code, and configure it:
When you run /configure, it checks to see that you have all the required software. If it throws an error, it is likely that a required tool or library is missing. Find out what it is, and install it. Typically, configure will tell you what you need to install.
If the configure script works fine, compile the code with this command:
If a problem appears when compiling the software, it may be a bug or problem in the source code. It is best to refer your problem to the author of the code for further help.
If the compile process was successful, install the application with this command:
foo@bar:yourapp$ sudo make install
The software is now fully installed.
The Desktop Has Hung—What Do I Do?
If your computer still responds, you can press Ctrl-Alt-F1, which will show you a text login prompt. Login with your username and password, and then use top to find out if there is a program or process that is using all your processor power.
You will be given some global stats at the top of the screen, and just under that will be a chartlike display of active programs and processes. The chart includes the pid (a number used by the processor to identify a specific process or program), the user running the process or program, and other great information. What you are looking for is the pid and the percentage of your CPU power each process is using. To make your task even easier, only the top several processes are listed, and they are listed in order of how much system resources they are consuming. You may find one that is using too many system resources. If so, note the pid, and use the number to replace <pid> in this command:
foo@bar:~$ sudo kill -9 <pid>
If that doesn’t help, you can always restart your computer, but you may lose any unsaved work. To restart, enter:
foo@bar:~$ sudo reboot
My Screen Resolution Is Wrong
If your screen resolution is incorrect, click System > Preferences > Display, and select a new resolution from the combo box.
How Can I Automatically Log In Without Having to Enter My Login Details?
If logging in is a drag for you, click System > Administration > Login Window. Under the Security tab, check the Enable Automatic Login and select the user who should be logged in automatically.
Be careful when automatically logging in—anyone will have access to the computer when it is started. If you would prefer that certain people not have access to the computer, automatically logging in may not be such a good idea.
I Tried to Upgrade My System, but I Got an Error
If you get an error when you try to install some software or upgrade your computer, the package manager may have tied itself in a knot. To try to resolve this, open a terminal, and run the following commands:
foo@bar:~$ sudo apt-get update foo@bar:~$ sudo apt-get -f install
The first command updates your package list, and the second command tries to fix your package manager. If this is successful, the packages that failed will be installed correctly.
In addition to these commands, you can reconfigure any packages that have not yet been configured by running this command:
foo@bar:~$ sudo dpkg --configure --pending
I Am Running Out of Disk Space—How Do I Free Up Some Space?
If you are concerned that you may be running out of disk space, you can use a few techniques to clear some room. Before you do anything, you should get a report of how much disk space is available. Under the Applications > Accessories menu you will find a tool called Disk Usage Analyzer. After it has loaded, click on the Scan Home button. This will show you a graphical circular chart.
The center circle represents the root folder being scanned, in this case, your home directory. Each directory under that shows up as a ring. The larger the way around the ring, the greater the percentage of the total it is using. To find out specifically which directory is referred to, run your mouse over that segment. With the diagram, you can now explore to find the largest files and folders and clean them out as needed.
A new tool in 9.04 is the Computer Janitor, which clears out disk space and other accumulated “cruft” that exists on a well-used computer.
I Deleted Something in the File Manager, but I Don’t See the Extra Disk Space
When you delete files in the file manager, they are copied to the trash. To finally delete them, right-click the trash in the bottom right-hand corner of the screen, and click Empty the Trash. A dialog box pops up asking you to confirm the deletion. Click the Empty the Trash button, and the files are removed.
Another Version of Ubuntu Is Out—How Do I Upgrade to It?
If a new version of Ubuntu is released, the update manager will notify you via an upgrade notification pop-up bubble. To upgrade, click the Upgrade button, and follow the instructions.
If you want to manually upgrade, you can also use the update manager. To update to an unstable version, run the update manager with the -d option, as follows:
foo@bar:~$ sudo update-manager -d