debian9.6中update-grub找不到的解决办法及它与update-grub2的区别
  dSzaXU8MjqY1 2023年11月02日 61 0


1,bash: update-grub: 未找到命令

guoyanzhang@bogon:~$ update-grub
bash: update-grub: 未找到命令

为什么呢?我们搜一下:

guoyanzhang@bogon:~$ whereis update-grub
update-grub: /usr/sbin/update-grub /usr/share/man/man8/update-grub.8.gz

明明是有的,但是为什么又说找不到呢?注意看/usr/sbin/,不是/usr/bin,我们平时在普通用户tab出来的是在/bin下,不是在/sbin下,使用/sbin下的,就要使用sudo:

guoyanzhang@bogon:~$ sudo update-grub
[sudo] guoyanzhang 的密码:
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-4.9.0-8-amd64
Found initrd image: /boot/initrd.img-4.9.0-8-amd64
Found Arch Linux (rolling) on /dev/sda3
Found Debian GNU/Linux 9 (stretch) on /dev/sda4
Adding boot menu entry for EFI firmware configuration
done

2,再看update-grub2

guoyanzhang@bogon:~$ sudo update-grub2
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-4.9.0-8-amd64
Found initrd image: /boot/initrd.img-4.9.0-8-amd64
Found Arch Linux (rolling) on /dev/sda3
Found Debian GNU/Linux 9 (stretch) on /dev/sda4
Adding boot menu entry for EFI firmware configuration
done

结果是一样的。

3,表面比较

guoyanzhang@bogon:~$ whereis update-grub
update-grub: /usr/sbin/update-grub /usr/share/man/man8/update-grub.8.gz
guoyanzhang@bogon:~$ whereis update-grub2
update-grub2: /usr/sbin/update-grub2 /usr/share/man/man8/update-grub2.8.gz
guoyanzhang@bogon:~$ sudo ls /usr/sbin/update-grub2 -l
lrwxrwxrwx 1 root root 11 1029 03:18 /usr/sbin/update-grub2 -> update-grub

update-grub2其实只是一个链接符号,链接到update-grub。

4,内容比较

guoyanzhang@bogon:~$ sudo cat /usr/sbin/update-grub
#!/bin/sh
set -e
exec grub-mkconfig -o /boot/grub/grub.cfg "$@"
guoyanzhang@bogon:~$ sudo cat /usr/sbin/update-grub2
#!/bin/sh
set -e
exec grub-mkconfig -o /boot/grub/grub.cfg "$@"

内容其实是个脚本,真正执行的是grub-mkconfig这句,在archlinux上,直接用这句来更新grub。

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
dSzaXU8MjqY1