vmlinuz 和 initrd 奇怪文件出现在“/”目录

5 filesystem files

我最近注意到我的/目录中出现了四个新文件:

lrwxrwxrwx   1 root root    33 Apr  9 14:07 initrd.img -> boot/initrd.img-3.16.0-34-generic
lrwxrwxrwx   1 root root    33 Mar 23 19:42 initrd.img.old -> boot/initrd.img-3.16.0-33-generic
lrwxrwxrwx   1 root root    30 Apr  9 14:07 vmlinuz -> boot/vmlinuz-3.16.0-34-generic
lrwxrwxrwx   1 root root    30 Mar 23 19:42 vmlinuz.old -> boot/vmlinuz-3.16.0-33-generic
Run Code Online (Sandbox Code Playgroud)

因为在我想知道它们是什么以及为什么它们现在在那里之前我没有在那里看到它们。所以我想知道是否有人可以向我解释这一点?


操作系统信息:

Description:    Ubuntu 14.10
Release:    14.10
Run Code Online (Sandbox Code Playgroud)

Eri*_*lho 3

嗯,它们是符号链接正如 muru 所说,它们可能一直都在那里,但您只是没有注意到它们。

Ubuntu 论坛中的这个答案很好地解释了它们的存在原因:

让我们看一下 /boot/grub/grub.cfg 中的 grub 配置条目:

menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menu
entry_id_option 'gnulinux-simple-blahblahblah' {
        [...]
        linux   /boot/vmlinuz-3.16.0-28-generic.efi.signed root=UUID=blahblahblah ro  quiet splash $vt_handoff
        initrd  /boot/initrd.img-3.16.0-28-generic
}
Run Code Online (Sandbox Code Playgroud)

如果您始终从此 grub.cfg 引导,则不需要这些符号链接。如果您曾经手动将 grub 指向引导,那么“vmlinuz”比“/boot/vmlinuz-3.16.0-28-generic”更容易记住和输入。符号链接是简单引导时间遗留下来的,但偶尔也会出现这种情况。非常便利。如果您愿意,可以删除符号链接,但下次 grub 更新其 grub.cfg 文件时将重新创建它们。

每当您安装新内核时,许多内容都会自动更新,包括 initrd.img 和 grub.cfg...以及那些符号链接。

有关vmlinuzinitrd的更多信息。