#Time-Saving OS Rescue Commands

Only once machinery has broken down do we become aware of its complexity.

##Booting LFS
```
set root=(hd0,1)
set prefix=(hd0,1)/grub
normal
```

##Booting Gentoo
```
linux (hd0,gpt2)/vmlinuz-<version> root=/dev/vda3
initrd (hd0,gpt2)/initramfs-<version>.img
set root=(hd0,gpt3)
boot
```

##Useful Kernel Parameters
```
pci=nomsi
```

##Creating a New EFI Entry (Useful After CMOS Reset)
```
efibootmgr -c -d /dev/sda -L Arch -l \\EFI\\arch\\grub.efi
```

##No Internet Connection in Chroot Environment
Copy host system's `/etc/resolv.conf` into the chroot environment

##Windows from Grub (BIOS)
```
set prefix=(hd0,msdos1)/boot/grub
insmod normal
normal
```

##Windows from Grub (UEFI)
```
chainloader +1 #Should return "invalid efi path"
ls (hd0,gpt1)/ #Should list "EFI" dir
chainloader (hd0,gpt1)/EFI/Microsoft/bootmgfw.efi
boot
```

##Windows Environment Variable Location
User Variables:
```
HKEY_CURRENT_USER\Environment
```
System Variables:
```
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
```
Note: restart explorer.exe to see changes.

##Windows BCD Problems
```
bootrec /?
bootrec /fixmbr
bootrec /fixboot
bootrec /scanos
bootrec /rebuildbcd
boot
```