APT - Ubuntu: Questions and Answers (2014)

Ubuntu: Questions and Answers (2014)

APT

Skip to questions, Wiki by user olli

APT uses dpkg (Debian package management system) as a backend. APT downloads the package list, keeps track of all packages installed, solves dependencies and removes unnecessary packages. It also allows you to query the cache, upgrade packages, manage packages from multiple repositories, etc.

Any question about the APT itself or its tools should use this tag, this include:

  • apt-config: to manage APT configuration.
  • apt: command-line interface of apt, available from apt 1.0 (Ubuntu 14.04). Plans to replace several utilities.
  • apt-key: manage the different GPG keys for repositories
  • apt-cdrom: manage CD-ROM entries
  • apt-cache: query the apt cache
  • apt-mark: to mark specific packages as automatically or manually installed
  • apt-get: the default package handling utility

Questions about editing or configuring APT itself using the files in the directory /etc/apt (e.g. pinning) and questions about other directories that are also related to APT, and the usage of the different APT APIs, calls and libraries, like python-apt should all be tagged with apt.

There are other front ends for most of the functions of the tools included in the apt package, like aptitude, wajig and dselect.

The Debian wiki page for apt.

Questions

Q: How can PPAs be removed?

Tags: apt (Next Q), ppa (Next Q)

I've added many PPAs using the add-apt-repository command. Is there a simple way to remove these PPAs? I've checked in /etc/apt/sources.list for the appropriate deb lines but they aren't there.

This is on a server system so a command line solution would be great!

Tags: apt (Next Q), ppa (Next Q)

User: david-ashford

Answer by giorgi-jvaridze

Use the --remove flag, similar to how the PPA was added:

sudo add-apt-repository --remove ppa:whatever/ppa

You can also remove PPAs by deleting the .list files from /etc/apt/sources.list.d directory.

Answer by izx

Simply run apt-add-repository again with the --remove option to remove a PPA added via the command-line, for example:

sudo apt-add-repository --remove ppa:kernel-ppa/ppa

Then update with:

sudo apt-get update

Answer by kone4040

You can use the

sudo ppa-purge ppa:repository-name/subdirectory

command in a terminal.

You will first need to install ppa-purge to use this command. To do so, use sudo apt-get install ppa-purge or click this button:

Find out more about it here.

Tags: apt (Next Q), ppa (Next Q)

Q: How can I see all versions of a package that are available in the archive?

Tags: apt (Next Q), package-management (Next Q)

Is there a way I can see all the versions that are in the archives that I have configured in sources.list. I can see the last version of each archive with "apt-get policy", but how can I see all?

Is there any way that this can also include ppa and anything in sources.list.d?

Tags: apt (Next Q), package-management (Next Q)

User: txwikinger

Answer by li-lo

As far as I understand your requirements, the madison option for apt-cache does what you want:

madison /[ pkg(s) ]
apt-cache's madison command attempts to mimic the output format and a subset of the functionality of the Debian archive management tool, madison. It displays available versions of a package in a tabular format. Unlike the original madison, it can only display information for the architecture for which APT has retrieved package lists (APT::Architecture).

On my computer:

$ apt-cache madison f-spot

f-spot | 0.7.2-1~ppa~lucid0 | http://ppa.launchpad.net/f-spot/f-spot-ppa/ubuntu/ lucid/main Packages

f-spot | 0.6.1.5-2ubuntu7 | http://ro.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages

f-spot | 0.6.1.5-2ubuntu6 | http://ro.archive.ubuntu.com/ubuntu/ lucid/main Packages

f-spot | 0.6.1.5-2ubuntu6 | http://ro.archive.ubuntu.com/ubuntu/ lucid/main Sources

f-spot | 0.6.1.5-2ubuntu7 | http://ro.archive.ubuntu.com/ubuntu/ lucid-updates/main Sources

I hope this is what you need. It also includes the ppas.

Answer by lfaraone

The rmadison program from the devscripts package will remotely query the Ubuntu archive and give you the status of a package in all supported releases, not only those you have locally insatlled. This is slightly more than what you want, but should get the job done easily.

Example:

Skip code block

lfaraone@stone:~$ rmadison sudo

sudo | 1.6.8p12-1ubuntu6 | dapper | source, amd64, i386, powerpc

sudo | 1.6.8p12-1ubuntu6.3 | dapper-security | source, amd64, i386, powerpc

sudo | 1.6.8p12-1ubuntu6.3 | dapper-updates | source, amd64, i386, powerpc

sudo | 1.6.9p10-1ubuntu3 | hardy | source, amd64, i386

sudo | 1.6.9p10-1ubuntu3.8 | hardy-security | source, amd64, i386

sudo | 1.6.9p10-1ubuntu3.8 | hardy-updates | source, amd64, i386

sudo | 1.6.9p17-1ubuntu3 | jaunty | source, amd64, i386

sudo | 1.6.9p17-1ubuntu3.3 | jaunty-security | source, amd64, i386

sudo | 1.6.9p17-1ubuntu3.3 | jaunty-updates | source, amd64, i386

sudo | 1.7.0-1ubuntu2 | karmic | source, amd64, i386

sudo | 1.7.0-1ubuntu2.4 | karmic-security | source, amd64, i386

sudo | 1.7.0-1ubuntu2.4 | karmic-updates | source, amd64, i386

sudo | 1.7.2p1-1ubuntu5 | lucid | source, amd64, i386

sudo | 1.7.2p1-1ubuntu5.1 | lucid-security | source, amd64, i386

sudo | 1.7.2p1-1ubuntu5.1 | lucid-updates | source, amd64, i386

sudo | 1.7.2p7-1ubuntu1 | maverick | source, amd64, i386

Tags: apt (Next Q), package-management (Next Q)

Q: "The following packages have been kept back:" Why and how do I solve it?

Tags: apt (Next Q), package-management (Next Q)

I just added a PPA repository for the development version of the GIMP, but I get this error

The following packages have been kept back:

gimp gimp-data libgegl-0.0-0 libgimp2.0

Why and how can I solve it so that I can use the latest version instead of the one I have now?

Tags: apt (Next Q), package-management (Next Q)

User: jfoucher

Answer by mac9416

According to an article on debian-administration.org,

If the dependencies have changed on one of the packages you have installed so that a new package must be installed to perform the upgrade then that will be listed as "kept-back".

That article says sudo apt-get dist-upgrade will force the installation of those newer packages.

Note:

dist-upgrade will install all pending updates, with their new dependencies. If for some reason, you don't want to do that, you should use apt-get install package-name dependency-package-name instead.

Answer by mudy

apt-get dist-upgrade is dangerous for stable environment,

  1. wrong source.list setting and you end up with broken ubuntu.
  2. you might get entire application upgraded to version you dont want.

Use case: kernel upgrade kept back, you just want to upgrade the kernel, dont want to upgrade entire distribution.

Better way to handle kept back package:

sudo aptitude

If you have kept back package you should see Upgradable Packages on top of the list.

  • Hit + on that list
  • Hit g twice
  • Answer debconf stuff if asked
  • Press return to continue
  • Press Q
  • Press yes

Your kept back package installed.

Answer by user88285

Whenever you receive from the command apt-get upgrade the message

The following packages have been kept back:

then to upgrade one or all of the kept-back packages, without doing a distribution upgrade (this is what dist-upgrade does, if I remember correctly) is to issue the command:

apt-get install <list of packages kept back>

this will resolve the kept-back issues and will ask to install additional packages, etc. as was explained by other answers.

Tags: apt (Next Q), package-management (Next Q)

Q: Is aptitude still considered superior to apt-get?

Tags: apt (Next Q), package-management (Next Q)

When I first started with Ubuntu using aptitude was the 'in-thing', with some stated improvements over apt-get. Am I correct in saying that apt-get has now 'caught up' with aptitude, and it makes little difference which is used (although it is preferable to choose one or the other, and stick with it)?

Moreover, with aptitude set to be removed from a default Ubuntu install, should everyone revert to apt-get, especially when guiding new users interested in the CLI?

Tags: apt (Next Q), package-management (Next Q)

User: 8128

Answer by riccardo-murri

As far as I can see, in 10.04, the main differences between aptitude and apt-get are:

  1. aptitude adds explicit per-package flags, indicating whether a package was automatically installed to satisfy a dependency: you can manipulate those flags (aptitude markauto or aptitude unmarkauto) to change the way aptitude treats the package.

apt-get keeps track of the same information, but will not show it explicitly. apt-mark can be used for manipulating the flags.

  1. aptitude will offer to remove unused packages each time you remove an installed package, whereas apt-get will only do that if explicitly asked to with apt-get autoremove or specify --auto-remove.
  2. aptitude acts as a single command-line front-end to most of the functionalities in both apt-get and apt-cache.
  3. In contrast to apt-cache's "search", aptitude's "search" output also shows the installed/removed/purged status of a package (plus aptitude's own status flags). Also, the "install" output marks which packages are being installed to satisfy a dependency, and which are being removed because unused.
  4. aptitude has a (text-only) interactive UI.

I personally use only aptitude for my command-line package management (and I never use the text UI); I find its output more readable than apt-get/apt-cache.

However, if aptitude will be no longer standard on Ubuntu, there's no other choice than use apt-get in instructions and how-to documents.

(Personally, I'm rather disappointed to see it go away in 10.10; especially since the improvements of aptitude over apt-get are mostly on the usability side. I guess they deemed that those conversant with the command-line know how to get aptitude back, and those who don't use the command-line will not care...)

Answer by itsadok

I guess it's a matter of personal choice by now. I find typing aptitude search makes more sense to me than apt-cache search, and I like that it tells me which packages I have installed right there in the search output, instead of having to run dpkg -l.

Tags: apt (Next Q), package-management (Next Q)

Q: What is the easiest way to resolve apt-get BADSIG GPG errors?

Tags: apt (Next Q)

I frequently cross this issue, and always have to google for an answer. Does anyone have a permanent fix for BADSIG errors from apt-get?

W: GPG error: http://download.virtualbox.org lucid Release: The following signatures were invalid: BADSIG 54422A4B98AB5139 Oracle Corporation (VirtualBox archive signing key)

Tags: apt (Next Q)

User: casey

Answer by qbi

The important part of your error message is the following in bold:

W: GPG error: http://download.virtualbox.org lucid Release: The following signatures were invalid: BADSIG 54422A4B98AB5139 Oracle Corporation (VirtualBox archive signing key)

Copy the stuff in bold and then open a terminal and type:

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 54422A4B98AB5139

i.e. paste using SHIFT + INS the number you have copied - 54422A4B98AB5139

You'll have to enter your password, the key will be downloaded and integrated.

Answer by srinivas-gollapudi

Here's the (easiest) solution:

Type the following commands in the Terminal:

$ sudo -i

# apt-get clean

# cd /var/lib/apt

# mv lists lists.old

# mkdir -p lists/partial

# apt-get clean

# apt-get update

Credits: ubuntugeek.com

Edit:

If the error occurs again (maybe after a few days/months), open Nautilus as root > navigate to var/lib/apt > delete the "lists.old" folder > then open the "lists" folder and delete the "partial" folder. Now, execute the aforementioned commands again.

Answer by portablejim

Try deleting the key

sudo apt-key del 16126D3A3E5C1192

then updating the repository

sudo apt-get update

You should get a NO_PUBKEY error instead of a BADSIG error and

sudo apt-key finger

should not find the key (called "Ubuntu Extras Archive Automatic Signing Key")

Now add the key

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 16126D3A3E5C1192

The result of apt-key finger should have

pub 1024D/3E5C1192 2010-09-20

Key fingerprint = C474 15DF F48C 0964 5B78 6094 1612 6D3A 3E5C 1192

uid Ubuntu Extras Archive Automatic Signing Key <ftpmaster@ubuntu.com>

If that does not work, try

apt-get clean # Remove cached packages

cd /var/lib/apt

mv lists lists.old # Backup mirror info

mkdir -p lists/partial # Recreate directory structure

apt-get clean

apt-get update # Fetch mirror info

Source: this ubuntu forums thread

Tags: apt (Next Q)

Q: How do I fix the GPG error "NO_PUBKEY"?

Tags: apt (Next Q)

I added some extra repositories with the Software Sources program. But when I reload the package database, I get an error like the following:

GPG error [...] NO_PUBKEY [...]

I know I can fix it using apt-key in a terminal, according to the official Ubuntu documentation. But I would have liked to do it graphically. Is there a mean not to open a terminal?

Tags: apt (Next Q)

User: agmenor

Answer by monotasker

By far the simplest way to handle this now is with Y-PPA-Manager (which now integrates the launchpad-getkeys script with a graphical interface).

  1. To install it, first add the webupd8 repository for this program:
  2. sudo add-apt-repository ppa:webupd8team/y-ppa-manager
  3. Update your software list and install Y-PPA-Manager:
  4. sudo apt-get update
  5. sudo apt-get install y-ppa-manager
  6. Run y-ppa-manager (from the dash if you like).
  7. When the main y-ppa-manager window appears, click on "Advanced."
  8. From the list of advanced tasks, select "Try to import all missing GPG keys" and click OK.

You're done! As the warning dialog says when you start the operation, it may take quite a while (about 2 minutes for me) depending on how many PPA's you have and the speed of your connection.

Answer by karthick87

Execute the following commands in terminal

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8BAF9A6F

and then update

sudo apt-get update

Answer by htorque

You need to get and import the key.

To get the key from a PPA, visit the PPA's Launchpad page. On every PPA page at Launchpad you will find this link (2), after clicking on 'Technical details about this PPA' (1):

Follow it and click on the key ID link (3):

Save the page, this is your key file.

Now it's time to import it:

  • Applications > Software Center,
  • Edit > Software sources...,
  • Enter your password,
  • Go to the Authentication tab and click on Import Key File..., finally
  • Select the saved key file and click on OK.

That's it.

Tags: apt (Next Q)

Q: How to list all installed packages?

Tags: apt (Next Q), packages (Next Q)

I'd like to output a list of all installed packages into a text file, so that I can review it and bulk-install on another system. How to do this?

Tags: apt (Next Q), packages (Next Q)

User: ivan

Answer by sabacon

To get a list of packages installed locally do this in your terminal:

dpkg --get-selections | grep -v deinstall

To save that list to a text file called packages on your desktop do this in your terminal:

dpkg --get-selections | grep -v deinstall > ~/Desktop/packages

(you don't need to run this as the superuser, so no sudo necessary here)

Answer by gogaman

Create a backup of what packages are currently installed:

dpkg --get-selections > list.txt

Then (on another system) restore installations from that list:

dpkg --clear-selections

sudo dpkg --set-selections < list.txt

To get rid of stale packages

sudo apt-get autoremove

To get installed like at backup time (i.e. to install packages set by dpkg --set-selections)

sudo apt-get dselect-upgrade

Answer by intuited

To get just the packages which were expressly installed (not just installed as dependencies), you can run

aptitude search '~i!~M'

This will also include a brief description, which you may want. If not, use the option -F '%p', as mentioned by karthick87.

aveat: As pointed by another gertvdijk comment, this problem was fixed and the method is reliable yet again.

Yet another option seems to be to copy the file /var/lib/apt/extended_states, which is a text file database in this format:

Package: grub-common

Architecture: amd64

Auto-Installed: 0

Package: linux-headers-2.6.35-22-generic

Architecture: amd64

Auto-Installed: 1

Auto-Installed: 0 indicates that the package was expressly installed and is not just a dependency.

Tags: apt (Next Q), packages (Next Q)

Q: How do I get the source code of packages installed through apt-get?

Tags: apt (Next Q)

I am assuming that all application installed through apt-get are open source; but for those that are available in that manner, where can I get the source code for these applications as well as update them?

I have a couple applications I use regularly that aren't being actively developed any longer and I would like to add features. Where would I go to get the rights to update these applications?

In this case specifically, I am referring to the hellanzb package

Tags: apt (Next Q)

User: myusuf3

Answer by alvin-row

Use the command apt-get source <package> (don't use sudo with it) to download the source of a package.

From man apt-get:

Skip code block

source

source causes apt-get to fetch source packages. APT will examine the

available packages to decide which source package to fetch. It will then

find and download into the current directory the newest available version of

that source package while respect the default release, set with the option

APT::Default-Release, the -t option or per package with the pkg/release

syntax, if possible.

Source packages are tracked separately from binary packages via deb-src type

lines in the sources.list(5) file. This means that you will need to add such

a line for each repository you want to get sources from. If you don't do

this you will properly get another (newer, older or none) source version

than the one you have installed or could install.

If the --compile option is specified then the package will be compiled to a

binary .deb using dpkg-buildpackage, if --download-only is specified then

the source package will not be unpacked.

A specific source version can be retrieved by postfixing the source name

with an equals and then the version to fetch, similar to the mechanism used

for the package files. This enables exact matching of the source package

name and version, implicitly enabling the APT::Get::Only-Source option.

Note that source packages are not tracked like binary packages, they exist

only in the current directory and are similar to downloading source tar

balls.

To build a package from source, first install the build dependencies:

sudo apt-get build-dep <package>

Then use dpkg-buildpackage to create a .deb file. From APT and Dpkg Quick Reference Sheet:

dpkg-buildpackage Builds a Debian package from a Debian source tree. You must be in the main directory of the source tree for this to work. Sample usage:

dpkg-buildpackage -rfakeroot -uc -b

Where -rfakeroot instructs it to use the fakeroot program to simulate root privileges (for ownership purposes), -uc stands for "Don't cryptographically sign the changelog", and -b stands for "Build the binary package only"

In a terminal, cd into the directory containing the package source (e.g ~/code/hellanzb-0.13) and run the following command:

dpkg-buildpackage -rfakeroot -uc -b

If the build is successful, there will be a .deb file located in the parent
directory (e.g ~/code/hellanzb_0.13-6.1_all.deb).

Tags: apt (Next Q)

Q: How do I fix a "Problem with MergeList" or "status file could not be parsed" error when trying to do an update?

Tags: apt (Next Q)

The computer gave me this output in a window:

E: Encountered a section with no Package: header

E: Problem with MergeList /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_natty_main_binary-i386_Packages

E: The package lists or status file could not be parsed or opened.

How can I fix this?

Tags: apt (Next Q)

User: user12250

Answer by allan

These terminal commands should solve your problem:

First remove the Merge List by opening a terminal (Press Ctrl+Alt+T to launch) and run this command:

sudo rm /var/lib/apt/lists/* -vf

Next, generate a new one by running a simple update:

sudo apt-get update

Here is the bug report (and another) for this problem, which is now fixed so it shouldn't create new malformed files, however if you already have the malformed files you need to remove them as explained in this post.

Answer by tommyk

Open a Terminal and run the following commands one at a time:

sudo rm /var/lib/apt/lists/* -vf

sudo apt-get update

See also:

  • https://help.ubuntu.com/community/PackageManagerTroubleshootingProcedure

Answer by gilles

You screwed up when you edited /var/lib/dpkg/status. Restore it from the backup that you made before editing it. Of course, you made a backup, right?

Since you didn't make a backup, edit it again, carefully. Try not to cause more damage.

You can use /var/lib/dpkg/status.old as a reference point. This is a backup of the status file from before the last time dpkg was run. Run

diff /var/lib/dpkg/status.old /var/lib/dpkg/status

to see the differences. Undo the changes that you made manually, and keep the changes that were made by the last dpkg run.

If you really can't manage to repair the file, copy /var/lib/dpkg/status.old over /var/lib/dpkg/status. You will get a well-formed, but out-of-date package database.

You never need to edit /var/lib/dpkg/status in normal operation. Even whe things go seriously wrong, /var/lib/dpkg/status is not something that tends to require administrator intervention. Whatever your problems with crossplatformui were, there is probably a better way of solving them. The only time I've ever needed to edit /var/lib/dpkg/status was when an upstream Packages file was broken.

Tags: apt (Next Q)

Q: How can I get apt to use a mirror close to me, or choose a faster mirror?

Tags: apt (Next Q)

Downloading from the main Ubuntu archive is slow even when it's not release day, how can I get apt-get to automatically use a mirror that is close to me?

Tags: apt (Next Q)

User: ajmitch

Answer by ajmitch

apt-get now supports a 'mirror' method that will automatically select a good mirror based on your location. Putting:

deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse

deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse

deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse

deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse

on the top in your /etc/apt/sources.list file should be all that is needed to make it automatically pick a mirror for you based on your geographical location.

Lucid (10.04), Maverick (10.10), Natty (11.04), And Oneiric (11.10) users can replace precise with the appropriate name.

Answer by sean-fitzpatrick

I've always gone with the 'select best server' GUI tool: from Ubuntu Software Center, go to Edit -> Software Sources in the menu. (You can also do this from the Preferences for Synaptic or the Update Manager.)

Under the Ubuntu Software tab there's a drop-down next to "Download from:" If you select "Other..." you'll get a button that says "Select Best Server"; clicking on it gets Ubuntu to run some tests to see what mirror will give the best download speed.

I can't comment on whether this is better or worse than the method you found for yourself. Perhaps someone with some expertise on the issue can comment!

Here are some screenshots for the graphical method, as Jorge suggested:

  1. Open the Ubuntu Software Center, click on Edit in the global menu, and go to 'Software Sources...'
  2. Click on the drop-down menu next to 'Download From' and select 'Other...'
  3. Click on Select Best Server
  4. The best server is highlighted. Click Choose Server and you're done!

Answer by jorge-castro

You can also use mirrors hosted on Amazon's S3 service, which has a bunch of capacity and should be fast for users where an Amazon region is close:

You can use whichever region is closest to you, you can either manually add these to /etc/apt/sources.list/ or paste them into the custom URL field of the software sources application. I am including the updates and security sections too for completeness.

  • East Coast US (this is the default mirror for the US east mirrors):
  • deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
  • deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
  • deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
  • West Coast US (California):
  • deb http://us-west-1.ec2.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
  • deb http://us-west-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
  • deb http://us-west-1.ec2.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
  • West Coast US (Oregon)
  • deb http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
  • deb http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
  • deb http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
  • South America (So Paulo, Brazil)
  • deb http://sa-east-1.ec2.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
  • deb http://sa-east-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
  • deb http://sa-east-1.ec2.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
  • Western Europe (Dublin, Ireland)
  • deb http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
  • deb http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
  • deb http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
  • SouthEast Asia (Singapore)
  • deb http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
  • deb http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
  • deb http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
  • NorthEast Asia (Tokyo)
  • deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
  • deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
  • deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse

Note: Unlike most other Ubuntu mirrors, the Amazon S3 mirrors do not provide HTTP directory listings; e.g. if you try to access http://us-east-1.ec2.archive.ubuntu.com/ubuntu/, you will get an "access denied" page. This is normal, and apt-get will not be affected.

Please NOTE: Due to a bug with S3 in every region except east-1, users may have problems with download packages. Amazon has fixed this in east-1 and fixes for the other regions are pending.

In the meantime, the maintainers strongly suggests that you put the following in /etc/apt/apt.conf.d/90-apt-no-pipeling.conf if you are outside of east-1:

Acquire::http::Pipeline-Depth "0";

Alternatively, you may use the following command:

sudo apt-get -o Acquire::http::Pipeline-Depth=0 ....

If you get odd message failure messages try either of these options.

Tags: apt (Next Q)

Q: How to upgrade a single package using apt-get?

Tags: apt (Next Q), upgrade (Next Q)

How do I update a single package? As far as man apt-get says apt-get upgrade doesn't take a package/list of packages as parameter:

upgrade

upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version. An update must be performed first so that apt-get knows that new versions of packages are available.

Tags: apt (Next Q), upgrade (Next Q)

User: lurscher

Answer by josh

You just need to do apt-get install --only-upgrade <packagename>. This will upgrade only that single package, and only if it is installed.

If you wish to install the package if it doesn't exist, or upgrade it if it does, you may leave out --only-upgrade.

Answer by ian

In order to update a single package using the CLI:

sudo apt-get --only-upgrade install <packagename>

e.g., sudo apt-get --only-upgrade install ack

Reading package lists... Done

Building dependency tree

Reading state information... Done

Skipping **ack**, it is not installed and only upgrades are requested.

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Answer by binarylife

There are two possible ways I can think of:

  1. sudo apt-get install nameofpackage

This will upgrade the package even if is already installed:

~$ sudo apt-get install emesene

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following packages will be upgraded:

emesene

1 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.

Need to get 1,486 kB of archives.

After this operation, 696 kB disk space will be freed.

Get:1 http://il.archive.ubuntu.com/ubuntu/ natty-updates/universe emesene all 2.11.4+dfsg-0ubuntu1 [1,486 kB]

  1. UsingSynaptic Package Manager: Right clickMark for upgrade:

Note: Sometimes it may asks for additional packages or dependencies, it is normal.

Tags: apt (Next Q), upgrade (Next Q)

Q: What is "dist-upgrade" and why does it upgrade more than "upgrade"?

Tags: apt (Next Q), upgrade (Next Q)

I was wondering why upgrade sometimes doesn't want to upgrade certain parts of the system, while dist-upgrade does. Here's an example after running update:

apt-get upgrade:

rimmer@rimmer-Lenovo-IdeaPad-S10-2:~$ sudo apt-get upgrade

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following packages have been kept back:

linux-generic linux-headers-generic linux-image-generic

0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

versus apt-get dist-upgrade:

Skip code block

rimmer@rimmer-Lenovo-IdeaPad-S10-2:~$ sudo apt-get dist-upgrade

Reading package lists... Done

Building dependency tree

Reading state information... Done

Calculating upgrade... Done

The following NEW packages will be installed:

linux-headers-3.0.0-13 linux-headers-3.0.0-13-generic

linux-image-3.0.0-13-generic

The following packages will be upgraded:

linux-generic linux-headers-generic linux-image-generic

3 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.

Need to get 48.5 MB of archives.

After this operation, 215 MB of additional disk space will be used.

Do you want to continue [Y/n]?

In other words, why can't this be performed by upgrade?

Tags: apt (Next Q), upgrade (Next Q)

User: richard-rodriguez

Answer by jcollado

From apt-get manual:

Skip code block

upgrade

upgrade is used to install the newest versions of all packages

currently installed on the system from the sources enumerated in

/etc/apt/sources.list. Packages currently installed with new

versions available are retrieved and upgraded; under no

circumstances are currently installed packages removed, or packages

not already installed retrieved and installed. New versions of

currently installed packages that cannot be upgraded without

changing the install status of another package will be left at

their current version. An update must be performed first so that

apt-get knows that new versions of packages are available.

dist-upgrade

dist-upgrade in addition to performing the function of upgrade,

also intelligently handles changing dependencies with new versions

of packages; apt-get has a "smart" conflict resolution system, and

it will attempt to upgrade the most important packages at the

expense of less important ones if necessary. So, dist-upgrade

command may remove some packages. The /etc/apt/sources.list file

contains a list of locations from which to retrieve desired package

files. See also apt_preferences(5) for a mechanism for overriding

the general settings for individual packages.

In your particular case, I see, for example, that linux-headers is a virtual package that is provided by both linux-headers-3.0.0-12 and linux-headers-3.0.0-13 and that sounds like the kind of package installation and removal handled by dist-upgrade, but not by upgrade.

Answer by pablomme

apt-get upgrade is restricted to the case where packages are to be replaced by newer versions, but no package needs to be added or removed. A new version of Firefox, for instance, should be installable with apt-get upgrade.

However apt-get upgrade will refuse to work when there are additions or removals required by the updated versions. For example, when you have kernel linux-image-3.2.0-10-generic installed and linux-image-3.2.0-11-genericappears, the linux-image-generic package gets updated to depend on the newer version. In order to install the new kernel, you need to run apt-get dist-upgrade.

Notice how an apt-get upgrade will say that the kernel packages have been held back. That's the cue for using apt-get dist-upgrade.

Answer by psusi

Basically upgrade will only upgrade existing packages from one version to another. It will not install or remove packages, even if doing so is required to upgrade others. In the case of kernel updates, upgrading the linux-generic package requires installing the new linux-3.0.0-13-generic package, and since upgrade refuses to install or remove packages, it refuses to upgrade linux-generic.

Sometimes various incompatibilities between packages will require some packages to be removed in order to upgrade others, and that will also require dist-upgrade. Kernel updates will always require dist-upgrade because of how they are handled. Rather than have a kernel package that gets updated, an entirely new kernel package is created each time, and the kernel metapackage is updated to depend on the new kernel package instead of the old. This was done so that you keep the old kernel versions around so that in case there is a problem with booting the new kernel, you can choose the old one from the boot menu and recover.

Tags: apt (Next Q), upgrade (Next Q)

Q: What is the difference between apt-get update and upgrade?

Tags: apt (Next Q)

What is the difference between apt-get update and apt-get upgrade?

Which should I run first?

Do any of them automatically run the other?

Tags: apt (Next Q)

User: tom-brito

Answer by timo-kluck

You should first run update, then upgrade. Neither of them automatically runs the other.

  • apt-get update updates the list of available packages and their versions, but it does not install or upgrade any packages.
  • apt-get upgrade actually installs newer versions of the packages you have. After updating the lists, the package manager knows about available updates for the software you have installed. This is why you first want to update.

Tags: apt (Next Q)

Q: How to Downgrade a Package via apt-get?

Tags: apt packages (Next Q)

How to downgrade a package to an older version via apt-get?!

Another tools are also accepted but apt-get is preferred.

Tags: apt packages (Next Q)

User: user61928

Answer by mahesh

If you have the version number, or the target release, apt-get supports choosing a particular version or target release. More details can be found on manual page of apt-get. It can also be accessed from terminal by typing man apt-get

sudo apt-get install <package-name>=<package-version-number> OR

sudo apt-get -t=<target release> install <package-name>

is the command to be run. This can be used to down-grade a package to a specific version.

Answer by user91632

USE

apt-get install pkg=version

OR

sudo aptitude install pkg=version.

Tags: apt packages (Next Q)

Q: How can PPAs be removed?

Q: How can I see all versions of a package that are available in the archive?

Q: "The following packages have been kept back:" Why and how do I solve it?

Q: Is aptitude still considered superior to apt-get?

Q: What is the easiest way to resolve apt-get BADSIG GPG errors?

Q: How do I fix the GPG error "NO_PUBKEY"?

Q: How can I accept the Microsoft EULA agreement for ttf-mscorefonts-installer?

Q: How to list all installed packages?

Q: How do I get the source code of packages installed through apt-get?

Q: How do I fix a "Problem with MergeList" or "status file could not be parsed" error when trying to do an update?

Q: How can I get apt to use a mirror close to me, or choose a faster mirror?

Q: How do you select the fastest mirror from the command line?

Q: How to upgrade a single package using apt-get?

Q: What is "dist-upgrade" and why does it upgrade more than "upgrade"?

Q: What is the difference between apt-get update and upgrade?

Q: How to Downgrade a Package via apt-get?

Q: How do I resolve unmet dependencies?

Q: What does "sudo apt-get update" do?

Q: Installed Teamviewer using a 64-bits system, but I get a dependency error