Book Image

Troubleshooting Ubuntu Server

By : Skanda Bhargav
Book Image

Troubleshooting Ubuntu Server

By: Skanda Bhargav

Overview of this book

Table of Contents (16 chapters)
Troubleshooting Ubuntu Server
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Configuration and extra repositories


The APT configurations are stored in the /etc/apt/sources.list.d directory and the /etc/apt/sources.list file in the server. An example of the file can be seen in the following screenshot. This will vary from system to system based on the remote repositories configured. You can enable or disable repositories by commenting the lines in the /etc/apt/sources.list file. To edit this file, you may require root permissions.

There are numerous repositories available other than the official Ubuntu one for installing packages on your server. Two of the popular ones are Universe and Multiverse. Both are open source and are supported widely by the community, and thus make it safe to use with your server. There are no security updates to these packages, but in some countries there might be some issues with the Multiverse package. This is also one of the reasons why Ubuntu does not have the Multiverse package support out of the box. If you take a look at the configuration files, you will observe that these repositories are enabled by default. You can disable them by commenting it out. Comment these lines to disable both the repositories:

deb http://archive.ubuntu.com/ubuntu precise universe multiverse deb-src http://archive.ubuntu.com/ubuntu precise universe multiverse  deb http://us.archive.ubuntu.com/ubuntu/ precise universe deb-src http://us.archive.ubuntu.com/ubuntu/ precise universe deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates universe  deb http://us.archive.ubuntu.com/ubuntu/ precise multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ precise multiverse deb http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse  deb http://security.ubuntu.com/ubuntu precise-security universe deb-src http://security.ubuntu.com/ubuntu precise-security universe deb http://security.ubuntu.com/ubuntu precise-security multiverse deb-src http://security.ubuntu.com/ubuntu precise-security multiverse

To view the support status of your Ubuntu machine, run the following command:

ubuntu-support-status

To view all the packages that are supported or not supported run the same command with the --show-all option.

You will be able to see a summary of the package support and its expiry time. It will be something similar to the following screenshot:

One of the cons of using third-party repositories is the chance of dependencies not being available or any package conflicting with any Ubuntu package. This can be a cycle and is termed as dependency hell. Make sure you go through other users' feedback on any issues with a particular package before installing it.

Finding the right mirror is crucial if you want to ensure a clean and fast installation. A mirror is a replica of the repository at a different physical location. You will need to look at the following factors when selecting a mirror and decide on it:

  • Distance: Try and use a mirror that is physically close to you.

  • Protocol: Your chosen mirror may not support all of the protocols such as HTTP,FTP, rsync, and so on.

  • Speed: Less number of people connecting to a mirror means more speed.

Visit https://launchpad.net/ubuntu/+archivemirrors for a list of mirrors and choose a mirror that best fits on the factors.

Resolving the "failed to get" error

It is often observed that when a user tries to install a package using apt-get install, they might get an error such as the one shown here:

W: Failed to fetch gzip:/var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_natty_main_source_Sources  Hash Sum mismatch,
E: Some index files failed to download. They have been ignored, or old ones used instead.

Fix your configuration list. Run the following commands to resolve this issue:

sudo rm /var/lib/apt/lists/*
sudo apt-get update

Downloading software from an outside repository

There may be some packages that you require that are not available in any of the repositories. Individuals may create a package and make it available online for others to download and install it manually. The package may be in one of the following formats: .tar.gz or .tgz. These packages always come with README files. Always make a point to read this file before performing any operation related to installation. This file is self-explanatory and has the directions to install the particular package onto your machine.