I did some research on the man pages, in particular in man apt.conf
and man apt-get
, and found the following. Please comment if you think I forgot anything.
- use option
--only-upgrade
, or set the apt configuration item APT::Get::Only-Upgrade
to true
- apt configuration item
APT::Get::force-yes
set to false
- use option
--no-remove
, or set the apt configuration item APT::Get::Remove
to false
Not sure that --trivial-only
/APT::Get::Trivial-Only
helps here, needs to investigate it better.
With aptitude
, the relevant pieces seem to be:
- using the
safe-upgrade
command with the --no-new-installs
option
- set
Aptitude::Delete-Unused
to false, so that unused packages are not removed automatically (I may disagree with aptitude regarding what's unused...)
- adding
-R
/--without-recommends
may help, needs more investigation
Update
I did some tests on an old system:
# grep ^Ubuntu /etc/motd
Ubuntu 10.04.4 LTS
apt-get
looks more cautious, and the result doesn't differ between a normal apt-get upgrade
and apt-get -o APT::Get::Only-Upgrade=true --no-remove -o APT::Get::force-yes=false upgrade
.
aptitude
seems more aggressive, and the "safe options" seem to do their job. Standard upgrade (it actually runs safe-upgrade
)
# aptitude -s -y upgrade
W: The "upgrade" command is deprecated; use "safe-upgrade" instead.
Lettura elenco dei pacchetti... Fatto
Generazione albero delle dipendenze
Lettura informazioni sullo stato... Fatto
Reading extended state information
Initializing package states... Fatto
Resolving dependencies...
The following NEW packages will be installed:
linux-image-2.6.32-55-generic-pae{a}
The following packages will be upgraded:
linux-generic-pae linux-image-generic-pae linux-image-server linux-libc-dev linux-server
5 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/32.8MB of archives. After unpacking 98.2MB will be used.
Would download/install/remove packages.
Now with "safe" options:
# aptitude -s -y --no-new-installs -R -o Aptitude::Delete-Unused=false safe-upgrade
Lettura elenco dei pacchetti... Fatto
Generazione albero delle dipendenze
Lettura informazioni sullo stato... Fatto
Reading extended state information
Initializing package states... Fatto
Resolving dependencies...
The following packages have been kept back:
linux-generic-pae linux-image-generic-pae
The following packages will be upgraded:
linux-image-server linux-libc-dev linux-server
3 packages upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Need to get 0B/878kB of archives. After unpacking 0B will be used.
Would download/install/remove packages.
Much more similar to what I wanted.
Unfortunately, none of both sets seems to prevent new packages to be installed or other packages to be upgraded when used with the install
command instead of upgrade
/safe-upgrade
, so I am kind of back to square one: I can't get apt-get
/aptitude
to stop when it would do a potentially, paranoic-ally unsafe operation. In a sense, I have a better safety net, but I am not prevented to fall down.