apt-get update / upgrade list senza cambiare nulla


21

Vorrei visualizzare quali pacchetti sono disponibili per l'aggiornamento / l'aggiornamento senza effettivamente modificare alcun file perché ci sono alcuni pacchetti che non vorrei aggiornare. Sarebbe quindi possibile apt-get update con eccezioni.


apt deve conoscere gli aggiornamenti disponibili tramite apt-get updatee ciò cambierà alcune cose. Grande domanda però ...
ho

Risposte:


9

Io uso apt list --upgradable.
La prossima alternativa è apt-get --simulate upgrade. (basato su @EightBitTony)
Ecco gli output di diverse opzioni (spero che aiuti qualcuno):

me@machine:~$ apt list --upgradable
    Listing... Done
    kubernetes-cni/kubernetes-xenial 0.7.5-00 amd64 [upgradable from: 0.6.0-00]
    N: There are 3 additional versions. Please use the '-a' switch to see them.
me@machine:~$ apt-get --simulate upgrade
    NOTE: This is only a simulation!
          apt-get needs root privileges for real execution.
          Keep also in mind that locking is deactivated,
          so don't depend on the relevance to the real current situation!
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Calculating upgrade... Done
    The following packages will be upgraded:
      kubernetes-cni
    1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Inst kubernetes-cni [0.6.0-00] (0.7.5-00 kubernetes-xenial:kubernetes-xenial [amd64])
    Conf kubernetes-cni (0.7.5-00 kubernetes-xenial:kubernetes-xenial [amd64])
me@machine:~$ apt-get -u upgrade --assume-no
    E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
    E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
me@machine:~$ sudo apt-get -u upgrade --assume-no
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Calculating upgrade... Done
    The following packages will be upgraded:
      kubernetes-cni
    1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Need to get 6,473 kB of archives.
    After this operation, 4,278 kB of additional disk space will be used.
    Do you want to continue? [Y/n] N
    Abort.
me@machine:~$ sudo apt-get -u -V upgrade
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Calculating upgrade... Done
    The following packages will be upgraded:
       kubernetes-cni (0.6.0-00 => 0.7.5-00)
    1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Need to get 6,473 kB of archives.
    After this operation, 4,278 kB of additional disk space will be used.
    Do you want to continue? [Y/n] n
    Abort.

Benvenuto a bordo.
bvj

32

Dalla pagina man apt-get,

   -s, --simulate, --just-print, --dry-run, --recon, --no-act
       No action; perform a simulation of events that would occur
       but do not actually change the system. Configuration Item:
       APT::Get::Simulate.

       Simulation run as user will deactivate locking (Debug::NoLocking)
       automatic. Also a notice will be displayed indicating that this
       is only a simulation, if the option APT::Get::Show-User-Simulation-Note
       is set (Default: true). Neither NoLocking nor the notice will be
       triggered if run as root (root should know what he is doing without
       further warnings by apt-get).

       Simulate prints out a series of lines each one representing a
       dpkg operation, Configure (Conf), Remove (Remv), Unpack (Inst).
       Square brackets indicate broken packages and empty set of square
       brackets meaning breaks that are of no consequence (rare).

Quindi assicurati di te apt-get -s upgrade.

Se vuoi aggiornare determinati pacchetti, basta apt-get install <package name>e lo aggiornerà se è già installato. Dovrà tuttavia anche aggiornare tutte le dipendenze e, a seconda di ciò che sono, possono arrivare a molti aggiornamenti.

Se sono indietro sugli aggiornamenti dei pacchetti, ne farò uno apt-get installsu alcuni di quelli più grandi (forse php, apache2, ecc.) In modo da poterli contenere e controllare eventuali problemi, e apt-get upgradedopo aver finito.


8

Per elencare i pacchetti da aggiornare con le loro versioni:

$ sudo apt-get -u -V upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages have been kept back:
   mysql-client-5.5 (5.5.29-0ubuntu0.12.04.2 => 5.5.32-0ubuntu0.12.04.1)
   mysql-server-5.5 (5.5.29-0ubuntu0.12.04.2 => 5.5.32-0ubuntu0.12.04.1)
   mysql-server-core-5.5 (5.5.29-0ubuntu0.12.04.2 => 5.5.32-0ubuntu0.12.04.1)
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

Quindi, puoi scegliere cosa aggiornare:

$ sudo apt-get --only-upgrade install mysql-client-5.5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
firefox-globalmenu
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libterm-readkey-perl
The following NEW packages will be installed:
libterm-readkey-perl
The following packages will be upgraded:
mysql-client-5.5
1 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 8,123 kB of archives.
After this operation, 139 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/main libterm-readkey-perl i386 2.30-4build3 [28.4 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main mysql-client-5.5 i386 5.5.32-0ubuntu0.12.04.1 [8,094 kB]
...

Se ci sono vecchie dipendenze che vengono rimosse, è quindi possibile eseguire apt-get autoremovee, come si può vedere, verrà richiesta l'installazione di eventuali nuove dipendenze. Il --only-upgradeflag non è necessario, ma è carino se vuoi assicurarti di non installare accidentalmente un nuovo pacchetto invece di aggiornarne uno esistente, ovvero hai uno di quei momenti e digita accidentalmente il pacchetto sbagliato:

$ sudo apt-get --only-upgrade install mysql-proxy
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Skipping mysql-proxy, it is not installed and only upgrades are requested.
The following package was automatically installed and is no longer required:
firefox-globalmenu
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

1

Ti aiuta a emettere apt-get -s upgradeche fa solo una simulazione? E poi puoi aggiornare ogni pacchetto desiderato con apt-get install <thepackage>.

Se lo desideri interattivo con una bella interfaccia grafica CLI, usa aptitude. Se non è ancora installato, installalo con apt-get install aptitude.

Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.