Find the answer to your Linux question:
Results 1 to 10 of 10
Have a new loptop ASUS with Win 8 and duel boot with Ubuntu x64. Decided to put GRUB on a usb stick. Testing out various linux's and do not want ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    Dec 2007
    Location
    Idaho USA
    Posts
    362

    Grub 2,EFI problem


    Have a new loptop ASUS with Win 8 and duel boot with Ubuntu x64. Decided to put GRUB on a usb stick. Testing out various linux's and do not want to mess with the internal hdd boot method, with gpt partitioning.

    Code:
    sudo grub-install --boot-directory=/media/dad/Linux/ /dev/sdb
    [/media/dad/Linux is a partition the the usb stick} that command works good but it requires a lot of rewrites to grub.cfg file and likely others on the usb stick. decided to redo grub install with:
    Code:
    sudo grub-install /dev/sdb
    that put the grub into the MBR of the usb stick , with the rest of the grub files on the internal hdd.

    now the problem:
    With the last grub-install for some reason ,grub does not see the partitions on the USB stick but once booted into Ubuntu the partitions are visible. I have linux ISO's on the stick partitions and can not boot into them.

    Is there a way to have grub in the usb stick MBR with the rest of the grub files on the internal hd and have grub see the usb stick partitions ? I do not understand why grub will not see the 2 partitions on the USB stick. in grub command the 'ls' only list (hd0) with no partition but all of (hd1) partitions '7'. [(hd0)=USB stick, (hd1)=internall hdd]

    output of fdisk -l
    Code:
    Disk /dev/sda: 320.1 GB, 320072933376 bytes
    255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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: 0xf97c441a
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1   625142447   312571223+  ee  GPT
    
    Disk /dev/sdb: 15.5 GB, 15535702016 bytes
    255 heads, 63 sectors/track, 1888 cylinders, total 30343168 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: 0x00031d2e
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1          137216    20103167     9982976    c  W95 FAT32 (LBA)
    /dev/sdb2        20103168    30343167     5120000   83  Linux

  2. #2
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    What I usually do to have Grub2 boot iso files from a flash drive is install Grub2 from a system which is running it with this command:

    sudo grub-install --root-directory=/media/test /dev/sdb
    This is after creating the /media/test directory. This does not create a grub.cfg file as you mentioned so I then copy the first part of a grub.cfg file to /media/test/boot/grub and put in entries like this:

    menuentry "Kubuntu-11.10" {
    loopback loop (hd0,1)/kubuntu11.iso
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/kubuntu11.iso quiet splash --
    initrd (loop)/casper/initrd.gz
    }

    I usually only create one partition.

  3. #3
    Linux User
    Join Date
    Dec 2007
    Location
    Idaho USA
    Posts
    362
    yancek- HI- I have no problem with that grub-instll command . But if I run
    Code:
    sudo gurb-install /dev/sdb
    then the partitions on sdb are not listed in grub's command prompt and can not boot to the ISO file on sdb1. Where the boot strap code is in the MBR of sdb but the grub boot folders are on the internal hdd., for some reason no partitions on sdb are accesible in grub, but once booted into an instlled linux they are.

    For the time being do not want the grub boot strap code on the internal hdd and would prefer not have the grub folder on the USB drive due to rewrite at each boot of grub.cfg and other files. Till I find a linux that works good on my laptop, Ubuntu x64 that I am now useing has problems with a constant bad shutdown.

    I am haveing problems with your listed menuentry with openSUSE and Mepis but think it is for some other reason that I will investagate later.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    Testing out various linux's and do not want to mess with the internal hdd boot method, with gpt partitioning.
    If you are testing varous Linux distros, you could just put a chainload entry in the Ubuntu grub.cfg file for whichever distro you have on the flash, sdb1:

    menuentry 'CHAINLOAD TEST' {
    insmod ext2
    set root=(hd1,0)
    chainloader +1
    }
    The above entry won't work if you have an iso file rather than a regular installation. If you have an iso file, the loopback method should work. However, I've only been successful with using the loopback using Ubuntu derivatives as well as gparted and parted magic. I doubt a system that doesn't use Grub2 would work.
    I'm not sure I understand what you mean by the partitions not being listed in grub command prompt on sdb. Is this running it from the Ubuntu Grub on the hard drive?

    If you just want to test distributions, you could download the iso, loop mount it and copy the directories/files to a partition on the flash drive and put an entry in the Ubuntu grub.cfg file. For example, I downloaded Puppy Linux, loop mounted it an copied it to a directory named puppy in the / of sda8. I have Ubuntu 11.10 installed on sda5 and its grub.cfg entry for puppy (on sda is below, it boots fine:

    menuentry "Puppy-Lupu-511 (on /dev/sda" --class gnu-linux --class gnu --class os {
    insmod part_msdos
    insmod ext2
    set root='(hd0,msdos'
    search --no-floppy --fs-uuid --set=root 2ae95530-a3d7-43e7-a160-3ef4da2a5904
    linux /puppy/vmlinuz
    initrd (hd0,/puppy/initrd.gz
    }
    Last edited by yancek; 12-30-2012 at 12:46 AM.

  6. #5
    Linux User
    Join Date
    Dec 2007
    Location
    Idaho USA
    Posts
    362
    I'm not sure I understand what you mean by the partitions not being listed in grub command prompt on sdb. Is this running it from the Ubuntu Grub on the hard drive?
    I am running the "install-grub" Ubuntu 12.10 x64 on a ASUS X401A1 laptop with win8. If I run
    Code:
     install-grub /sdb
    , where the MBR boot code is in sdb's MBR but the rest of grub is in the installed Ubuntu "/boot/gub//i386-pc " folder (sda7) .

    When booting with the above install-grub, if I select an ISO on sdb1 or sdb2 an error is given 'invalid partition' and a 'ls' from the grub prompt list no partition for sdb(hd0).

    But if I run ' grub-install --root-directory=/media/dad/Linux/ /dev/sdb ' where all of the grub files on on sdb (/dad/Linux/ is sdb1) ,then the partitions on sdb 'sdb1 & sdb2' are valid duing boot.

    However, I've only been successful with using the loopback using Ubuntu derivatives
    that is what I am finding out, think I will have to use "dd" to write the ISO to sdb. It did work for debian and do not have to mess with grub for ISO installing.

    Thanks for your assistance.

  7. #6
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    if I select an ISO on sdb1 or sdb2 an error is given 'invalid partition'
    Select from the grub.cfg menu on the Ubuntu Grub on your hard drive? What drive/partition is it pointing to?

    But if I run ' grub-install --root-directory=/media/dad/Linux/ /dev/sdb ' where all of the grub files on on sdb
    I would expect that to work as it does.

    dd is another easy way if you only have one iso file on the flash drive. Good luck with it.

  8. #7
    Linux User
    Join Date
    Dec 2007
    Location
    Idaho USA
    Posts
    362
    I think the problem is with the bios or grub programing.

    grub.cfg entries for the usb-sda(x) in the grub.cg on the installed Ubuntu.
    Code:
    menuentry "opensuse" {
    set root=(hd0,1)
    linux /openSUSE-64/boot/x86_64/loader/linux root=/dev/sdb1 debug  
    initrd /openSUSE-64/boot/x86_64/loader/initrd   
    }
    
    menuentry "mepis files"{
    set root=(hd0,2)
    linux /boot/vmlinuz  root=/dev/sda2  apm=power-off vga=791 quiet 
    initrd /boot/initrd.gz
       }
    When booting from the USB stick, if I select ether one' the exact display is {error: no such partition }
    if I then press 'c'-command line then type in :ls I get --(h0) (hd1) (hd1,pgt1) thro (hd1,pt8) no listing for (hd0,1) or (hd0,2)
    Can boot to the instlled Ubuntu.


    the above happens only if from the installed Ubuntu, i run 'grub-install /dev/sdb' . This is with grub-efi,will later see if the same things happens with my older laptop with grub2 if it can boot via usb device.

    A edited version of bootinfscript -due to size limit

    I have noticed some errors in the menuentries for (hd0,x) but they are not the problem for now.
    Attached Files Attached Files

  9. #8
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    I've never tried installing Grub just to the mbr of a flash with the other grub files on a different drive so I don't know what to expect.
    You might try editing the grub.cfg file on sda7 and changing the opensuse and mepis entries to: set root=(hd1,1) and set root=(hd1,2) and try booting them to see if it boots or if you get a different error message.

    Grub2 (v1.99) is installed in the MBR of /dev/sdb and looks at sector 1 of
    the same hard drive for core.img. core.img is at this location and looks
    in partition 72 for
    I've seen that error before but am not sure what it means. You obviously don't have '72' partitions.

  10. #9
    Linux User
    Join Date
    Dec 2007
    Location
    Idaho USA
    Posts
    362
    Have tried several things and I am stumped for now. I ran ' grub-install --root-directory=/media/dad/Linux/ /dev/sdb ' and then made a correct entire for chainload+1 to the installed grub on Ubunut partition (use -force to install grub there). When that menuentry is selected and the internal install grub came up, the USB (sdb) partitions were unacceptable. I will give up on this for now and soon make a new theard on the problems I am having with the installed Ubuntu.

    Thanks for your assistance.

  11. #10
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    You might try running the bootinfoscript from the site below. It outputs a lot info on drives/partitions, boot files and UUIDs which might provide you with some insight.

    Boot Info Script | Free System Administration software downloads at SourceForge.net

Posting Permissions

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