apt-get がインストールされているパッケージをインストールし続けます。

apt-get がインストールされているパッケージをインストールし続けます。

私はWindowsでBashを使用していますが、ある時点でMySQLが動作するのに問題があります。

これでうまくいきますが、apt-getにインストールプロセスの残りの部分があるようです。パッケージ(mysql関連の有無にかかわらず)をインストールしようとするたびに実行され、mysql_upgrade失敗します。

しかし、MySQLがうまく動作するので、これを実行する必要はありません。 apt-getにこれを停止させる方法はありますか?

詳細は次のとおりです。

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  snap-confine
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  libzip4
The following NEW packages will be installed:
  libzip4 php7.1-zip
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 59.8 kB of archives.
After this operation, 191 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 libzip4 amd64 1.1.2-1.1+deb.sury.org~xenial+1 [40.1 kB]
Get:2 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php7.1-zip amd64 7.1.4-1+deb.sury.org~xenial+1 [19.8 kB]
Fetched 59.8 kB in 0s (260 kB/s)
Selecting previously unselected package libzip4:amd64.
(Reading database ... 57661 files and directories currently installed.)
Preparing to unpack .../libzip4_1.1.2-1.1+deb.sury.org~xenial+1_amd64.deb ...
Unpacking libzip4:amd64 (1.1.2-1.1+deb.sury.org~xenial+1) ...............................................................................................................................................................................]
Selecting previously unselected package php7.1-zip.#####.................................................................................................................................................................................]
Preparing to unpack .../php7.1-zip_7.1.4-1+deb.sury.org~xenial+1_amd64.deb ...
Unpacking php7.1-zip (7.1.4-1+deb.sury.org~xenial+1) ...#############....................................................................................................................................................................]
Processing triggers for libc-bin (2.23-0ubuntu7) ...##########################################...........................................................................................................................................]
Processing triggers for libapache2-mod-php7.1 (7.1.4-1+deb.sury.org~xenial+1) ...
Setting up mysql-server-5.7 (5.7.18-0ubuntu0.16.04.1) ...
invoke-rc.d: could not determine current runlevel
 * Stopping MySQL database server mysqld                                                                                                                                                                                              [ OK ]invoke-rc.d: could not determine current runlevel
invoke-rc.d: could not determine current runlevel
 * Stopping MySQL database server mysqld                                                                                                                                                                                              [ OK ]invoke-rc.d: could not determine current runlevel
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Setting up libzip4:amd64 (1.1.2-1.1+deb.sury.org~xenial+1) ...
No apport report written because the error message indicates its a followup error from a previous failure.
Progress: [ 47%] [########################################################################################Setting up php7.1-zip (7.1.4-1+deb.sury.org~xenial+1) .........................................................................]
Progress: [ 52%] [##################################################################################################################.....................................................................................................]
Creating config file /etc/php/7.1/mods-available/zip.ini with new version
Processing triggers for libc-bin (2.23-0ubuntu7) ...#############################################################################################........................................................................................]
Processing triggers for libapache2-mod-php7.1 (7.1.4-1+deb.sury.org~xenial+1) ...
Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

ベストアンサー1

パッケージmysql-server-5.7が正しくインストールされていません。ファイルが解凍されましたが、インストールパッケージの完了に問題が発生しました。何が間違っていても、あなたは影響を受けません。あなたが知っているように、パッケージマネージャはそれを知る方法がありません。

インストールが完了しないようにするエラーは次のとおりです。

mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) while connecting to the MySQL server

私はMySQLに慣れていないので、この問題を解決する方法がわかりません。これは非常に一般的なエラーであり、いくつかの原因が考えられます。 Debianスクリプトが処理できない珍しいMySQL設定があるかもしれません。

現在実行中ですが失敗したスクリプトはです/var/lib/dpkg/info/mysql-server-5.7.postinst。失敗の理由をデバッグするには、その行をスクリプトの先頭set -eに変更すると、スクリプトで実行されたコマンドのトレースを取得できます。set -ex

アップグレードを再度実行するには、次の手順を実行します。

sudo dpkg --configure -a

または

sudo apt-get -f install

/var/lib/dpkg/info/mysql-server-5.7.postinstパッケージマネージャは正常に実行されると満足します(つまり、終了ステータスは0です)。作業を完了せずに成功状態で強制的に終了したい誘惑を感じることもありますが、気をつけてください。間違えると、データベースが破損する可能性があります。

おすすめ記事