lista apt-get update / upgrade sem alterar nada

21

Gostaria de ver quais pacotes estão disponíveis para atualização / atualização sem realmente alterar os arquivos, pois existem alguns pacotes que não gostaria de atualizar. Seria então possível o apt-get update com exceções.

John Magnolia
fonte
O apt precisa conhecer as atualizações disponíveis via apt-get updatee isso mudará algumas coisas. Grande questão embora ... encontrei informações relacionadas aqui
bvj 14/04

Respostas:

9

Eu uso apt list --upgradable.
A próxima alternativa é apt-get --simulate upgrade. (com base em @EightBitTony)
Aqui estão resultados de diferentes opções (espero que ajude alguém):

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.
Emeka-NMC
fonte
Bem vindo a bordo.
bvj 14/04
32

Na página do manual 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).

Então, apenas tenha certeza apt-get -s upgrade.

Se você deseja atualizar certos pacotes, apenas apt-get install <package name>e ele será atualizado se já estiver instalado. No entanto, também será necessário atualizar todas as dependências e, dependendo do que elas são, que podem se transformar em muitas atualizações.

Se eu estiver atrasado nas atualizações de pacotes, farei apt-get installalgumas das grandes (talvez php, apache2 etc.) para mantê-las contidas e verificar quaisquer problemas, e apt-get upgradedepois que terminar.

EightBitTony
fonte
8

Para listar os pacotes a serem atualizados com suas versões:

$ 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.

Em seguida, você pode escolher o que atualizar:

$ 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 houver alguma dependência antiga removida, você poderá executar apt-get autoremovee, como pode ver, será solicitado que novas dependências sejam instaladas. O --only-upgradesinalizador não é necessário, mas agradável se você deseja garantir que não instala acidentalmente um novo pacote em vez de atualizar um pacote existente, ou seja, você tem um desses momentos e digita acidentalmente o pacote errado:

$ 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.
josephdpurcell
fonte
1

Ajuda você a emitir o apt-get -s upgradeque faz apenas uma simulação? E então você pode atualizar cada pacote desejado com apt-get install <thepackage>.

Se você quer isso interativo com uma boa interface gráfica do usuário, use aptitude. Se ainda não estiver instalado, instale-o com apt-get install aptitude.

mailq
fonte