Как переустановить пакет APT [дубликат]

Как переустановить APT-пакет

Всем привет.

Чтобы устранить мою старую проблему, я удалил пакет apt. Теперь новая проблема выглядит следующим образом. чтобы сослаться на мою предыдущую проблему, пожалуйста, обратитесь по этой ссылке:

SyntaxError при настройке python3-aptdaemon

$sudo apt-get update
sudo: apt-get: command not found

ariel@ariel:~$ sudo dpkg -install apt
dpkg: error: unknown option -n

Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' or 'aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;

Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !

ariel@ariel:~$ sudo dpkg -install apt-get
dpkg: error: unknown option -n

Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' or 'aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;

Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !

ariel@ariel:~$ sudo dpkg -i *

dpkg: error: archive 'Desktop' is not a regular file

ariel@ariel:~$ sudo dpkg -i *

dpkg: error: archive 'Desktop' is not a regular file

ariel@ariel:~$ wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.0.1ubuntu2.17_amd64.deb -O apt.deb
--2019-08-11 21:04:37--  http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.0.1ubuntu2.17_amd64.deb
Resolving security.ubuntu.com (security.ubuntu.com)... 91.189.88.24, 91.189.91.26, 91.189.91.23, ...
Connecting to security.ubuntu.com (security.ubuntu.com)|91.189.88.24|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-08-11 21:04:38 ERROR 404: Not Found.

ariel@ariel:~$ sudo dpkg -i apt.deb

dpkg-deb: error: 'apt.deb' is not a Debian format archive

dpkg: error processing archive apt.deb (--install):
 dpkg-deb --control subprocess returned error exit status 2

Errors were encountered while processing:
 apt.deb

ariel@ariel:~$ pkexec dpkg -i apt.deb

dpkg: error: cannot access archive 'apt.deb': No such file or directory

ariel@ariel:~$ 

после 1-го решения N0rbert:

$ sudo apt-get update

apt-get: error while loading shared libraries: libapt-pkg.so.5.0: cannot open shared object file: No such file or directory

ariel@ariel:~/Downloads$ sudo apt install --reinstall apt-utils ubuntu-minimal ub

apt: error while loading shared libraries: libapt-pkg.so.5.0: cannot open shared object file: No such file or directory

ariel@ariel:~/Downloads$ sudo apt update

apt: error while loading shared libraries: libapt-pkg.so.5.0: cannot open shared object file: No such file or directory

после 2-го решения:

$lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:    18.04
Codename:   bionic

спасибо, ребята, это сработало после установки файла библиотеки, но давая еще две ошибки. но я не понимаю этого и его важности. Пожалуйста, предложите, если вы в курсе. есть ли какое-либо решение для этой новой ошибки ??

$ wget http://mirrors.kernel.org/ubuntu/pool/main/a/apt/libapt-pkg5.0_1.6.11_amd64.deb

--2019-08-11 23:37:16--  http://mirrors.kernel.org/ubuntu/pool/main/a/apt/libapt-pkg5.0_1.6.11_amd64.deb
Resolving mirrors.kernel.org (mirrors.kernel.org)... 198.145.21.9, 2001:19d0:306:6:0:1994:3:14
Connecting to mirrors.kernel.org (mirrors.kernel.org)|198.145.21.9|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://mirrors.edge.kernel.org/ubuntu/pool/main/a/apt/libapt-pkg5.0_1.6.11_amd64.deb [following]
--2019-08-11 23:37:17--  http://mirrors.edge.kernel.org/ubuntu/pool/main/a/apt/libapt-pkg5.0_1.6.11_amd64.deb
Resolving mirrors.edge.kernel.org (mirrors.edge.kernel.org)... 147.75.95.133, 2604:1380:3000:1500::1
Connecting to mirrors.edge.kernel.org (mirrors.edge.kernel.org)|147.75.95.133|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 806284 (787K) [application/octet-stream]
Saving to: ‘libapt-pkg5.0_1.6.11_amd64.deb’

libapt-pkg5.0_1.6.11_amd64.deb      100%[=================================================================>] 787.39K  20.3KB/s    in 43s     

2019-08-11 23:38:01 (18.4 KB/s) - ‘libapt-pkg5.0_1.6.11_amd64.deb’ saved [806284/806284]

$ sudo dpkg -i libapt-pkg5.0_1.6.11_amd64.deb

Selecting previously unselected package libapt-pkg5.0:amd64.
(Reading database ... 182918 files and directories currently installed.)
Preparing to unpack libapt-pkg5.0_1.6.11_amd64.deb ...
Unpacking libapt-pkg5.0:amd64 (1.6.11) ...
Setting up libapt-pkg5.0:amd64 (1.6.11) ...
Processing triggers for libc-bin (2.28-10) ...

$ sudo apt update

Hit:1 http://in.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]                                                                 
Get:3 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]                                                               
Hit:4 http://ppa.launchpad.net/diesch/testing/ubuntu bionic InRelease                                    
Get:5 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [282 kB]        
Get:6 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]                                     
Ign:7 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic InRelease                                                      
Get:8 http://in.archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 48x48 Icons [66.7 kB]                                                   
Get:9 http://in.archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 64x64 Icons [138 kB]                                                    
Get:10 http://in.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [252 kB]                                            
Err:11 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release                                                       
  404  Not Found [IP: 91.189.95.83 80]
Get:12 http://in.archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 48x48 Icons [197 kB]    
Get:13 http://in.archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 64x64 Icons [438 kB]         
Get:14 http://in.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:15 http://in.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [7,700 B]
Get:16 http://security.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [22.7 kB] 
Get:17 http://security.ubuntu.com/ubuntu bionic-security/main DEP-11 48x48 Icons [10.4 kB]                             
Get:18 http://security.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons [31.7 kB]
Get:19 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [42.1 kB]
Get:20 http://security.ubuntu.com/ubuntu bionic-security/universe DEP-11 48x48 Icons [16.4 kB]
Get:21 http://security.ubuntu.com/ubuntu bionic-security/universe DEP-11 64x64 Icons [116 kB]
Get:22 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]

(appstreamcli:6798): GLib-CRITICAL **: 23:39:19.478: g_atomic_ref_count_dec: assertion 'g_atomic_int_get (arc) > 0' failed
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

4-е решение для исправления последней ошибки:

$ sudo add-apt-repository -r ppa:ubuntu-wine/ppa

sudo: add-apt-repository: command not found

5-е решение:

$ sudo apt-get install software-properties-common

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 software-properties-common : Depends: python3-software-properties (= 0.96.24.32.9) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

$ sudo add-apt-repository -r ppa:ubuntu-wine/ppa

sudo: add-apt-repository: command not found

Решение 6-е:

Я выполнил команду $ sudo apt-get upgrade который выполнен успешно без возврата ошибки. затем я выполнил команду ниже, которая возвращает ту же ошибку. следовательно, я перезапускаю систему и снова запускаю команду ниже, которая возвращает ту же ошибку.

$ sudo apt-get install software-properties-common

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 software-properties-common : Depends: python3-software-properties (= 0.96.24.32.9) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

$ sudo add-apt-repository -r ppa:ubuntu-wine/ppa

sudo: add-apt-repository: command not found

поскольку он демонстрирует некоторую зависимость свойств программного обеспечения Python 3, я подозреваю, что это связано с проблемой, по которой я поднимал вопрос ранее (ссылка на синтаксическую ошибку при настройке python3-aptdeamon), не так ли?


7-е решение:

после запуска команды в поле комментариев вывод выглядит следующим образом:

$ grep -r ubuntu-wine /etc/apt --include="*.list"
/etc/apt/sources.list.d/ubuntu-wine-ubuntu-ppa-bionic.list:deb http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic main
/etc/apt/sources.list.d/ubuntu-wine-ubuntu-ppa-bionic.list:# deb-src http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic main
/etc/apt/sources.list.d/ubuntu-wine-ubuntu-ppa-bionic.list:# deb-src http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic main

решение № 8:

без перезапуска sudo apt-get dist-upgrade выполнено успешно. но sudo apt-get update возвращает ошибку ниже.

$ sudo apt-get update

Hit:1 http://in.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]                                                                 
Hit:3 http://ppa.launchpad.net/diesch/testing/ubuntu bionic InRelease                                                                        
Get:4 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]                                                         
Ign:6 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic InRelease                              
Get:7 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [282 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 48x48 Icons [66.7 kB]                                                   
Get:9 http://in.archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 64x64 Icons [134 kB]                                   
Err:10 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release                                                      
  404  Not Found [IP: 91.189.95.83 80]
Get:11 http://in.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [252 kB]                          
Get:12 http://in.archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 48x48 Icons [195 kB]        
Get:13 http://in.archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 64x64 Icons [437 kB]       
Get:14 http://in.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,468 B]
Get:15 http://in.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [7,712 B]

(appstreamcli:3027): GLib-CRITICAL **: 00:51:25.846: g_atomic_ref_count_dec: assertion 'g_atomic_int_get (arc) > 0' failed
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

$ sudo apt-get dist-upgrade

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  docbook-xml librarian0 rarian-compat sgml-base sgml-data xml-core
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  linux-headers-5.0.0-23 linux-headers-5.0.0-23-generic linux-image-5.0.0-23-generic linux-modules-5.0.0-23-generic
  linux-modules-extra-5.0.0-23-generic
The following packages will be upgraded:
  linux-generic-hwe-18.04 linux-headers-generic-hwe-18.04 linux-image-generic-hwe-18.04
3 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 66.9 MB of archives.
After this operation, 330 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-modules-5.0.0-23-generic amd64 5.0.0-23.24~18.04.1 [13.6 MB]
Get:2 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-image-5.0.0-23-generic amd64 5.0.0-23.24~18.04.1 [8,356 kB]        
Get:3 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-modules-extra-5.0.0-23-generic amd64 5.0.0-23.24~18.04.1 [33.1 MB] 
Get:4 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-generic-hwe-18.04 amd64 5.0.0.23.80 [1,884 B]                      
Get:5 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-image-generic-hwe-18.04 amd64 5.0.0.23.80 [2,564 B]                
Get:6 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-headers-5.0.0-23 all 5.0.0-23.24~18.04.1 [10.7 MB]                 
Get:7 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-headers-5.0.0-23-generic amd64 5.0.0-23.24~18.04.1 [1,135 kB]      
Get:8 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-headers-generic-hwe-18.04 amd64 5.0.0.23.80 [2,524 B]              
Fetched 66.9 MB in 55s (1,214 kB/s)                                                                                                          
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package linux-modules-5.0.0-23-generic.
(Reading database ... 182970 files and directories currently installed.)
Preparing to unpack .../0-linux-modules-5.0.0-23-generic_5.0.0-23.24~18.04.1_amd64.deb ...
Unpacking linux-modules-5.0.0-23-generic (5.0.0-23.24~18.04.1) ...
Selecting previously unselected package linux-image-5.0.0-23-generic.
Preparing to unpack .../1-linux-image-5.0.0-23-generic_5.0.0-23.24~18.04.1_amd64.deb ...
Unpacking linux-image-5.0.0-23-generic (5.0.0-23.24~18.04.1) ...
Selecting previously unselected package linux-modules-extra-5.0.0-23-generic.
Preparing to unpack .../2-linux-modules-extra-5.0.0-23-generic_5.0.0-23.24~18.04.1_amd64.deb ...
Unpacking linux-modules-extra-5.0.0-23-generic (5.0.0-23.24~18.04.1) ...
Preparing to unpack .../3-linux-generic-hwe-18.04_5.0.0.23.80_amd64.deb ...
Unpacking linux-generic-hwe-18.04 (5.0.0.23.80) over (4.18.0.25.74) ...
Preparing to unpack .../4-linux-image-generic-hwe-18.04_5.0.0.23.80_amd64.deb ...
Unpacking linux-image-generic-hwe-18.04 (5.0.0.23.80) over (4.18.0.25.74) ...
Selecting previously unselected package linux-headers-5.0.0-23.
Preparing to unpack .../5-linux-headers-5.0.0-23_5.0.0-23.24~18.04.1_all.deb ...
Unpacking linux-headers-5.0.0-23 (5.0.0-23.24~18.04.1) ...
Selecting previously unselected package linux-headers-5.0.0-23-generic.
Preparing to unpack .../6-linux-headers-5.0.0-23-generic_5.0.0-23.24~18.04.1_amd64.deb ...
Unpacking linux-headers-5.0.0-23-generic (5.0.0-23.24~18.04.1) ...
Preparing to unpack .../7-linux-headers-generic-hwe-18.04_5.0.0.23.80_amd64.deb ...
Unpacking linux-headers-generic-hwe-18.04 (5.0.0.23.80) over (4.18.0.25.74) ...
Setting up linux-headers-5.0.0-23 (5.0.0-23.24~18.04.1) ...
Setting up linux-headers-5.0.0-23-generic (5.0.0-23.24~18.04.1) ...
Setting up linux-modules-5.0.0-23-generic (5.0.0-23.24~18.04.1) ...
Setting up linux-image-5.0.0-23-generic (5.0.0-23.24~18.04.1) ...
I: /vmlinuz.old is now a symlink to boot/vmlinuz-4.18.0-25-generic
I: /initrd.img.old is now a symlink to boot/initrd.img-4.18.0-25-generic
I: /vmlinuz is now a symlink to boot/vmlinuz-5.0.0-23-generic
I: /initrd.img is now a symlink to boot/initrd.img-5.0.0-23-generic
Setting up linux-headers-generic-hwe-18.04 (5.0.0.23.80) ...
Setting up linux-modules-extra-5.0.0-23-generic (5.0.0-23.24~18.04.1) ...
Setting up linux-image-generic-hwe-18.04 (5.0.0.23.80) ...
Setting up linux-generic-hwe-18.04 (5.0.0.23.80) ...
Processing triggers for linux-image-5.0.0-23-generic (5.0.0-23.24~18.04.1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.0.0-23-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.0.0-23-generic
Found initrd image: /boot/initrd.img-5.0.0-23-generic
Found linux image: /boot/vmlinuz-4.18.0-25-generic
Found initrd image: /boot/initrd.img-4.18.0-25-generic
Found linux image: /boot/vmlinuz-4.18.0-21-generic
Found initrd image: /boot/initrd.img-4.18.0-21-generic
Adding boot menu entry for EFI firmware configuration
done

раствор № 9:

винный ппа успешно удален.

$ sudo rm -v /etc/apt/sources.list.d/ubuntu-wine-ubuntu-ppa-bionic.list
removed '/etc/apt/sources.list.d/ubuntu-wine-ubuntu-ppa-bionic.list'

решение № 10: sudo apt update выполнено успешно, без возврата ошибки.

$sudo apt update

Hit:1 http://in.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease                                                                           
Hit:3 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease                                                                         
Hit:4 http://ppa.launchpad.net/diesch/testing/ubuntu bionic InRelease                                                           
Get:5 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]                            
Fetched 88.7 kB in 2s (40.2 kB/s)                             
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
1
задан 11 August 2019 в 22:46

1 ответ

Удостоверьтесь, что Ваше устройство подключено к Интернету и загрузке apt/apt-getупакуйте вручную и установите его на низком уровне:

cd ~/Downloads
wget http://mirrors.kernel.org/ubuntu/pool/main/a/apt/apt_1.6.11_amd64.deb
sudo dpkg -i apt_1.6.11_amd64.deb

переустановите пакет с libapt-pkg.so.5.0 библиотека:

wget http://mirrors.kernel.org/ubuntu/pool/main/a/apt/libapt-pkg5.0_1.6.11_amd64.deb
sudo dpkg -i libapt-pkg5.0_1.6.11_amd64.deb

и затем используйте APT, как обычно:

sudo apt-get update
sudo apt-get upgrade

Для фиксации последней ошибки с Вином PPA просто удаляют его с:

sudo rm /etc/apt/sources.list.d/ubuntu-wine-ubuntu-ppa-bionic.list

и затем установите все новые зависимости с

sudo apt-get update
sudo apt-get dist-upgrade
2
ответ дан 7 December 2019 в 13:15

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

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