apt pede para atualizar o mesmo pacote várias vezes

1

Estou usando um script de shell para manter um dos meus servidores atualizado com os pacotes mais recentes. O script é executado a cada 3 horas pelo cron job e depois envia o resultado por e-mail para mim.
Aqui está o script:

#!/bin/sh
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DATE='date +%F_%H:%M'
DOY='date +%j'
FILENAME=$DATE"_Upgrade_results.log"
FILENAME=${FILENAME// /_}
FILEPATH="/Custom/logs/upgrade/$FILENAME"
apt-key update
apt-get update 
apt-get dist-upgrade -y  >"$FILEPATH"
#Mailing section removed to prevent exposing api keys. (I'm using mailgun)

Às vezes, recebo isso no meu e-mail:

Reading package lists...
Building dependency tree...
Reading state information...
The following package was automatically installed and is no longer required:
  python-support
Use 'apt-get autoremove' to remove it.
The following packages will be REMOVED:
  mysql-client-5.5 mysql-server-5.5 mysql-server-core-5.5 The following NEW packages will be installed:
  libseccomp2 mysql-client-5.6 mysql-client-core-5.6 mysql-server-5.6
  mysql-server-core-5.6 python-funcsigs python-pbr The following packages have been kept back:
  rsyslog
The following packages will be upgraded:
  e2fslibs e2fsprogs ifupdown libsystemd0 libudev1 manpages mysql-common
  mysql-server python-mock python-ndg-httpsclient python-requests python-six
  python-urllib3 systemd systemd-sysv udev
16 upgraded, 7 newly installed, 3 to remove and 1 not upgraded.
Need to get 26.9 MB/27.1 MB of archives.
After this operation, 59.2 MB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  e2fslibs e2fsprogs mysql-server mysql-client-core-5.6 mysql-common
  mysql-client-5.6 mysql-server-core-5.6 mysql-server-5.6 libseccomp2
  libsystemd0 libudev1 udev systemd ifupdown systemd-sysv manpages
  python-funcsigs python-ndg-httpsclient python-six python-pbr python-urllib3
  python-requests python-mock

Na próxima vez que o script for executado, a saída estará limpa:

Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

O problema é que eu recebo essa parte de novo e de novo e de novo em dias diferentes:

The following packages will be upgraded:
  e2fslibs e2fsprogs ifupdown libsystemd0 libudev1 manpages mysql-common
  mysql-server python-mock python-ndg-httpsclient python-requests python-six
  python-urllib3 systemd systemd-sysv udev
16 upgraded, 7 newly installed, 3 to remove and 1 not upgraded.
Need to get 26.9 MB/27.1 MB of archives.
After this operation, 59.2 MB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  e2fslibs e2fsprogs mysql-server mysql-client-core-5.6 mysql-common
  mysql-client-5.6 mysql-server-core-5.6 mysql-server-5.6 libseccomp2
  libsystemd0 libudev1 udev systemd ifupdown systemd-sysv manpages
  python-funcsigs python-ndg-httpsclient python-six python-pbr python-urllib3
  python-requests python-mock

Parece que esses pacotes não foram atualizados, MAS quando executo apt-get update && apt-get dist-upgrade manualmente através do console, recebo 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. .
Eu ficaria grato se alguém pudesse explicar por que isso está acontecendo?
PS: A minha pergunta é diferente desta uma

    
por Sam 11.10.2016 / 09:23

1 resposta

1

Você estava usando a opção apt-get de -y . Na página de manual apt-get , isso foi escrito sobre -y option

-y, --yes, --assume-yes
           Automatic yes to prompts; assume "yes" as answer to all prompts and run non-interactively. If an undesirable situation, such as changing
           a held package, trying to install a unauthenticated package or removing an essential package occurs then apt-get will abort.
           Configuration Item: APT::Get::Assume-Yes.

De sua saída, está claro que alguns pacotes não são autenticados e, portanto, apt-get abortando a operação. Como está abortando, você está recebendo a mesma saída várias vezes.

Para forçar o apt-get a instalar silenciosamente o pacote não autenticado, você precisa usar a opção --allow-unauthenticated com a opção -y existente. Da página de manual, é

--allow-unauthenticated
       Ignore if packages can't be authenticated and don't prompt about it. This can be useful while working with local repositories, but is a
       huge security risk if data authenticity isn't ensured in another way by the user itself. The usage of the Trusted option for
       sources.list(5) entries should usually be preferred over this global override. Configuration Item: APT::Get::AllowUnauthenticated.
    
por Anwar 11.10.2016 / 09:29