#perl#一次virtualbox引发的血案

利用ubuntu的appstore安装virtualbox,但是在运行的时候提示无法载入内核,于是想先卸载然后在网上寻找解决方案,卸载之后安装任何东西就会出现如下大段的错误:

Subroutine warnings::warnif redefined at /usr/share/perl/5.14/fields.pm line 11.
debconf: Perl may be unconfigured (Can't locate warnings/register.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /usr/share/perl/5.14/overload.pm line 147.
BEGIN failed--compilation aborted at /usr/share/perl/5.14/overload.pm line 147.
Compilation failed in require at /usr/share/perl5/Debconf/Template.pm line 341.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Template.pm line 341.
Compilation failed in require at /usr/share/perl5/Debconf/Question.pm line 8.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Question.pm line 8.
Compilation failed in require at /usr/share/perl5/Debconf/Config.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Config.pm line 7.
Compilation failed in require at /usr/share/perl5/Debconf/Log.pm line 10.
Compilation failed in require at (eval 1) line 4.
BEGIN failed--compilation aborted at (eval 1) line 4.
) -- aborting
正在设置 man-db (2.6.1-2ubuntu1) ...
Subroutine warnings::warnif redefined at /usr/share/perl/5.14/fields.pm line 11.
Can't locate warnings/register.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /usr/share/perl/5.14/overload.pm line 147.
BEGIN failed--compilation aborted at /usr/share/perl/5.14/overload.pm line 147.
Compilation failed in require at /usr/share/perl5/Debconf/Template.pm line 341.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Template.pm line 341.
Compilation failed in require at /usr/share/perl5/Debconf/Question.pm line 8.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Question.pm line 8.
Compilation failed in require at /usr/share/perl5/Debconf/Config.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Config.pm line 7.
Compilation failed in require at /usr/share/perl5/Debconf/Log.pm line 10.
Compilation failed in require at /usr/share/perl5/Debconf/Db.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Db.pm line 7.
Compilation failed in require at /usr/share/debconf/frontend line 6.
BEGIN failed--compilation aborted at /usr/share/debconf/frontend line 6.
dpkg:处理 man-db (--configure)时出错:
 子进程 已安装 post-installation 脚本 返回了错误号 2
在处理时有错误发生:
 man-db
E: Sub-process /usr/bin/dpkg returned an error code (1)

上面错误提示的大概意思就是说,dpkg在安装软件的时候出现了错误,于是上网查询发现下面的命令

sudo dpkg --configure -a
sudo apt-get install -f

第一个命令是重新启动dpkg

第二个命令是修复apt-get install


之后还是一样的错误,于是参考以下提示用了下面的办法
the problem of a broken package still exist the solution is to edit the dpkg status file manually.
sudo nano /var/lib/dpkg/status  

也就是说,直接编辑dpkg的管理配置文件,将出问题的包删掉。

很不幸,还是继续出现相同的问题,于是仔细研究上面的错误提示,发现是perl语言的编译错误,具体原因就是在代码里面引用了不存在的变量,解决办法就是一个一个的删掉这些不存在的变量引用,最后解决了所有的问题。


现在的问题是,
perl debconf, dpkg
man-db, doc-base
都是些什么东西。

dpkg: debian 系统软件管理工具
此处待续


OK,现在终于解决了半路跳出来的问题,下面该解决最开始的我问题,也就是运行virtualbox的时候下面的错误提示
virtual-box

* No suitable module for running kernel found

搜索之后,根据下面的链接

http://askubuntu.com/questions/126175/virtualbox-doesnt-load-after-12-04-upgrade

http://ubuntuforums.org/showthread.php?t=2082084

以及里面的提示,终于解决了问题。

I had a similar problem. Here is what worked for me:
This may be required if you get a kernel sources not found type of error:

sudo apt-get install build-essential linux-headers-`uname -r`

Then reconfigure the relevant packages to kick them in to rebuilding.

sudo dpkg-reconfigure virtualbox-dkms 
sudo dpkg-reconfigure virtualbox



你可能感兴趣的:(ubuntu,perl)