web-dev-qa-db-ja.com

aptアップグレード:操作の実行に失敗しました:そのようなファイルまたはディレクトリはありません

14.04から16.04にアップグレードした後、apt-getがxenialシステムで何らかの形で台無しになり、修正方法がわかりません。これは私が得るものです(apt updateの後)。
誰でもこれを修正する方法についてアドバイスできますか?

$ Sudo apt 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:
  libsimgearcore3.4.0v5 libsimgearscene3.4.0v5 linux-headers-4.4.0-97 linux-headers-4.4.0-97-generic linux-image-4.4.0-97-generic linux-image-extra-4.4.0-97-generic
Use 'Sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Setting up snapd (2.28.5~14.04) ...
Failed to execute operation: No such file or directory
dpkg: error processing package snapd (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 snapd
E: Sub-process /usr/bin/dpkg returned an error code (1)

また、apt -f installを実行しようとしましたが、次のものがあります。

$ Sudo apt -f install
[Sudo] password for ron: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libsimgearcore3.4.0v5 libsimgearscene3.4.0v5 linux-headers-4.4.0-97 linux-headers-4.4.0-97-generic linux-image-4.4.0-97-generic linux-image-extra-4.4.0-97-generic
Use 'Sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up snapd (2.28.5~14.04) ...
Failed to execute operation: No such file or directory
dpkg: error processing package snapd (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 snapd
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ Sudo dpkdg --configure -aは以下を提供します:

$ Sudo dpkg --configure -a
Setting up snapd (2.28.5~14.04) ...
Failed to execute operation: No such file or directory
dpkg: error processing package snapd (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 snapd

Sudo apt-get --remove purge snapdが返す場所:

$ Sudo apt-get --remove purge snapd
[Sudo] password for ron: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  cgroup-lite libsimgearcore3.4.0v5 libsimgearscene3.4.0v5 linux-generic-lts-xenial linux-headers-4.4.0-97 linux-headers-4.4.0-97-generic linux-image-4.4.0-97-generic
  linux-image-extra-4.4.0-97-generic squashfs-tools
Use 'Sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  snapd*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 74.5 MB disk space will be freed.
Do you want to continue? [Y/n] 
(Reading database ... 661915 files and directories currently installed.)
Removing snapd (2.28.5~14.04) ...
Failed to stop snapd.autoimport.service: Unit snapd.autoimport.service not loaded.
Failed to stop snapd.socket: Unit snapd.socket not loaded.
Failed to stop snapd.service: Unit snapd.service not loaded.
dpkg: error processing package snapd (--purge):
 subprocess installed pre-removal script returned error exit status 5
Errors were encountered while processing:
 snapd
Sudo aE: Sub-process /usr/bin/dpkg returned an error code (1)
1
stdcerr

この回答 @vskubrievによる削除を強制するキーを保持する場合があります。

基本的に:
シバンの後にexit 0/var/lib/dpkg/info/snapd.prermに追加します。次に、次のコマンドを実行します。

dpkg --purge --force-all snapd
apt-get update

オプションでapt-get install snapdを実行して再インストールします

@vskubrievの答えが、ここではなく、それを支持するのに役立つなら。

2
J. Starnes

Snapdがインストールされた14.04から16.04にアップグレードしたように見えますが、何らかの理由でsnapdパッケージが置き換えられず、この問題が発生した場合は、次を実行してパッケージを削除できます。

#:Sudo rm /var/lib/dpkg/info/snapd.p*rm
#:Sudo apt-get remove --purge snapd 

これにより、事前/事後削除スクリプトが削除され、スクリプトが失敗したときにパッケージを削除できるようになります。 snapdが必要な場合(以前にいくつかのスナップをインストールしたためなど)、次のコマンドを実行できます。

#:Sudo apt update 
#:Sudo apt install snapd 
0
dobey