AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1029787
Accepted
Kid_Learning_C
Kid_Learning_C
Asked: 2020-08-13 01:20:10 +0800 CST2020-08-13 01:20:10 +0800 CST 2020-08-13 01:20:10 +0800 CST

从谷歌云中的快照创建虚拟机后,apt-get 被 mysql 卡住了

  • 772

我正在使用谷歌云,我有一个运行良好的虚拟机(Ubuntu 18.04)。apt-get 命令运行良好,mysql 服务运行良好。我们称它为 vm-1

我需要创建另一个重复的 vm,所以我首先制作了 vm-1 的快照,并使用此快照创建了一个新的 vm,称为 vm-2。

当我在 vm-2 上工作时,我发现简单的命令sudo apt-get install ***会失败并卡在与 mysql-server 相关的步骤中。下面是一个例子:

John@vm-2:~$ sudo apt-get install tree
Reading package lists... Done
Building dependency tree
Reading state information... Done
tree is already the newest version (1.7.0-5).
The following packages were automatically installed and are no longer required:
  libnvidia-common-390 linux-gcp-headers-5.0.0-1033
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 170 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up mysql-server-5.7 (5.7.30-0ubuntu0.18.04.1) ...
/var/lib/mysql/ibdata1: 14143
ERROR: Database files are locked. Daemon already running?
Warning: Unable to start the server. Please restart MySQL and run mysql_upgrade to ensure the database is ready for use.
/var/lib/mysql/ibdata1: 14143
ERROR: Database files are locked. Daemon already running?
Warning: Unable to start the server.
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2020-08-12 18:11:39 JST; 7ms ago
  Process: 24068 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
  Process: 24046 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 1711 (code=exited, status=0/SUCCESS)
dpkg: error processing package mysql-server-5.7 (--configure):
 installed mysql-server-5.7 package post-installation script subprocess 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
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
John@vm-2:~$

它一直在说

ERROR: Database files are locked. Daemon already running?
Warning: Unable to start the server. Please restart MySQL and run mysql_upgrade to ensure the database is ready for use.
/var/lib/mysql/ibdata1: 14143
ERROR: Database files are locked. Daemon already running?
Warning: Unable to start the server.

首先 apt-get 与 mysql-server 有什么关系?我一直认为它们是两个独立的软件。

我该如何解决这个问题?除了恢复在原始虚拟机中完全正常工作的快照之外,我什么也没做。一切都一样,怎么apt-get会失败?

mysql virtual-machines apt snapshot gcloud
  • 1 1 个回答
  • 1049 Views

1 个回答

  • Voted
  1. Best Answer
    Tom
    2020-08-13T01:48:36+08:002020-08-13T01:48:36+08:00

    以下日志行: 2 not fully installed or removed.表明 apt-get 在继续执行新的安装请求(树)之前尝试完成先前失败的软件包安装(mysql-server-5.7),这就是您在该输出中看到 mysql-server 的原因。

    我建议确定 mysql 服务器是否已经通过ps -ef | grep -i mysqlor运行netstat -lntp | grep 3306并解决导致的问题ERROR: Database files are locked. Daemon already running?

    一个这个解决了,它将允许之前的包安装成功完成

    1. 如果您自己手动启动 mysql,那么我建议您停止该进程,然后再次运行原始命令。

    2. 如果有可能如果您之前在某个时间点启动了 mysql root,您可能需要检查文件/var/lib/mysql/ibdata1夹中文件的权限

    • 1

相关问题

  • 开源与专有关系 db mgt 系统的优缺点是什么?

  • 在 solaris 10 上为 mysql 设置 max_allowed_pa​​cket

  • 如何移动 MySQL 的数据目录?

  • 通过 VPN 连接什么是远程服务器 IP?

  • mysql崩溃

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve