意外删除了“linux-image-generic”--我该如何恢复?

意外删除了“linux-image-generic”--我该如何恢复?

好吧,我告诉你,我的问题是在升级到 Ubuntu 11.04 时开始的。当我将 Ubuntu 10.04 更新到 10.10 时,每次安装某些东西时,读取“linux-image-generic”时都会出错。当时我通过安装一个名为 Ubuntu Tweak 的软件解决了这个问题,我用它删除了所有临时文件和旧安装包,我不知道为什么,但它有效并且问题停止了。

这次我尝试做其他的事情,并按照他们在这个帖子中所说的步骤进行操作:

磁盘空间不足时 initramfs 出现问题

好吧,我清除了这些文件,重新启动后它告诉我:

ERROR 15: FILE NOT FOUND
Press any key to continue ...

这让我可以选择:

10.04.1 Ubuntu LTS, Karel-24-generic 06/02/1932

10.04.1 Ubuntu LTS, Karel 06.02.1932-24-generic (Recovered)

其中任何一个都会让我再次回到错误 15。

我从旧的 Windows 分区开始,使用 Ext2fsd 读取 Linux 分区,我可以检索我复制了更新时的错误日志的文件。我把它放在这里以防有用:

InstallArchives() failed: (Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 258222 files and directories currently installed.)
Removing jdownloader ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for desktop-file-utils ...
Processing triggers for python-gmenu ...
Rebuilding /usr/share/applications/desktop.en_US.UTF8.cache...
Processing triggers for hicolor-icon-theme ...
Processing triggers for python-support ...
Setting up linux-image-2.6.38-8-generic (2.6.38-8.42) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.38-8-generic
Running postinst hook script /sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
/etc/default/grub: line 1: /etc/default/grub: Permission denied
User postinst hook script [/sbin/update-grub] exited with value 1
dpkg: error processing linux-image-2.6.38-8-generic (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-2.6.38-8-generic; however:
  Package linux-image-2.6.38-8-generic is not configured yet.
dpkg: error processing linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 2.6.38.8.22); however:
  Package linux-image-generic is not configured yet.
dpkg: error processing linux-generic (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
Errors were encountered while processing:
 linux-image-2.6.38-8-generic
 linux-image-generic
 linux-generic
Setting up linux-image-2.6.38-8-generic (2.6.38-8.42) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.38-8-generic
Running postinst hook script /sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
/etc/default/grub: line 1: /etc/default/grub: Permission denied
User postinst hook script [/sbin/update-grub] exited with value 1
dpkg: error processing linux-image-2.6.38-8-generic (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-2.6.38-8-generic; however:
  Package linux-image-2.6.38-8-generic is not configured yet.
dpkg: error processing linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 2.6.38.8.22); however:
  Package linux-image-generic is not configured yet.
dpkg: error processing linux-generic (--configure):
 dependency problems - leaving unconfigured

我该怎么办?有什么办法可以恢复我删除的文件吗?

答案1

访问时出现权限错误/etc/default/grub,导致更新过程失败。

由于您当前的系统似乎已损坏,请使用 Live CD 通过以下方式访问它:chroot方法。

  1. 参见第 1 - 5 点这个答案关于如何 chroot 进入你的系统。

  2. 检查ls -al /etc/default/grub该文件是否具有以下权限:

    -rw-r--r-- 1 root root 1310 2011-03-31 22:21 /etc/default/grub
    
  3. 如果没有,请运行

    chmod 644 /etc/default/grub
    
  4. 现在让系统继续升级:

    dpkg --configure -a
    

    如果您收到警告,提示您运行,apt-get install -f那么就运行。

  5. 只想确认一下:

    update-initramfs -c -k all
    

    如果这样能创建一些东西,那么至少您有一个内核可以启动。确保它在启动时位于您的内核列表中:

    update-grub
    
  6. 按照上面链接答案中的步骤 7. 和 8. 进行操作。

相关内容