Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19
Hi everyone! Don't know if I'm in the right section, I thought this suited the most. Feel obviously free to move where you think it suits better if you think ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! HisDudeness's Avatar
    Join Date
    Jun 2012
    Location
    Melzo, Milan (Italy)
    Posts
    23

    Need help creating a multi-bootable USB recovery drive


    Hi everyone! Don't know if I'm in the right section, I thought this suited the most. Feel obviously free to move where you think it suits better if you think I'm in the wrong place, and sorry 'bout that.

    I was planning on creating a USB recovery flash drive (my laptop got no optical reader) containing more than one live "distro" to suit for every recovery need. More specifically, I wanted to suit in my pen drive LMDE, GParted, Clonezilla and qt4-fsarchiver (obviously all live versions), making it bootable myself with a grub menu which let me choose all those options.

    The first thing I did was obviously making a fat partition for each Live tool, then copying in them the contents of the isos/zips downloaded from the original sites. The problem was obviously making it bootable.

    I'm currently in my LMDE system, but I don't think that matters, as well as the specific wanted configuration of my pen drive. The first partition, /dev/sdb1, is the LMDE Live one, which I want to use to install grub2 into. I followed some instructions I found in the internet and addressed this command:

    sudo grub-install --force --no-floppy --root-directory=/media/LMDE /dev/sdb1

    The output message was everything went fine. I then copied my grub.cfg into /media/LMDE/boot/grub, because it was missing one, and manually edited it (bad idea?) creating my choice menu on my own and substituting my system partition's UUID with the USB's LMDE one wherever it appeared. But my USB key does not boot, it doesn't even give "grub loading" message. For all that matters, I also enabled "boot" flag in that partition with GParted too. What did I get wrong?

    I know I shouldn't edit grub.cfg on my own, but my USB booting partition obviously got no grub.d directory and default/grub file, and I wouldn't know how to address from my main system an update-grub referred to my USB anyway. I'm pretty puzzled after grub-install I lack grub.cfg too. What should I do?

    I'd ask you also how the menu voices for each Live tool should be compiled (they obviously are all classic live distros, with a live or casper directory with kernel, initial ram disk and filesystem.squashfs to copy to RAM), but I have that major and previous problem, so I'd talk about that later. Thanks for your attention!

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Hi,

    I did the exact same thing with a USB drive, but it is at work, and I don't remember the exact instructions. I can look at the partition table on Tuesday and let you know (if you don't figure it out by then).

    I can tell you that I used legacy grub, not grub2 (which is way too complicated for my tastes).

  3. #3
    Just Joined! HisDudeness's Avatar
    Join Date
    Jun 2012
    Location
    Melzo, Milan (Italy)
    Posts
    23
    Quote Originally Posted by atreyu View Post
    Hi,

    I did the exact same thing with a USB drive, but it is at work, and I don't remember the exact instructions. I can look at the partition table on Tuesday and let you know (if you don't figure it out by then).

    I can tell you that I used legacy grub, not grub2 (which is way too complicated for my tastes).
    Thanks, any help is appreciated, if it is not a nuisance to you. As for legacy grub, the fact is I just got a little used to grub2, I mean, I only learned the basic commands and procedures, and just began to understand how it works, but it took me a considerable time, given how busy I am, so converting to legacy would be an ulterior effort to me.

    Anyway, I am a dumbass. The first problem is solved. Re-reading my post just now I found strange that in the command i gave the partition /dev/sdb1 instead of the device /dev/sdb. I thought of a typo, but I remembered that to write it in this forum I copied that line from my terminal, so I actually wrote it wrong in the main procedure itself. I repeated by giving the right device and now grub starts.

    The problem is, I believe because of the lack of a grub.cfg, no menu is shown, just a command line interface. I'm able to load the kernel and the initial ramdisk and boot them, but the system will not start as I imagine I must load filesystem.squashfs too, considering is almost as big as the whole package itself for all four live tools. The fact is I don't know how. So, first question is: how do I load filesystem.squashfs to RAM in the GRUB cli?

    Also, once I know howto and I can succesfully boot into my live distribution with grub by giving commands myself, all problems aren't solved yet, I can't do all that everytime I have to use one of those tools. I need an automatic menu, but the problem is I don't really know how to create and regulate it, in absence of a grub.d directory and a default/grub file update-grub can read to setup my bootloader. Also, I'm sure I'll mess everything up by putting commands into my terminal to make automatic grub's tools modify my USB's bootloader wile logged into a system with a grub of its own. Plus, I'm not sure that command installed grub2 into my USB, as I can read "GNU GRUB version 1.99-23" on top of my USB's Grub cli, and I've read grub does not support and use grub.cfg, which is a grub2 exclusive feature. So, other questions are: how do I install grub2 into my USB flash drive? How do I create and setup its menu?

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by HisDudeness View Post
    how do I install grub2 into my USB flash drive? How do I create and setup its menu?
    you could try to follow this guide, for installing multiple Live ISO images to a USB drive (basically what I did). you can skip to the part about using their grub.cfg file and see if you can edit it to your liking.

  6. #5
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    sudo grub-install --force --no-floppy --root-directory=/media/LMDE /dev/sdb
    If the flash drive you are using shows as sdb, the above command will install Grub2 to the mbr of that drive. You will need to create your own grub.cfg file. Copy the grub.cfg file from an installed system and delete all the menuentry lines. Make sure you are deleting in the correct grub.cfg. You can just copy the iso file for Mint to sdb1 and use a loopback entry. The entry below works for me for Mint 13. You would need to change the name of the iso file to the actual name rather than "mint13.iso" which I use as well as changing the (hd0,5) to whatever is appropriate. The initrd line will probably need to be changed from intird.gz to initrd.lz.

    menuentry "Mint 13" {
    loopback loop (hd0,5)/mint13.iso
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/mint13.iso quiet splash --
    initrd (loop)/casper/initrd.gz
    }
    You will probably be able to do the same with GParted. Just copy the iso file to sdb1 and put an entry in the grub.cfg file. The entry below worked for me for Parted Magic.

    menuentry "Parted Magic"{
    loopback loop (hd0,5)/pmagic_2012_05_30.iso
    linux (loop)/pmagic/bzImage
    initrd (loop)/pmagic/initrd.img
    }
    You will need to make the same changes as above with the actual name of the iso and the linux and initrd lines will need to be modified. You should be able to loop mount the gpaarted iso and take a look at the isolinux.cfg file to make the modifications. I don't know if you would be able to boot a Clonezilla iso this way, haven't tried it.

  7. #6
    Just Joined! HisDudeness's Avatar
    Join Date
    Jun 2012
    Location
    Melzo, Milan (Italy)
    Posts
    23
    Thanks to both. For the command, I already referred to another guide of the same site, which specifically was for Ubuntu, and for that reason I did not get further by downloading their grub.cfg file. Instead, I copied and modified mine, but wasn't sure about all the changes I've done and I had to make. Instead, the page suggested by atreyu is more or less for what I want to do, so I wgot the file. The problem is, if I got that right, the option both yancek and atreyu's link suggest is to make an unique partition to copy all isos in, and make grub mount them via loop device. I'd prefer having the files already extracted in dedicated partitions, both because some distros I'd want are in zips, so I should extract them and recompact them as isos, and because it should boot faster this way, if I'm not being deceived by appearances. So, if you could help me this way, it would be even better for me.

    Anyway, if I did not get it wrong, you are telling me there's nothing wrong in manually editing grub.cfg here, and it's in fact the way it should be done. So, let's suppose I have extracted my LMDE iso in the partition /dev/sdb5 (got it in a logical partition to override the natural limit of four of them), and it has a casper folder with vmlinuz, initrd.lz and filesystem.squashfs in it. How should I write my menu entry? Will this work?

    Code:
    menuentry "LMDE 201204 live" {
          set root=(hd0,5)
          linux /casper/vmlinuz boot=live config union=aufs noswap noprompt ip=frommedia live-media-path=/casper bootfrom=/dev/sda5 toram=filesystem.squashfs
          initrd /casper/initrd.lz
        }
    Or how do I have to edit this?

    (Edited GParted's one to make this, it's the only one that tells me how to configure a grub voice for live boot; not knowing the operating differences between those, I don't know what should I further change)
    Last edited by HisDudeness; 02-19-2013 at 02:12 PM. Reason: Typo and CODE tags

  8. #7
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    You can manually edit the grub.cfg fle. The reason you are told not to is because if you run update-grub, any entry you manually place in grub.cfg will not remain unless you also have the entry in the /etc/grub.d/40_custom file. In your case, you should not have any reason to update-grub on the flash so it will work.

    Guides for Ubuntu should work for Mint as the grub2 should be the same.
    I don't know that you will be able to boot iso files for any system. It is not likely to work. Ubuntu derivatives and PMagic, GParted work but I haven't tried with others and I doubt any system that does not boot with Grub2 by default will boot an iso.

    You should be able to boot LMDE and GParted as iso files from grub.cfg. You don't need all the options you posted, the simpler entry I posted earlier works fine and I booted it and used it to install Mint to another partition on another drive. You could extract the other two and put entries in the grub.cfg file for them.

    Below is an example of booting an extracted system with Grub2, it is Puppy Linux but you should get the idea.
    menuentry "Puppy"{
    insmod part_msdos
    insmod ext2
    set root='/dev/sda,msdos5)'
    search --no-floppy --fs-uuid --set=root 47891df9-aa27-4df9-99ac-aa96276780ac
    linux /puppy/vmlinuz root=UUID=47891df9-aa27-4df9-99ac-aa96276780ac
    initrd /puppy/initrd.gz
    }
    The entry below should work for an extracted Mint:

    menuentry "LMDE"{
    insmod part_msdos
    insmod ext2
    set root='/dev/sda,msdos5)'
    search --no-floppy --fs-uuid --set=root 47891df9-aa27-4df9-99ac-aa96276780ac
    linux /casper/vmlinuz file=/cdrom/preseed/mint.seed boot=casper quiet splash --
    initrd /casper/initrd.lz
    Obviously, change the drive/partition numbers to what is appropriate as well as the correct uuid numbers. I don't know that you would even need the search line. You could boot LMDE as an iso with a loopback entry and the others with standard entries. Also, I don't have a Mint iso but you will need to check in the preseed directory to verify that it is 'mint.seed'.

  9. #8
    Just Joined! HisDudeness's Avatar
    Join Date
    Jun 2012
    Location
    Melzo, Milan (Italy)
    Posts
    23
    I tried using the second entry you wrote, the one referred to Mint, adjusting UUID, but it won't boot, giving me kernel panic. The error is: "/init: .: line 215: can't open '/scripts/casper'

    By the way, isn't preseed something related to automatic install? I don't have any /cdrom/preseed directory in the extracted iso. Sorry if I said some blasphemy here, but I don't know how preseed works...

    And which istruction tells grub to load filesystem.squashfs to ram? Just to understand the way it works so that I can do the same with all entries I need to write.

  10. #9
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Hey,

    So I found my multi-boot Live Linux ISO USB disk thingy, and it turns out I used syslinux (wiki entry), not even grub legacy! I did some wacky stuff, too, to get it to work as an emulated USB-ZIP drive, which was the only way I could get it to work on some older PCs.

    Anyway, for posterity, I'll post my instructions here, along with my syslinux.cfg file.

    First, my README:
    Code:
    ##-- tried using grub ... epic fail --##
    
    # command used to back up /boot ext2 filesytem
    #dd if=/dev/sdb1 of=/tmp/grub-gPXE-bootable-USB-disk.img
    
    # command used to back up partition table
    #dd if=/dev/sdb of=/tmp/grub-gPXE-bootable-USB-disk.fdisk bs=512 count=1
    
    ##-- use syslinux on sdb1 and sdb4 (leave sdb2 and sdb3 for data) --#
    
    # if grub was on USB disk (e.g., /dev/sdb), then remove it:
    #dd if=/dev/zero of=/dev/sdb bs=446 count=1
    
    # manually force mbr.bin if grub is still there:
    #cat /usr/share/syslinux/mbr.bin > /dev/sdb
    
    # then install syslinux:
    #syslinux -i /dev/sdb1
    #syslinux -i /dev/sdb4
    
    # make sure only partition 4 is active (for USB-ZIP emulation)
    #fdisk -l /dev/sdb
    
    # format /dev/sdb1 and /dev/sdb4 with fat:
    #mkdosfs /dev/sdb1
    #mkdosfs /dev/sdb4
    
    # partition table should look roughly like:
    #
    #       Disk /dev/sdb: 8220 MB, 8220835840 bytes
    #       253 heads, 62 sectors/track, 1023 cylinders, total 16056320 sectors
    #       Units = sectors of 1 * 512 = 512 bytes
    #       Sector size (logical/physical): 512 bytes / 512 bytes
    #       I/O size (minimum/optimal): 512 bytes / 512 bytes
    #       Disk identifier: 0x00000000
    #
    #       Device Boot      Start         End      Blocks   Id  System
    #       /dev/sdb1            2048      206847      102400    6  FAT16
    #       /dev/sdb2          206848      411647      102400   83  Linux
    #       /dev/sdb3          411648      616447      102400    b  W95 FAT32
    #       /dev/sdb4   *      616448      821247      102400    6  FAT16
    #
    
    # mount /dev/sdb1 and /dev/sdb4 and put in them:
    
    # chain.c32
    # ldlinux.sys (will get added in syslinux step above)
    # syslinux.cfg
    # vesamenu.c32
    
    # fill out syslinux.cfg to do what you want
    
    # also include bootable kernels, e.g. gPXE etherboot images:
    
    # viarhine.krn
    # gpxe-101.krn
    # nforce.krn
    # r8169.krn
    Note: gpxe boot images were retrieved from www.rom-o-matic.net.

    Here's my syslinux.cfg file:
    Code:
    UI vesamenu.c32
    PROMPT 1
    TIMEOUT 0
    MENU TITLE Syslinux 4.02 Boot Menu
    
    LABEL local
            MENU LABEL Boot 1st Local Hard Drive
            COM32 chain.c32
            APPEND hd0 swap
    
    LABEL local2
            MENU LABEL Boot 2nd Local Hard Drive
            COM32 chain.c32
            APPEND hd1 0 swap
    
    LABEL R8169
            MENU LABEL Realtek PCIe GiB Eth. j29L  [10EC:8168] (gPXE 1.0.1)
            kernel /gpxe/r8169.krn
    
    LABEL VIARHINE
            MENU LABEL VIA Rhine III PCI Fast Eth. [1106:3106] (gPXE 0.9.4)
            kernel /gpxe/viarhine.krn
    
    LABEL NFORCE
            MENU LABEL nVidia Corp. MCP79 Ethernet [10DE:0AB0] (gPXE 1.0.1)
            kernel /gpxe/nforce.krn
    
    LABEL gPXE
            MENU LABEL Generic gPXE (gPXE 1.0.1)
            kernel /gpxe/gpxe-101.krn
    
    LABEL rescuecd_240
            MENU LABEL SystemRescue-Cd 2.4.0
            LINUX /sysrescd/rescuecd
            INITRD /sysrescd/initram.igz
            APPEND scandelay=5 setkmap=us
            TEXT HELP
            * SystemRescueCd version 2.4.0
            * Licensed under the GPL-2 license
            * http://www.sysresccd.org
            ENDTEXT
    
    label clonezilla_live
            MENU LABEL Clonezilla Live 1.2.10-14
            kernel /clonezla/vmlinuz
            append initrd=/clonezla/initrd.img boot=live config noswap nolocales edd=on nomodeset noprompt ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_keymap="NONE" ocs_live_batch="no" ocs_lang="en_US.UTF-8" vga=788 ip=frommedia  nosplash
            TEXT HELP
            * Clonezilla live version: 1.2.10-14-i686-pae. (C) 2003-2011, NCHC, Taiwan
            * Disclaimer: Clonezilla comes with ABSOLUTELY NO WARRANTY
            * http://www.clonezilla.org
            ENDTEXT
    then, for example, my sdb1 partition looks like:
    Code:
    /media/usbdisk
    /media/usbdisk/clonezla
    /media/usbdisk/clonezla/vmlinuz
    /media/usbdisk/clonezla/initrd.img
    /media/usbdisk/gpxe
    /media/usbdisk/gpxe/gpxe-101.krn
    /media/usbdisk/gpxe/nforce.krn
    /media/usbdisk/gpxe/r8169.krn
    /media/usbdisk/gpxe/viarhine.krn
    /media/usbdisk/vesamenu.c32
    /media/usbdisk/ldlinux.sys
    /media/usbdisk/syslinux.cfg
    /media/usbdisk/chain.c32
    /media/usbdisk/sysrescd
    /media/usbdisk/sysrescd/rescuecd
    /media/usbdisk/sysrescd/initram.igz

  11. #10
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    Ubuntu, Mint and Ubuntu derivatives all have the same directories/files in the / of the CD/DVD. At least that has been my experience. This is what I always see:

    ls
    casper/ install/ isolinux/ md5sum.txt preseed/ README.diskdefines ubuntu
    I've never seen an extracted/loop mounted Ubuntu derivative that doesn't have a preseed directory. Usually there is only one file in it, ubuntu.seed, mint.seed, etc. and the contents are:

    # Only install the standard system and language packs.
    tasksel tasksel/first multiselect
    d-i pkgsel/language-pack-patterns string
    # No language support packages.
    d-i pkgsel/install-language-support boolean true
    The filesystem.squashfs file is in the casper directory and is needed to boot. Do you have the casper directory in the / of sdb1? Post the entry you used in grub.cfg. Also, what does the / of the system look like (sdb1)? Use the ls command on root:

    ls /, post that output. I had a Zorin iso file which is also an Ubuntu derivative like Mint. I booted it from an Ubuntu partition with the entry I posted above. It was on the same partition. Did you include the set root line?

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •