答案1
对于所有地方的默认密码,您可以创建一个文件/etc/grub.d/00_before_header
这个名字00_before_header
很重要,因为它将00_header
按字母顺序排列。
#!/bin/sh
set -e
cat <<EOF
set superusers="admin"
password admin password
export superusers
EOF
你必须跑chmod +x /etc/grub.d/00_before_header
下面的补丁将修改名为 的选项Ubuntu
为无密码。
- 将修改
/etc/grub.d/10_linux
- 运行升级-grub
--unrestricted
检查你是否有包含以下选项的菜单项/boot/grub/grub.cfg
补丁/etc/grub.d/10_linux:
--- 10_linux.orig 2020-05-16 05:26:00.107936462 +0000
+++ 10_linux 2020-05-16 05:26:40.040071516 +0000
@@ -190,7 +190,12 @@
fi
echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
else
+ OLD_CLASS="$CLASS"
+ if [ "$(echo "$os" | grub_quote)" = "Ubuntu" ]; then
+ CLASS="$CLASS --unrestricted"
+ fi
echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+ CLASS="$OLD_CLASS"
fi
if [ "$quick_boot" = 1 ]; then
echo " recordfail" | sed "s/^/$submenu_indentation/"
附言:此解决方案适用于 Ubuntu 20.04
PS2:补丁 =>https://en.wikipedia.org/wiki/Patch_%28Unix%29
PS3:补丁格式 =>https://stackoverflow.com/questions/987372/what-is-the-format-of-a-patch-file