Hi,
NUC NUC7i5BNH, Windows 10, LibreELEC, Dual boot, UEFI, Grub2
I just want to share the steps I used to set up dual boot. All you need is Ubuntu Live on bootable USB, no need to use any extra tools on windows or hack the EFI stuff.
Next step would be to create
- a simple win10 app and
- a simple LibreElec plugin
to set next-time-default-boot-entry, but if your (remote) keyboard works at boot time, you can easily select which OS to boot...
R, Janos
Note: all these are typed in w/o copy&pasting so expect typos!
1. Install Win10 in UEFI mode
First install Windows 10. Make sure you boot in UEFI mode to do the install. Let windows create all the extra partitions but make sure you leave enough space behind for LibreELEC:
Partitions created:
/dev/sda1 NTFS Recovery 500MB hidden,diag
/dev/sda2 FAT32 EFI system 100MB boot,esp
/dev/sda3 unknown MS Reserved 16MB msftres
/dev/sda4 NTFS Windows 120GB msftdata
<leave enough unused space behind for LibreElec: ~8-16G>
2. Boot Ubuntu 18.04 Live in UEFI mode
Everything you have to do in a terminal must be with root! - so always start with:
2.a. Use GParted and create extra partitions for LibreELEC
/dev/sda5 FAT32 Grub Boot Manager 100MB Label=GRUB
/dev/sda6 EXT3 LibreElec Boot 1024MB Label=BOOT
/dev/sda7 EXT4 LibreElec Storage 16GB Label=STORAGE
Note: set the LibreElec Storage size to what fits for you
3. Copy LibreElec to target file-system
- As usual, create an USB boot drive
- Plug-in the USB drive while still in Ubuntu Live
- USB drive should auto-mount under /media/ubuntu/LIBREELEC
- Copy two files to the LibreElec boot partition
mkdir /mnt/sda6
mount /dev/sda6 /mnt/sda6
cp /media/ubuntu/LIBREELEC/KERNEL /mnt/sda6/
cp /media/ubuntu/LIBREELEC/SYSTEM /mnt/sda6/
umount /mnt/sda6
4. Configure UEFI
4.a. Update the live session to get latest grub2 and tools
4.b. Install Grub2
# mount the target partition
sudo su
mkdir /mnt/sda5
mount /dev/sda5 /mnt/sda5
# install grub2 to EFI
grub-install --target=x86_64-efi --bootloader-id=LibreElec --boot-directory=/mnt/sda5 --efi-directory=/mnt/sda5
# check that libreElec is the new default
efibootmgr -v
4.c. Create grub config files
The grub-efi configuration
The grub-menu configuration:
cat << EOF > /mnt/sda5/grub/grub.cfg
set default=0
set timeout=5
insmod efi_gop
insmod efi_uga
insmod font
loadfont /grub/fonts/unicode.pf2
menuentry "LibreElec" {
insmod part_gpt
insmod ext2
set root='hd0,gpt6'
linux /KERNEL boot=/dev/sda6 disk=/dev/sda7 quiet
}
menuentry "Microsoft Windows x86_64 UEFI-GPT" {
insmod part_gpt
insmod fat
insmod chain
set root='hd0,gpt2'
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
EOF
Display More
4.d. Clean up and reboot
Optional steps:
- if you want to use UUID instead of fixed partitions:
2.b. Record what UUIDs are there for the following partitions (e.g. from GParted, using information on the partitions):
- /dev/sda2 - the EFI partition
- /dev/sda6 - the LibreElec boot partition
- /dev/sda7 - the LibreElec storage partition
4.c. Use the below menu-entries in the grub/grub.cfg:
menuentry "LibreElec" {
# boot: /dev/sda6 UUID: ABCD-EFGH-JKLM-1234
# stor: /dev/sda7 UUID: 1234-DCBA-8765-MLKJ
insmod part_gpt
insmod ext2
insmod search_fs_uuid
set root='hd0,gpt6'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6 ABCD-EFGH-JKLM-1234
else
search --no-floppy --fs-uuid --set=root ABCD-EFGH-JKLM-1234
fi
linux /KERNEL boot=UUID=ABCD-EFGH-JKLM-1234 disk=UUID=1234-DCBA-8765-MLKJ quiet
}
menuentry "Microsoft Windows x86_64 UEFI-GPT" {
# EFI: /dev/sda2 UUID: QWER-9876
insmod part_gpt
insmod fat
insmod search_fs_uuid
insmod chain
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 QWER-9876
else
search --no-floppy --fs-uuid --set=root QWER-9876
fi
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
Display More