ls /dev/sda* --color=no
# Install on MBR
grub-install /dev/sda
# Defaul config fike
grep -E '^#?GRUB.+' --color=no /etc/default/grub
GRUB_DEFAULT
saved
(sudo grub-set-default
). GRUB_SAVEDEFAULT
true
, then, when an entry is selected, save it as a new default entry for use by future runs of GRUB. GRUB_TIMEOUT
0
to boot immediately without displaying the menu, or to -1
to wait indefinitely. GRUB_HIDDEN_TIMEOUT
GRUB_HIDDEN_TIMEOUT
, you should also set GRUB_TIMEOUT=0
so that the menu is not displayed at all unless ESC is pressed. GRUB_HIDDEN_TIMEOUT_QUIET
GRUB_DISTRIBUTOR
GRUB_CMDLINE_LINUX_DEFAULT
GRUB_DISABLE_RECOVERY
is set to true
, two menu entries will be generated for each Linux kernel: one default entry and one entry for recovery mode. This option lists command-line arguments to add only to the default menu entry, after those listed in
GRUB_CMDLINE_LINUX
. GRUB_CMDLINE_LINUX
GRUB_RECORDFAIL_TIMEOUT
-1 wait
0 do not wait no matter what
>0 wait x second
GRUB_DISABLE_SUBMENU
y
lsb_release -i -s || echo debian
grub-mkconfig -o /boot/grub/grub.cfg # /boot/grub2/grub.cfg in some: grub.conf
update-grub
whatis update-grub
head -5 /boot/grub/grub.cfg
grub.cfg is overwritten by certain Grub 2 package updates, whenever a kernel is added or removed, or when the user runs update-grub.
ls /etc/grub.d
grep "*" /etc/grub.d/README
Persons with physical access to the computer can gain access to the files via other methods which GRUB 2 cannot prevent.
# What people do
sudo nano /etc/grub.d/00_header
sudo nano /etc/grub.d/01_users
# Should use cat << END ... END
# What I do
sudo cp /etc/grub.d/40_custom /etc/grub.d/42_custom
Can select/edit anything and have access to terminal.
set superusers="ravexina"
password ravexina 123
# -- other users optional -- #
password milad 111
password userb 222
grub-mkpasswd-pbkdf2
Enter password:
Reenter password:
PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.048CFA9270E0BC8ECF22A27100538B0864C224E50E9179E018CBDF16FEB788C5D8510158BA65195885E5DB1D2A634C0AAEDF5268A1BF519C64BEB0E3DAF9B208.8E7D8ECC5662FA2431AF078B400788EF93937A324D92B0BC71400554D3E5949092F8CD7851995300479C71BC31E820C43065993CD395DAE4A1FAFC681DB1C668
set superusers="milad"
password_pbkdf2 milad grub.pbkdf2.sha512.10000.048CFA9270E0BC8ECF22A27100538B0864C224E5...
menuentry --class os "May be run by any user" --unrestricted {
menuentry --class os "Superusers only" --users "" {
menuentry --class os "May be run by user1 and user2 or a superuser" --users user1,user2 {
# to protect them all
grep "echo \"menuentry" /etc/grub.d/10_linux
# To other os's
sed -n "/--class os/p" /etc/grub.d/30_os-prober
sudo sed -i "s/--class os/--class os --users milad,karam" /etc/grub.d/30_os-prober
grep -Poz "menuentry 'Ubuntu' (.|\n)*?\}" /boot/grub/grub.cfg
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
search --no-floppy --fs-uuid --set=root 3c52f-1134-1
linux /vmlinuz
initrd /initrd.img
}
# GRUB_DISABLE_OS_PROBER=true
sudo chmod -x /etc/grub.d/10_linux /etc/grub.d/20_linux_xen /etc/grub.d/30_os-prober
ll /vmlinuz
sudo nano /boot/grub/menu.lst # mostly symlink to -> ./grub.conf
sudo nano /etc/lilo.conf
sudo lilo
man 5 lilo.conf
man 8 lilo
ipynb
format: https://github.com/ravexina/linux-notes. html
exports of project available at: https://ravexina.github.io/linux-notes.Linux Notes by Milad As (Ravexina) is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.