Grub Boot From Iso
If your ISO file contains the file /boot/grub/loopback.cfg, this ISO file is designed to allow it to boot from an ISO file. What is a loopback.cfg? A loopback.cfg is basically just a grub.cfg that’s designed to be used to boot a live distribution from an iso file on a filesystem rather than an actual physical CD. Read more about loopback.cfg.
Linux’s GRUB2 boot loader can boot Linux ISO files directly from your hard drive. Boot Linux live CDs or even install Linux on another hard drive partition without burning it to disc or booting from a USB drive.
- Oct 29, 2017 If your ISO file contains the file /boot/grub/loopback.cfg, this ISO file is designed to allow it to boot from an ISO file. What is a loopback.cfg? A loopback.cfg is basically just a grub.cfg that’s designed to be used to boot a live distribution from an iso file on a filesystem rather than an actual physical CD. Read more about loopback.cfg.
- Whether you want to recover access to your unbootable GNU/Linux or you have forgotten your Windows password Rescatux is for you. Use Super Grub2 Disk whenever you cannot boot into any of your systems.
We performed this process on Ubuntu 14.04 — Ubuntu and Ubuntu-based Linux distributions have good support for this. Other Linux distributions should work similarly.
Get a Linux ISO File
RELATED:How to Configure the GRUB2 Boot Loader’s Settings
This trick requires you have a Linux system installed on your hard drive. Your computer must be using the GRUB2 boot loader, which is a standard boot loader on most Linux systems. Sorry, you can’t boot a Linux ISO file directly from a Windows system using the Windows boot loader.
Download the ISO files you want to use and store them on your Linux partition. GRUB2 should support most Linux systems. if you want to use them in a live environment without installing them to your hard drive, be sure to download the “live CD” versions of each Linux ISO. Many Linux-based bootable utility discs should also work.
Check the Contents of the ISO File
You may need to look inside the ISO file to determine exactly where specific files are. For example, you can do this by opening the ISO file with the Archive Manager/File Roller graphical application that comes with Ubuntu and other GNOME-based desktop environments. In the Nautilus file manager, right-click the ISO file and select Open with Archive Manager.
Locate the kernel file and the initrd image. If you’re using a Ubuntu ISO file, you’ll find these files inside the casper folder — the vmlinuz file is the Linux kernel and the initrd file is the initrd image. You’ll need to know their location inside the ISO file later.
Determine the Hard Drive Partition’s Path
GRUB uses a different “device name” scheme than Linux does. On a Linux system, /dev/sda1 is the first partition on the first hard disk — a means the first hard disk and 1 means its first partition. In GRUB, (hd0,1) is equivalent to /dev/sda0. The 0 means the first hard disk, while the 1 means the first partition on it. In other words, in a GRUB device name, the disk numbers start counting at 0 and the partition num6ers start counting at 1 — yes, it’s unnecessarily confusing. For example, (hd3,6) refers to the sixth partition on the fourth hard disk.
You can use the fdisk -l command to view this information. On Ubuntu, open a Terminal and run the following command:
sudo fdisk -l
You’ll see a list of Linux device paths, which you can convert to GRUB device names on your own. For example, below we can see the system partition is /dev/sda1 — so that’s (hd0,1) for GRUB.
Create the GRUB2 Boot Entry
The easiest way to add a custom boot entry is to edit the /etc/grub.d/40_custom script. This file is designed for user-added custom boot entries. After editing the file, the contents of your /etc/defaults/grub file and the /etc/grub.d/ scripts will be combined to create a /boot/grub/grub.cfg file — you shouldn’t edit this file by hand. It’s designed to be automatically generated from settings you specify in other files.
You’ll need to open the /etc/grub.d/40_custom file for editing with root privileges. On Ubuntu, you can do this by opening a Terminal window and running the following command:
sudo gedit /etc/grub.d/40_custom
Feel free to open the file in your favorite text editor. For example, you could replace “gedit” with “nano” in the command to open the file in the Nano text editor.
Unless you’ve added other custom boot entries, you should see a mostly empty file. You’ll need to add one or more ISO-booting sections to the file below the commented lines.
Here’s how you can boot an Ubuntu or Ubuntu-based distribution from an ISO file. We tested this with Ubuntu 14.04:
menuentry “Ubuntu 14.04 ISO” {
set isofile=”/home/name/Downloads/ubuntu-14.04.1-desktop-amd64.iso”
loopback loop (hd0,1)$isofile
linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=${isofile} quiet splash
initrd (loop)/casper/initrd.lz
}
Customize the boot entry to contain your desiredmenu entry name, the correct path to the ISO file on your computer, and the device name of the hard disk and partition containing the ISO file. If the vmlinuz and initrd files have different names or paths, be sure to specify the correct path to those files, too.
(If you have a separate /home/ partition, omit the /home bit, like so: set isofile=”/name/Downloads/${isoname}”).
Important Note: Different Linux distributions require different boot entries with different boot options. The GRUB Live ISO Multiboot project offers a variety of menu entries for different Linux distributions. You should be able to adapt these example menu entries for the ISO file you want to boot. You can also just perform a web search for the name and release number of the Linux distribution you want to boot along with “boot from ISO in GRUB” to find more information.
If you want to add more ISO boot options, add additional sections to the file.
Save the file when you’re done. Return to a Terminal window and run the following command:
sudo update-grub
The next time you boot your computer, you’ll see the ISO boot entry and you can choose it to boot the ISO file. You may have to hold Shift while booting to see the GRUB menu.
Grub Repair Iso
If you see an error message or a black screen when you attempt to boot the ISO file, you misconfigured the boot entry somehow. Even if you got the ISO file path and device name right, the paths to the vmlinuz and intird files on the ISO file may not be correct or the Linux system you’re booting may require different options.
READ NEXT- › What Does “FWIW” Mean, and How Do You Use It?
- › How to Automatically Delete Your YouTube History
- › What Is “Mixed Content,” and Why Is Chrome Blocking It?
- › How to Manage Multiple Mailboxes in Outlook
- › How to Move Your Linux home Directory to Another Drive
This tutorial will guide you on how to rescue, repair or reinstall a damaged Ubuntu machine which cannot be booted due to the fact that the Grub2 boot loader has been compromised and cannot load the boot loader which transfers the control further to the Linux kernel. In all modern Linux operating systems GRUB is the default boot loader.
This procedure has been successfully tested on an Ubuntu 16.04 server edition with the Grub boot loader damaged. However, this tutorial will only cover Ubuntu server GRUB rescue procedure, although the same procedure can be successfully applied on any Ubuntu system or on the majority of Debian-based distributions.
Requirements
You try to boot your Ubuntu server machine and you see that the operating systems no longer starts-up and you discover that the boot loader program no longer works?
Typically, the GNU GRUB minimal console appears on your screen, as illustrated on the below screenshot. How can you restore the Grub in Ubuntu?
There are a lot of methods in Linux that can be used to re-install a broken grub, some can involve the ability to work and restore the boot loader by using the Linux command line and others are fairly simple and implies booting the hardware with a Linux live CD and using the GUI indications to repair the damaged boot loader.
Among the simplest methods, that can be used in Debian based distributions, especially on Ubuntu systems, is the method presented in this tutorial, which involves only booting the machine into the Ubuntu live DVD ISO image.
Boot From Iso Image
The ISO image can be downloaded from the following link: http://releases.ubuntu.com/
Reinstall Ubuntu GRUB Boot Loader
1. After you’ve downloaded and burned the Ubuntu ISO image, or created a bootable USB stick, place the bootable media into your appropriate machine drive, reboot the machine and instruct the BIOS to boot into Ubuntu live image.
Machine Boot Menu
2. On the first screen, choose the language and press [Enter] key to continue.
3. On the next screen, press F6
function key in order to open the other options menu and select Expert mode option. Then, hit Escape key to return to Boot Options line in editing mode, as illustrated in the below screenshots.
Ubuntu Expert Mode
4. Next, edit Ubuntu live image boot options by using the keyboard arrows to move the cursor just before the quiet
string and write the following sequence as illustrated in the below screenshot.
Enable Ubuntu Rescue Boot Option
5. After you’ve wrote the above statement, press [Enter] key to instruct the live ISO image to boot into rescue mode in order to Rescue a broken system.
Grub Boot Iso Ubuntu
6. On the next screen select the language you want to perform the system rescue and press [enter] key to continue.
Choose Language in Rescue Mode
7. Next, select your appropriate location from the presented list and press [enter] key to move further.
8. On the next series of screens, select your keyboard layout as illustrated in the below screenshots
Configure Keyboard Download microsoft virtual wifi miniport adapter.
Select Keyboard Layout
9. After detecting your machine hardware, loading some additional components and configuring the network you will be asked to setup your machine hostname. Because you’re not installing the system, just leave the system hostname as default and press [enter] to continue.
Keep System Hostname
10. Next, based on the supplied physical location the installer image will detect your time zone. This setup will accurately work only if your machine is connected to internet.
However, it’s unimportant if your time zone is not correctly detected, because you are not performing a system installation. Just press Yes
to continue further.
11. On the next screen you’ll be directly transferred into rescue mode. Here, you should choose your machine root file system from the provided list. In case your installed system uses a logical volume manager to delimit partitions, it should be easy to detect your root partition from the list by reviewing volume group names as illustrated in the below screenshot.
Otherwise, in case you’re not sure which partition is used for the /(root)
file system, you should try to probe each partition until you detect the root file system. After selecting the root partition press [Enter] key to continue.
Choose Root Partition
12. In case your system has been installed with a separate /boot
partition, the installer will ask you whether you want to mount the separate /boot partition. Select Yes
and press [Enter] key to continue.
13. Next, you will be provided with Rescue operations menu. Here, select the option to Reinstall the GRUB boot loader and press [enter] key to continue.
Reinstall Ubuntu Grub Loader
14. On the next screen, type your machine disk device where the GRUB will be installed and press [Enter] to continue, as shown in the below image.
Usually, you should install the boot loader on your first machine hard disk MBR, which is /dev/sda
in most cases. The installation process of GRUB will start as soon as you hit the Enter key.
15. After the live system installs the GRUB boot loader you will be directed back to main rescue mode menu. The only thing left now, after you’ve successfully repaired your GRUB, is to reboot the machine as shown in the below images.
Installing Ubuntu Grub Boot Loader
Finally, eject the live bootable media from the appropriate drive, reboot the machine and you should be able to boot into the installed operating system. The first screen to appear should be installed operating system GRUB menu, as illustrated in the below screenshot.
Ubuntu Boot Menu
Manually Reinstall Ubuntu Grub Boot Loader
14. However, if you like to manually reinstall the GRUB boot loader from Rescue operations menu, follow all the steps presented in this tutorial until you reach point 13, where you make the following changes: instead of choosing the option to reinstall GRUB boot loader, select the option which says Execute a shell in /dev/(your_chosen_root_partition and press [Enter] key to continue.
15. On the next screen hit Continue by pressing [enter] key in order to open a shell in your root file system partition.
Open Shell Mode
16. After the shell has been opened in the root file system, execute ls command as presented below in order to identify your machine hard disk devices.
After you’ve identified the correct hard disk device (usually the first disk should be /dev/sda
), issue the following command to install the GRUB boot loader on the identified hard disk MBR.
After GRUB has been successfully installed leave the shell prompt by typing exit.
17. After you’ve exited the shell prompt, you will be returned to main rescue mode menu. Here, choose the option to reboot the system, eject the live bootable ISO image and your installed operating system should be booted without any issue.
Reboot System
That’s all! With a minimal effort you’ve successfully rendered your Ubuntu machine the ability to boot the installed operating system.