配置 mysql-server 时 Debconf 出现错误

配置 mysql-server 时 Debconf 出现错误

当我尝试运行 sudo apt-get upgrade 时出现以下错误。

我在运行 sudo reconfigure postfix 时也遇到了类似的错误,由于外发电子邮件不再工作,因此我非常需要运行它。我还运行了 sudo apt-get autoclean、sudo apt-getclean、sudo apt-get install debconf --reinstall 和 sudo apt-get install -f,但均未成功。

magento@ubuntu:~$ sudo apt-get install debconf --reinstall
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.5.0-17 linux-headers-3.5.0-17-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  mysql-server-5.5
Suggested packages:
  tinyca mailx
The following packages will be upgraded:
  mysql-server-5.5
1 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 8 not upgraded.
28 not fully installed or removed.
Need to get 149 kB/8,990 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 http://no.archive.ubuntu.com/ubuntu/ quantal/main debconf all 1.5.46ubuntu1     [149 kB]
Fetched 149 kB in 0s (472 kB/s)
Use of uninitialized value in concatenation (.) or string at         /usr/share/perl5/Debconf/DbDriver/File.pm line 44, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in -e at /usr/share/perl5/Debconf/DbDriver/File.pm line     46, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in pattern match (m//) at     /usr/share/perl5/Debconf/DbDriver/File.pm line 47, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in -d at     /usr/share/perl5/Debconf/DbDriver/File.pm line 48, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in concatenation (.) or string at     /usr/share/perl5/Debconf/DbDriver/File.pm line 49, <DEBCONF_CONFIG> chunk 3.
debconf: DbDriver "config": mkdir :No such file or directory
(Reading database ... 81482 files and directories currently installed.)
Preparing to replace mysql-server-5.5 5.5.28-0ubuntu0.12.10.1 (using .../mysql-    server-5.5_5.5.28-0ubuntu0.12.10.2_amd64.deb) ...
Use of uninitialized value in concatenation (.) or string at     /usr/share/perl5/Debconf/DbDriver/File.pm line 44, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in -e at /usr/share/perl5/Debconf/DbDriver/File.pm line     46, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in pattern match (m//) at     /usr/share/perl5/Debconf/DbDriver/File.pm line 47, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in -d at     /usr/share/perl5/Debconf/DbDriver/File.pm line 48, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in concatenation (.) or string at     /usr/share/perl5/Debconf/DbDriver/File.pm line 49, <DEBCONF_CONFIG> chunk 3.
debconf: DbDriver "config": mkdir :No such file or directory
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
Use of uninitialized value in concatenation (.) or string at     /usr/share/perl5/Debconf/DbDriver/File.pm line 44, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in -e at /usr/share/perl5/Debconf/DbDriver/File.pm line     46, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in pattern match (m//) at     /usr/share/perl5/Debconf/DbDriver/File.pm line 47, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in -d at     /usr/share/perl5/Debconf/DbDriver/File.pm line 48, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in concatenation (.) or string at     /usr/share/perl5/Debconf/DbDriver/File.pm line 49, <DEBCONF_CONFIG> chunk 3.
debconf: DbDriver "config": mkdir :No such file or directory
dpkg: error processing /var/cache/apt/archives/mysql-server-5.5_5.5.28-    0ubuntu0.12.10.2_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Use of uninitialized value in concatenation (.) or string at     /usr/share/perl5/Debconf/DbDriver/File.pm line 44, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in -e at /usr/share/perl5/Debconf/DbDriver/File.pm line     46, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in pattern match (m//) at     /usr/share/perl5/Debconf/DbDriver/File.pm line 47, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in -d at     /usr/share/perl5/Debconf/DbDriver/File.pm line 48, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in concatenation (.) or string at     /usr/share/perl5/Debconf/DbDriver/File.pm line 49, <DEBCONF_CONFIG> chunk 3.
debconf: DbDriver "config": mkdir :No such file or directory
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
   Errors were encountered while processing:
    /var/cache/apt/archives/mysql-server-5.5_5.5.28-0ubuntu0.12.10.2_amd64.deb
   E: Sub-process /usr/bin/dpkg returned an error code (1)

运行 Ubuntu 12.10。

命令 df 给出:

Filesystem                 1K-blocks    Used Available Use% Mounted on
/dev/mapper/magento-root  53613052 6529812  44359812  13% /
udev                         3978932       4   3978928   1% /dev
tmpfs                        1595380     264   1595116   1% /run
none                            5120       0      5120   0% /run/lock
tmpfs                        3988440       0   3988440   0% /run/shm
none                          102400       0    102400   0% /run/user
/dev/sda1                     233191   53511    167239  25% /boot

我似乎看到过一篇文章建议不要将 tmpfs 用于 /var/cahce,如果这是问题所在,我该如何配置 Ubuntu 以将我的硬盘(和 SSD)用于 /var/cache。

提前感谢你的帮助,并原谅我的新手身份。

更新:

跑步

sudo apt-get update --fix-missing
sudo apt-get autoremove && sudo apt-get clean && sudo apt-get install -f

给出:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  mysql-server-5.5
Suggested packages:
  tinyca mailx
The following packages will be REMOVED:
  linux-headers-3.5.0-17 linux-headers-3.5.0-17-generic
The following packages will be upgraded:
  mysql-server-5.5
1 upgraded, 0 newly installed, 2 to remove and 8 not upgraded.
28 not fully installed or removed.
Need to get 0 B/8,840 kB of archives.
After this operation, 69.9 MB disk space will be freed.
Do you want to continue [Y/n]? y
Use of uninitialized value in concatenation (.) or string at         /usr/share/perl5/Debconf/DbDriver/File.pm line 44, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in -e at /usr/share/perl5/Debconf/DbDriver/File.pm line         46, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in pattern match (m//) at         /usr/share/perl5/Debconf/DbDriver/File.pm line 47, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in -d at         /usr/share/perl5/Debconf/DbDriver/File.pm line 48, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in concatenation (.) or string at         /usr/share/perl5/Debconf/DbDriver/File.pm line 49, <DEBCONF_CONFIG> chunk 3.
debconf: DbDriver "config": mkdir :No such file or directory
(Reading database ... 81482 files and directories currently installed.)
Preparing to replace mysql-server-5.5 5.5.28-0ubuntu0.12.10.1 (using .../mysql-        server-5.5_5.5.28-0ubuntu0.12.10.2_amd64.deb) ...
Use of uninitialized value in concatenation (.) or string at         /usr/share/perl5/Debconf/DbDriver/File.pm line 44, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in -e at /usr/share/perl5/Debconf/DbDriver/File.pm line         46, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in pattern match (m//) at         /usr/share/perl5/Debconf/DbDriver/File.pm line 47, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in -d at         /usr/share/perl5/Debconf/DbDriver/File.pm line 48, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in concatenation (.) or string at         /usr/share/perl5/Debconf/DbDriver/File.pm line 49, <DEBCONF_CONFIG> chunk 3.
debconf: DbDriver "config": mkdir :No such file or directory
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
Use of uninitialized value in concatenation (.) or string at         /usr/share/perl5/Debconf/DbDriver/File.pm line 44, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in -e at /usr/share/perl5/Debconf/DbDriver/File.pm line         46, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in pattern match (m//) at         /usr/share/perl5/Debconf/DbDriver/File.pm line 47, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in -d at         /usr/share/perl5/Debconf/DbDriver/File.pm line 48, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in concatenation (.) or string at         /usr/share/perl5/Debconf/DbDriver/File.pm line 49, <DEBCONF_CONFIG> chunk 3.
debconf: DbDriver "config": mkdir :No such file or directory
dpkg: error processing /var/cache/apt/archives/mysql-server-5.5_5.5.28-         0ubuntu0.12.10.2_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Use of uninitialized value in concatenation (.) or string at         /usr/share/perl5/Debconf/DbDriver/File.pm line 44, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in -e at /usr/share/perl5/Debconf/DbDriver/File.pm line         46, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value in pattern match (m//) at         /usr/share/perl5/Debconf/DbDriver/File.pm line 47, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in -d at         /usr/share/perl5/Debconf/DbDriver/File.pm line 48, <DEBCONF_CONFIG> chunk 3.
Use of uninitialized value $directory in concatenation (.) or string at         /usr/share/perl5/Debconf/DbDriver/File.pm line 49, <DEBCONF_CONFIG> chunk 3.
debconf: DbDriver "config": mkdir :No such file or directory
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.5_5.5.28-0ubuntu0.12.10.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)  

答案1

我想我有点太晚了......但我还是会发布它,以防有人来这里寻找相同问题的解决方案。

debconf: DbDriver "config": mkdir :No such file or directory意味着debconf缺少/var/cache已被以某种方式删除的目录(仍然无法弄清楚如何删除,因为之前它运行正常)。

一个明显的解决方案是重新创建它(sudo mkdir /var/cache/debconf),或者从包中重新安装 debconf(真的不需要这样做)。

答案2

我遇到过这个问题(Ubuntu 13.04),是因为我(意外地)删除了/var/cache/debconf,我只是重新创建一切又恢复正常了...所以:/var/cache/debconf:缺失 = 坏,存在 = 好

PS:如果你像我一样懒的话可以剪切粘贴:

sudo mkdir /var/cache/debconf

我发现一些声称可以清理硬盘的工具会删除 /var/cache 等位置的空文件夹,所以......

sudo touch /var/cache/debconf/.dont-delete-this-directory

当然,当有人/某物进入并试图摆脱它时,rmdir 将被阻止……当然,经验丰富的用户知道永远不要使用优化工具,特别是在基于 -nix 的系统上,这种垃圾最好留给 -dows 人群和他们的新手,所以大多数阅读本文的人可能会嘲笑这样做的想法……包括我自己(我猜只是无聊)。希望这能有所帮助。

答案3

尝试运行:

sudo apt-get update --fix-missing
sudo apt-get autoremove && sudo apt-get clean && sudo apt-get install -f

相关内容