36

Is there an equivalent to doing aptitude safe-upgrade using apt-get?

2
  • My first thoughts came to dist-upgrade, but I don't think that's actually the same thing as safe-upgrade. Mar 29, 2012 at 16:55
  • 1
    there is not. aptitude exists to provide stuff not in apt-* Mar 29, 2012 at 17:11

4 Answers 4

46

The apt-get command closer to aptitude safe-upgrade is upgrade, but there is a difference.

aptitude safe-upgrade upgrades currently installed packages and can install new packages to resolve new dependencies, but never removes packages.

apt-get upgrade upgrades currently installed packages, but never installs or removes packages.

So apt-get upgrade is comparable to aptitude --no-new-installs safe-upgrade.

1
  • apt-get upgrade does not resolve held packages. aptitude safe-upgrade does. So far I haven't found any apt to replace it
    – acgbox
    Jan 26 at 13:15
6

To be a bit more precise on package removal:

man aptitude says:

-safe-upgrade ... Installed packages will not be removed unless they are unused ...

whereas man apt-get says:

-upgrade ...under no circumstances are currently installed packages removed ...

5

I think that the equivalent would be:

apt-get --with-new-pkgs upgrade

And the key is that --with-new-pkgs allow installing new packages when used in conjunction with upgrade so it basically do the same thing than aptitude safe-upgrad, install upgrades and new packages that are needed by this updates.

3

Combining PhoenixS's command and Roland Becker's comment about removal of unused packages (and double checking all this in the man pages of aptitude and apt-get), it would appear that the command using apt-get that completely mimics the behvaiour of aptitude safe-upgrade is

apt-get upgrade --with-new-pkgs --autoremove

This has been tested once on Ubuntu 16.04, and it at least ran, removing some packages and upgrading some other packages, but not installing any new packages (guess it was not necessary in that context)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .