Last active
September 29, 2018 02:00
-
-
Save diyism/011028f22812272aac08975fa84295f3 to your computer and use it in GitHub Desktop.
boot ubuntu iso directly from hard disk with grub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#boot into exist linux in /dev/sda1 | |
#download iso file into for example: /home/malcolm/Downloads/lubuntu-18.04-desktop-amd64.iso | |
#sudo subl /boot/grub/grub.cfg: | |
menuentry 'Lubuntu 18.04 ISO' { | |
set isofile='/home/malcolm/Downloads/lubuntu-18.04-desktop-amd64.iso' | |
loopback loop (hd0,1)$isofile | |
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject | |
initrd (loop)/casper/initrd.lz | |
} | |
#sudo reboot | |
#boot menu appear, choose "Lubuntu 18.04 ISO", boot into ISO | |
#sudo umount -l /isodevice | |
#click "Install Lubuntu 18.04" icon to install Lubuntu into /dev/sda2 | |
#choose install grub into /dev/sda2(don't install into /dev/sda), but it will fail silently, we should manually do it in the next 2 lines | |
#mkdir /mnt/sda2 && mount /dev/sda2 /mnt/sda2 && mount --bind /dev /mnt/sda2/dev && mount --bind /proc /mnt/sda2/proc | |
#sudo chroot /mnt/sda2 && sudo grub-install --force /dev/sda2 | |
#use "fdisk /dev/sda" and "a" "1", "a" "2" to toggle boot flag, and verify it with "p" | |
#to fix MBR ruined by grub: testdisk, no log, Proceed, Intel, MBR Code, y, OK, Quit, Quit | |
#sudo reboot | |
#now boot into Lubuntu in /dev/sda2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment