Не удается обновить программное обеспечение в Ubuntu 16.04.2 LTS (GNU / Linux 4.4.0-1087-aws x86_64) из-за проблем с зависимостями

Я использую Ubuntu 16.04.2 LTS (GNU / Linux 4.4.0-1087-aws x86_64) на экземпляре AWS EC2 t3a.nano. Когда я получил доступ к своему ящику через SSH, я вижу это:

Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-1087-aws x86_64)

 * Documentation:  [redacted]
 * Management:     [redacted]
 * Support:        [redacted]

  Get cloud support with Ubuntu Advantage Cloud Guest:
    [redacted]

132 packages can be updated.
3 updates are security updates.

Желая обновлять программное обеспечение на моем ящике, я запустил:

sudo apt-get update
Hit:1 [redacted] xenial InRelease
Hit:2 [redacted] xenial-updates InRelease
Hit:3 http://us-east-2.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu xenial-security InRelease              
Reading package lists... Done

Затем я вошел :

sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
E: Unmet dependencies. Try using -f.

Хорошо, я вижу, что у меня есть проблемы с зависимостями, поэтому я пытаюсь:

sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  bzip2 libbz2-1.0
Suggested packages:
  bzip2-doc
The following packages will be upgraded:
  bzip2 libbz2-1.0
2 upgraded, 0 newly installed, 0 to remove and 126 not upgraded.
1 not fully installed or removed.
Need to get 63.2 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 [redacted] xenial-updates/main amd64 bzip2 amd64 1.0.6-8ubuntu0.2 [32.5 kB]
Get:2 [redacted] xenial-updates/main amd64 libbz2-1.0 amd64 1.0.6-8ubuntu0.2 [30.7 kB]
Fetched 63.2 kB in 0s (3,126 kB/s)    
Selecting previously unselected package bzip2.
E: Sub-process /usr/bin/dpkg exited unexpectedly

Теперь, когда я вижу, что dpkg неожиданно завершил работу, я пытаюсь:

sudo dpkg --audit
The following packages are in a mess due to serious problems during
installation.  They must be reinstalled for them (and any packages
that depend on them) to function properly:
 bzip2                high-quality block-sorting file compressor - utilities

Я пытаюсь:

sudo apt-get install bzip2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 bzip2 : Depends: libbz2-1.0 (= 1.0.6-8ubuntu0.2) but 1.0.6-8ubuntu0.1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Так что теперь я пытаюсь:

sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  bzip2 libbz2-1.0
Suggested packages:
  bzip2-doc
The following packages will be upgraded:
  bzip2 libbz2-1.0
2 upgraded, 0 newly installed, 0 to remove and 126 not upgraded.
1 not fully installed or removed.
Need to get 0 B/63.2 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Selecting previously unselected package bzip2.
E: Sub-process /usr/bin/dpkg exited unexpectedly

Теперь я иду по кругу. Любые идеи?


Изменить адрес комментария от @fkraiem: Когда я захожу в /etc/apt/sources.list, я вижу:

## Note, this file is written by cloud-init on first boot of an instance
## modifications made here will not survive a re-bundle.
## if you wish to make changes you can:
## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
##     or do the same in user-data
## b.) add sources in /etc/apt/sources.list.d
## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ xenial main restricted
deb-src http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb-src http://us-east-2.ec2.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
[...]

Вы предлагаете мне заменить us-east-2.ec2.archive.ubuntu.com на packages.ubuntu.com и повторить команды обновления?

0
задан 8 July 2019 в 00:11

1 ответ

Спасибо всем, которые предложили комментарии и попытались помочь.

В конце однажды я сделал:

sudo apt-get -f install

и замеченный ошибка о недостаточно памяти. Я использовал t3a.nano, который только предлагает 0.5G памяти. Я пытался добавить 0.5G подкачки, затем работал sudo dpkg --configure -a и попробованный обновления снова и теперь все находится в первоклассной форме.

Для любого смотрящего это, которое могло бы также использовать нано экземпляр, 0.5G, не является большой памятью, таким образом, можно хотеть полагать, что добавляющая подкачка предотвращает эти виды проблем. Вот то, как я сделал это:

sudo fallocate -l 0.5G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
0
ответ дан 24 October 2019 в 00:40

Другие вопросы по тегам:

Похожие вопросы: