Let's say I have a package A which has Depends: B (>= 1.0.0) in its control file.

The B was installed as an A dependency some time ago with 1.0.0 version.

Now B was updated in the repository to the 1.0.42 version and I'd like to upgrade it.

What I don't like to do: apt-get install B since it will mark B as "manually installed" (not sure how to name it correctly) package and it won't be removed with autoremove if I decide to stop using A ever.

So is there an analogue of apt-get upgrade that only upgrades a particular package and its dependencies (probably recursive, it doesn't matter in my case since B doesn't depend on anything else) only?

PS: I'm asking about currently available LTS versions. So 10.04 and 12.04

  • 1
    apt-get install --only-upgrade might pass muster.. but I'm not sure. – Seth Nov 7 '13 at 22:12
  • @Seth: Hm, I don't see such an option in man – zerkms Nov 7 '13 at 22:16
  • 1
    Which Ubuntu version? In 13.04 at least, don't remember for earlier versions, using apt-get install B to upgrade the package should not mark it as manually installed. As long as there is a new version for it in the repo after you apt-get update – Dan Nov 7 '13 at 22:19
  • @Dan: LTS ones, sorry I didn't mention that originally – zerkms Nov 7 '13 at 22:22
  • @Dan: just checked it - installing a package explicitly with apt-get install *does mark a package as installed manually. Checked it in 12.04 using apt-mark showauto. It can be fixed with apt-mark though – zerkms Nov 7 '13 at 22:25

Well, if there won't be another answer - here is one way of doing that:

Just install it with apt-get install B explicitly, then mark it as auto installed using apt-mark markauto B


Being specific to your question, I'd do:

  • apt-get update to resynchronize the package index files from their sources.
  • apt-get install B will install the latest version.
  • apt-mark auto B to mark it automatically installed

To upgrade a particular package:

  • apt-get update
  • apt-get install <package_name> this installs the updated package... there... the package is upgraded unlike apt-get upgrade which would upgrade all upgradable packages.

In case you want particular version of a package you'd do:

  • apt-get <package_name>=<verson> or apt-get -t <version> <package_name>

With apt-get -t <version> <package_name>, you could specify target-release as -t '2.1*', -t unstable or -t sid.

If you want a list of available versions:

  • apt-cache showpkg <package_name>
  • I'm not sure you understand the question correctly. – zerkms Nov 9 '13 at 6:18
  • If you're concerned with removing orphaned dependencies/packages you might want to try debfoster, gtkorphan in case you haven't already. – precise Nov 10 '13 at 5:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.