Linux has a very important advantage over Windows in a fundamental aspect: You can test it and see if it works correctly on your PC by booting directly from your installation CD., called Live CD. Almost all distros today have this possibility.
However, there are other possibilities, which avoid the need to burn a CD every time the user wants to create a Live CD. The most common is usually copy Linux to USB using a special program and then boot the PC from USB. However, in case you already have GRUB2 installed on your PC, there is another possibility that is little publicized but much faster, more effective and safer. |
Did you burn thousands of CDs to burn your favorite distro images? Did you think that by loading Linux from USB you were on the crest of the wave? Ha! This method saves time and money, since in addition to being ultra-fast, it is much more secure (due to the lack of possible "write errors" and other problems related to reading the Live CD) and avoids the need to burn the files. ISO images to CD or USB.
Steps to follow
1.- Edit the file /etc/grub.d/40_custom
sudo gedit /etc/grub.d/40_custom
2.- Add a new entry to the menu similar to the one shown below:
menuentry "Lubuntu Live"{
set root = (hd0,5)
loopback loop /vbox/lubuntu-10.10.iso
linux (loop) / casper / vmlinuz boot = casper iso-scan / filename =/vbox/lubuntu-10.10.iso --
initrd (loop) /casper/initrd.lz
}
3.- Don't forget to edit the parts that appear in red, where:
- menentry: is the name that will appear in the GRUB2 list when the PC starts up. In my case, like me
- set root: indicates in which partition is the ISO file. To find out what the correct configuration is, the reasoning is simple.
- Where is the ISO image of my favorite distro? On my disk Y, partition X. You probably know what path that disk is mounted to, but not its device name. For it…
- I opened System> Administration> Disk Utility and, after selecting the hard disk on which the partition in question is located, click on the partition to show all its data and characteristics.
- With the partition selected, look for the "Device" label and see what data it shows. In my case it says: / Dev / sda5. Being hda or sda it means that it is disk 1; if it were sdb Oh Db, it would be disk 2. As it is about sda5, it means that it is partition 5 of disk 1. For that matter, "set root" should have (hd0, 5). Grub2 starts the disk count with 0, which is why this setting tells you that the ISO image is on disk 1, partition 5.
linux (loop) / casper / vmlinuz boot = casper locale = es_ES bootkbd = es console-setup / layoutcode = es quiet splash iso-scan / filename = / vbox / lubuntu-10.10.iso -
4.- After saving the file in question, all that remains is to update GRUB2:
sudo update-grub
I just tried this method with Lubuntu 10.10 and it didn't take 20 seconds to fully load! I assure you that this is the best way to try Ubuntu Beta versions or other distros without altering your system, installing Virtual Box, having to burn a CD or spend a USB just to use it as a Live CD, etc.
FILE NOT FOUND
YOU HAVE TO LOAD THE FIRST KERNEL
I have ubuntu 10.10 amd64 installed on ext4, that apparently changes the syntax, which I don't know, and it gives me errors.
I copied the original kernel into the 40_custom file, for it by copying commands, by trial and error, but they all give me the same error.
By doing an ls in grub, the partitions - it must be a thing of the ext4- are named like that, and I don't know why they go between single quotes.
So please: 1, - Clarify that it works for ext2 partitions
2.- Make an extension to boot into ext4 partitions, because I am not clear, and for sure it will be a chorradita, but like the previous thing, I knew that it could be, but I did not find where they would explain it to me, in the even worse ext4 variant.
Thanks in advance
My 40_custom, in which only Ubuntu works
#! / Bin / sh
exec tail -n +3 $ 0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Ubuntu, with Linux 2.6.35-23-generic" –class ubuntu –class gnu-linux –class gnu –class os {
recordfail
insmod part_msdos
insmod ext2
set root = '(hd0, msdos1)'
search –no-floppy –fs-uuid –set c617a74c-d199-49fc-997e-77ebbe33a8bb
linux /boot/vmlinuz-2.6.35-23-generic root = UUID = c617a74c-d199-49fc-997e-77ebbe33a8bb ro quiet splash nomodeset # video = uvesafb: mode_option = >> 1024 × 768-24 <<, mtrr = 3 , scroll = ywrap initrd /boot/initrd.img-2.6.35-23-generic} menuentry "Rescatux" {recordfail insmod part_msdos insmod ext2 set root = '(hd0, msdos1)' loopback loop /isos/rescatux.iso linux ( loop) / casper / vmlinuz boot = casper locale = en_ES bootkbd = en console-setup / layoutcode = en quiet splash iso-scan / filename = / isos / rescatux.iso - initrd (loop) /casper/initrd.lz} menuentry « rescatux2 »{set root = '(hd0, msdos1)' loopback loop /isos/rescatux.iso linux (loop) / casper / vmlinuz boot = casper iso-scan / filename = / isos / rescatux.iso - initrd (loop) / casper / initrd.lz}
Manolo, as it didn't work for me, I switched to Burg and neither, would you be so kind as to paste what you have for Burg - which by the way, I thank you for discovering me, how nice -.
I think my problem stems from the fact that I use ext4, if it is also your case I could use pearls.
incidentally, we could send you an entry on how to install burg, which will persist with updates, and how to add ISO images.
It does not work for me, I tried with a code found on another page and then with a copy of the one you put and I don't get either of the two options in GRUB. I was going through the rest of the grub.cfg and noticed that the parameter for set root goes in single quotes, did you put it like this in your file and it worked? It didn't work out either way for me: /
Manolo, this is not about copy-pasting, as in other cases. Note that the article explains well in detail what things you must change so that everything works in your particular case.
Let me know if you have problems following the instructions ...
A big hug! Paul.
It looks interesting, I'm going to try it ...
Or what an interesting article, this comes in handy ... I usually use a USB with the great Multiboot, mainly because it allows me to have a USB in fat32 with my "live" systems ready to boot on PC's where the system no longer starts (win) and keeping the option to save files on the usb ... but as it is a fat32 system it has the great disadvantage that it does not accept files larger than 4 GB and that is why I LIKE this !!!
regards
You're welcome, delighted that you have explained it so well, now the same thing is missing to do a multiboot from a USB, installing grub2 on it, with the recovery distros and others.
A pleasure to continue reading.
Very good! But if you allow me, I will try to improve it a little.
The /boot/grub/grub.cfg file is generated by a tool called grub-mkconfig using templates that are in the /etc/grub.d/ path, therefore, every time a new grub file is generated (for For example, when a new kernel enters, or an update of the same, or when the update-grub command is executed manually) the system replaces the previous file with the new one, deleting any entry that we have inserted manually. In other words, the entries would have to be inserted into the file every time there was a change in grub, which happens very often.
Therefore, my suggestion is that you DO NOT edit the /boot/grub/grub.cfg file, but rather the template that corresponds to the system you want to boot from. In this case, as it is a "custom" entry, it should go in the /etc/grub.d/40_custom file, which is the one prepared to add custom entries.
This way, our custom entry will always be added automatically every time the system generates a new grub.cfg.
This is how I have it to boot from a SystemRescueCD iso image, and it works like a charm 😉
Greetings all.
You have all the reason! Thank you for reminding me. Right now I add that modification.
It's me again 😉
I forgot to tell you in my previous message that if the /etc/grub.d/40_custom file or any other template is modified, it is necessary to update the grub using the update-grub command.
Greetings, and keep it up !! 🙂
Ready! Thanks again! 🙂
That good! This is very useful! Thank you very much 😀
If we want an Ubuntu image (for other distros I don't make sure it works):
· Start with the menus and windows in Spanish, as well as the keyboard layout
That during boot, instead of kernel messages, show the loading image (splash)
the fourth line would be:
linux (loop) / casper / vmlinuz boot = casper locale = es_ES bootkbd = es console-setup / layoutcode = es quiet splash iso-scan / filename = / vbox / lubuntu-10.10.iso -
The quiet is used to group equal inputs.
By the way, it would be nice if you made it clearer that sudo update-grub must be done once the indicated file has been modified and saved.
Yes yes I know that I should not copy it verbatim haha I did not do it like that, I did modify according to my team and I already found out what the problem was, that I do not use grub but burg xD
Hola!
I have configured it to boot an Ubuntu 10.10 Live and it works perfectly (I will put a link on my blog to this article), here is my configuration:
menuentry "Ubuntu 10.10 Live" {
set root = (hd0,1)
loopback loop /home/fraterneo/ubuntu-10.10-desktop-i386.iso
linux (loop) / casper / vmlinuz boot = casper quiet splash iso-scan / filename = / home / fraternal / ubuntu-10.10-desktop-i386.iso -
initrd (loop) /casper/initrd.lz
}
However, I have tried to do it with a Fedora 13 Live cd to which I have put this configuration:
menuentry “Fedora 13 Live” {
set root = (hd0,1)
loopback loop /home/fraterneo/Fedora-13-i686-Live.iso
linux (loop) / EFI / boot / vmlinuz0 root = live: LABEL = Fedora-13-i686-Live rootfstype = auto ro liveimg quiet rhgb
initrd (loop) /EFI/boot/initrd0.img
}
Which in the boot process (splash image) gives me the following error:
No root device found
Boot has failed, sleeping forever
I have not found the possible solution yet. Let's see if any of you are encouraged and investigated further.
A greeting!.
Better to use gksudo gedit, not sudo gedit.
Magnificent brother, the possibilities that GRUB gives are incredible, now I have how to demonstrate several Live without using CD hehehe! Excellent!
Is it possible to do it with grub4dos?
The truth is I do not know. 🙁
Let us know if you discover something ...
Cheers! Paul.
Checked. These parameters work only for Ubuntu. The / casper folder and the vmlinuz and initrd.lz files are only found on the * buntu distros. In Fedora it is completely different, so such parameters do not work. I am researching the subject.
Hi miguel! The truth is that I do not see much difference with the command recommended in the post. Anyway, as far as I understand, it doesn't matter what format (EXT2 or EXT4 or any other) your boot is in. In fact, I have it in ext4 and the code in the post worked perfect for me.
What I recommend is the following:
1) that you make sure the isofile path exists. That is, in the case of the code included in the post, that /vbox/lubuntu-10.10.iso exists. For that, I simply opened Nautilus, navigate to the folder in question, and see if the ISO file exists.
2) the second point that may be creating problems is root. Check that the root is correct. The post explains how to know what value to assign to that variable. Otherwise, what you have left is to do trial and error.
In any case, this code that is included in the post is not simple to copy-paste. You have to change the data that are marked in red and adapt them according to your case.
A hug! Paul.
2)
I knew how it was done in GRUB 1 but not in 2 😀
I have linked you in the comment of a tutorial I made to make a Multiboot Pendrive http://www.youtube.com/watch?v=FbpYNSuaNTI&hd=1
All the best
Whoops! Very good tutor !!
I was just about to write a post on the subject (multiboot pendrive). When I do, I will surely include your video. If you don't mind, of course ... and always clarifying the source and your authorship, of course.
Thank you for the time and for sharing your knowledge with the community.
A big hug! Paul.
I have a question, somewhat particular, if for example I only have windows xp installed, and no distro, but I already have the partitions prepared, how or what should you do to only install just what is fair and necessary, so that I start GRUB2, to make that boot the ISO that I have in Another Hard Drive ???
Well let's see, the idea is that in the partition where I'm going to install the new distro, it only has the entry of / boot / grub and maybe a Kernel 2.6, and its configurations, so that later during the installation it is updated.
The main idea is to save a lot of time, I do not see the point to install a distro, to modify grub, to install another, if installing only grub, I can start the iso directly, without the need for CD or USB.
Well, anyway, if I have a distro installed it's Slackware64, but anyway, I'm going to download the updated Chakra Linux ISO to see if I can get xD to install this time
http://ubuntuforums.org/showthread.php?t=1632692
I have been given here an alternative solution that looks nice.
BUT IT STILL DOES NOT WORK, apparently due to having the boot in EXT4
menuentry "Ubuntu 10.10 Maverick ISO 64bit" {
set isofile = »/ boot / ISO / maverick-desktop-amd64.iso»
loopback loop (hd0,5) $ isofile
linux (loop) / casper / vmlinuz boot = casper iso-scan / filename = $ isofile nomodeset
initrd (loop) /casper/initrd.lz
}
For previously, what would the entry be like?
I have a problem with a notebook where the Grub boot (grub2) was blocked, I had Huayra (Debian version of Linux) and Windows 8, they changed the grub.cfg and the boot was blocked.
That would not be a problem, except that when I want to boot from a LiveUSB, the notebook restarts and does not boot from the USB, and the Setup cannot be changed.
I would like to know how I can copy an ISO from a pendrive to the hard drive and run it from there (ISO of the LiveUSB).
Thank you
Hi, Pablo!
We recommend that you ask this question in our question and answer service called Ask DesdeLinux so that the whole community can help you with your problem.
A hug, Pablo.
How can I do it with ubuntu 15.04 mate amd64. Putting the kernel maybe the solution?
I have two disks, in the first Ubuntu 10.04 with ext4 system. In the second I have an ext4 partition and another with ntfs. In the second, in the ext4 partition I copied the iso and extracted it in place. I followed all the steps of the tutorial, with respective modifications according to my disk location.
After restarting, and the grub entry appeared, in my case, "Ubuntu mate 15.04", I did not enter the installation but it came out that there was no kernel to select. What could I have done wrong? I would appreciate an answer.
It doesn't work for me, on Linux Mint.
I tested it with ubuntu 14.04.02 and with bodhi Linux.
On an ntfs partition and on an ext4
A new line is created in the grub but when selecting it nothing starts, the screen is black.
Greetings.
Good morning, friends of this medium, I have a problem with the menuentry of my grub2, it goes like this.
1-slackware x64 efi
2-I have windows 7 installed
* I just changed the keyboard and I was surprised that the slack did not show me, looking for information I observed that it was a menuentry problem, I took an iso of the same slack, entered and gave the 3rd option where it says that it does not recognize the boot /, and to be honest I don't know what to do after that, if someone can explain me how to get my slack back, I would appreciate it .. or send me a url where they explain the steps
Thanks in advance dear friends of this wonderful blog
Good friends I have a question maybe it is silly for some ... I have created an installer for Ubuntu LTS, the last one available to download the 16.04 desktop version I want to install it as a single system on an Asus Prime Z2027-A with a Celeron Processor and a Ram 4 Gb with a 256 Gb SDA ... what is necessary for what is going to be used, Ethereum mining.
The problem is that I put the USB already with the ISO inserted with the UNEBOOTIN…. I turn on the computer to boot from the USB and directly before entering the installation mode with graphical interface, the GRUB boot system starts, which the computer and all its components are boxed, they have absolutely nothing so I assume that it is a matter of the Ubuntu with Grub…. detects all the devices I did an LS to see that there was ...
The problem is basic I want to install UBUNTU but I only get to Grub>
Literal
Thanks in advance.