在 Ubuntu 10.04 上重新安装最新的 Linux 内核

在 Ubuntu 10.04 上重新安装最新的 Linux 内核

我已经关注那些指令清理 Ubuntu 10.04 系统的启动菜单。但不知何故,我不仅删除了旧版本,还删除了最新版本(请不要笑)。我只使用 Synaptic 来删除它们,我没有编辑 /etc/grub.d

现在,当我启动系统时,没有可用的 Linux 版本,只有 memtest。我可以使用 Ubuntu CD 启动,并且看到分区仍在那里,其中包含所有数据。

我如何重新安装最新的 Linux 内核并使其在我的 grub 菜单中可用?

更新

我按照 JRT 说明操作,但在运行 apt-get 时出现权限错误。第二次运行它返回此输出:

root@ubuntu:~# apt-get install linux-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
linux-generic is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Can not write log, openpty() failed (/dev/pts not mounted?)
Setting up linux-image-2.6.32-25-generic (2.6.32-25.45) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-25-generic
grep: /proc/modules: No such file or directory
grep: /proc/modules: No such file or directory
grep: /proc/modules: No such file or directory
Running postinst hook script /usr/sbin/update-grub.
/usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).
User postinst hook script [/usr/sbin/update-grub] exited with value 1
dpkg: error processing linux-image-2.6.32-25-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.32-25-generic; however:
  Package linux-image-2.6.32-25-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.32.25.27); however:
  Package linux-image-generic is not configured yet.
dpkg: error processing linux-generic (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
 linux-image-2.6.32-25-generic
 linux-image-generic
 linux-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

更新2

我可以通过以下方式修复错误将主机系统设备节点挂载到 chroot 环境在另一个终端中,我输入了以下命令:

mount --bind /dev /mnt/temp/dev

然后我就可以运行 apt-get 并重新安装内核了。现在我可以启动它了,一切正常。

我的周末很安全!

答案1

从CD启动

备份所有个人数据

启动终端,并更改为 root 用户。

须藤苏<输入>

让我们挂载根分区,

mkdir /mnt/temp<输入>

mount /dev/< 根分区> /mnt/temp<输入>

chroot /mnt/temp<输入>

现在重新安装内核:

apt-get 安装 linux-generic<输入>

相关内容