ubuntu 旧版本的依赖问题

ubuntu 旧版本的依赖问题

我自己无法弄清楚,希望有人可以帮忙。

即使我已经使用 3.13.0-68-generic,每当我运行更新时,我都会收到错误消息,提示 3.13.0-58-generic 有问题。

(由于启动时磁盘空间不足,我总是不得不删除旧版本 - 当我删除旧版本时,我总是留下最后一个和倒数第二个版本。)

确切的错误是

Internal Error: Could not find image (/boot/vmlinuz-3.13.0-58-generic)
 dpkg: error processing package linux-image-3.13.0-58-generic (--configure):
  subprocess installed post-installation script returned error exit status 2 
  dpkg: dependency problems prevent configuration of
   linux-image-extra-3.13.0-58-generic: 
    linux-image-extra-3.13.0-58-generic depends on linux-image-3.13.0-58-generic;
    however: Package linux-image-3.13.0-58-generic is not configured yet.

 dpkg: error processing package linux-image-extra-3.13.0-58-generic (--configure):
  dependency problems - leaving unconfigured 

Errors were encountered while processing:
 linux-image-3.13.0-58-generic 
 linux-image-extra-3.13.0-58-generic

uname -a

olivy-ThinkPad-Edge 3.13.0-66-generic #108-Ubuntu SMP Wed Oct 7 15:20:27 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

ls -la /var/lib/dpkg/info/linux-image-*.postinst

-rwxr-xr-x 1 root root 39259 Dez  8  2014 /var/lib/dpkg/info/linux-image-3.13.0-43-generic.postinst
-rwxr-xr-x 1 root root 39259 Apr 10  2015 /var/lib/dpkg/info/linux-image-3.13.0-49-generic.postinst
-rwxr-xr-x 1 root root 39259 Mai  4  2015 /var/lib/dpkg/info/linux-image-3.13.0-52-generic.postinst
-rwxr-xr-x 1 root root 39259 Jun 18 03:04 /var/lib/dpkg/info/linux-image-3.13.0-55-generic.postinst
-rwxr-xr-x 1 root root 39259 Jun 19 12:05 /var/lib/dpkg/info/linux-image-3.13.0-57-generic.postinst
-rwxr-xr-x 1 root root 39259 Jul  8 05:54 /var/lib/dpkg/info/linux-image-3.13.0-58-generic.postinst
-rwxr-xr-x 1 root root 39259 Jul 29 14:36 /var/lib/dpkg/info/linux-image-3.13.0-61-generic.postinst
-rwxr-xr-x 1 root root 39259 Aug 11 18:19 /var/lib/dpkg/info/linux-image-3.13.0-62-generic.postinst
-rwxr-xr-x 1 root root 39259 Aug 15 01:09 /var/lib/dpkg/info/linux-image-3.13.0-63-generic.postinst
-rwxr-xr-x 1 root root 39259 Okt  3 01:57 /var/lib/dpkg/info/linux-image-3.13.0-65-generic.postinst
-rwxr-xr-x 1 root root 39259 Okt  7 18:36 /var/lib/dpkg/info/linux-image-3.13.0-66-generic.postinst
-rwxr-xr-x 1 root root 39259 Nov  6 20:59 /var/lib/dpkg/info/linux-image-3.13.0-68-generic.postinst
-rwxr-xr-x 1 root root   391 Dez  8  2014 /var/lib/dpkg/info/linux-image-extra-3.13.0-43-generic.postinst
-rwxr-xr-x 1 root root   391 Apr 10  2015 /var/lib/dpkg/info/linux-image-extra-3.13.0-49-generic.postinst
-rwxr-xr-x 1 root root   391 Mai  4  2015 /var/lib/dpkg/info/linux-image-extra-3.13.0-52-generic.postinst
-rwxr-xr-x 1 root root   391 Jun 18 03:04 /var/lib/dpkg/info/linux-image-extra-3.13.0-55-generic.postinst
-rwxr-xr-x 1 root root   391 Jun 19 12:05 /var/lib/dpkg/info/linux-image-extra-3.13.0-57-generic.postinst
-rwxr-xr-x 1 root root   391 Jul  8 05:54 /var/lib/dpkg/info/linux-image-extra-3.13.0-58-generic.postinst
-rwxr-xr-x 1 root root   391 Jul 29 14:36 /var/lib/dpkg/info/linux-image-extra-3.13.0-61-generic.postinst
-rwxr-xr-x 1 root root   391 Aug 11 18:19 /var/lib/dpkg/info/linux-image-extra-3.13.0-62-generic.postinst
-rwxr-xr-x 1 root root   391 Aug 15 01:09 /var/lib/dpkg/info/linux-image-extra-3.13.0-63-generic.postinst
-rwxr-xr-x 1 root root   391 Okt  3 01:57 /var/lib/dpkg/info/linux-image-extra-3.13.0-65-generic.postinst
-rwxr-xr-x 1 root root   391 Okt  7 18:36 /var/lib/dpkg/info/linux-image-extra-3.13.0-66-generic.postinst
-rwxr-xr-x 1 root root   391 Nov  6 20:59 /var/lib/dpkg/info/linux-image-extra-3.13.0-68-generic.postinst

非常感谢!

答案1

DEB 包的安装后脚本中的某处(/var/lib/dpkg/info/linux-image-3.13.0-58-generic.postinst)是下面的代码片段

die "Internal Error: Could not find image (" . $realimageloc
  . "$kimage-$version)\n" unless -e $realimageloc
  . "$kimage-$version";

unless -e $realimageloc意思是,如果返回,则脚本失败,false换句话说,如果文件/boot/vmlinuz-3.13.0-58-generic不存在。


两种可能性:

  • 创建虚拟文件

    sudo touch /boot/vmlinuz-3.13.0-58-generic
    
  • 跑步

    sudo apt-get install -f
    

或者

  • 停用die声明

    • 编辑安装后脚本

      sudo nano /var/lib/dpkg/info/linux-image-3.13.0-58-generic.postinst
      
    • 搜索代码块

      die "Internal Error: Could not find image (" . $realimageloc
        . "$kimage-$version)\n" unless -e $realimageloc
        . "$kimage-$version";
      

      并注释掉这些行,只需#在每一行添加一个

    • 你现在应该看到类似这样的内容

      # Paranoid check to make sure that the correct value is put in there
      if    (! $kimage)                 { $kimage = "vmlinuz"; } # Hmm. empty
      elsif ($kimage =~ m/^b?uImage$/o) { $kimage = "vmlinuz"; } # these produce vmlinuz
      elsif ($kimage =~ m/^b?zImage$/o) { $kimage = "vmlinuz"; } # these produce vmlinuz
      elsif ($kimage =~ m/^[iI]mage$/o) { my $nop = $kimage;   }
      elsif ($kimage =~ m/^vmlinux$/o)  { my $nop = $kimage;   }
      else                              { $kimage = "vmlinuz"; } # Default
      
      $ENV{KERNEL_ARCH}=$kernel_arch if $kernel_arch;
      
      
      # die "Internal Error: Could not find image (" . $realimageloc
      #  . "$kimage-$version)\n" unless -e $realimageloc
      #  . "$kimage-$version";
      
      # search for the boot loader in the path
      my $loader_exec;
      ($loader_exec = $loader)  =~ s|.*/||;
      my ($loaderloc) = grep -x, map "$_/$loader_exec",
        map { length($_) ? $_ : "." }  split /:/, $ENV{PATH};
      
      
      ######################################################################
      ######################################################################
      ###########        Test whether a relative symlinkwould be OK #######
      ######################################################################
      ######################################################################
      ######################################################################
      
    • 保存文件并运行

      sudo apt-get install -f
      

相关内容