Announcement

Collapse
No announcement yet.

Trying to get iso entry into Grub

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Trying to get iso entry into Grub

    I'm trying to get the Grub 40_custom file written correctly to I can boot a Gparted Live.iso. I'm putting in the code as per https://gparted.org/livehd.php (GParted Live on Hard Disk using GRUB)

    This is what I've have in 40_custom:
    Code:
    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 "Gparted live" {
     set isofile="/home/isos/gparted-live-1.3.1-1-amd64.iso"
     loopback loop $isofile
     linux (loop)/live/vmlinuz boot=live config union=overlay username=user components noswap noeject vga=788 ip= net.ifnames=0 toram=filesystem.squashfs findiso=$isofile
     initrd (loop)/live/initrd.img
    }
    Running sudo update-grub2 executes without errors.

    Restarting, I'm presented with my Grub menu, and GParted live is the last item. I select it and get told that "/home/paul/Downloads/gparted-live-1.3.1-1-amd64.iso" doesn't exist and that the kernel has to be loaded first. I wait a few seconds and the Grub Menu is presented again.

    What isn't Grub liking about the entry? I've made no typos, at least as compared to what the Gparted page says.
    Last edited by Snowhog; Mar 01, 2022, 10:40 PM.
    Using Kubuntu Linux since March 23, 2007
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    #2
    Maybe missing hd info as in
    Code:
    loopback loop (hd1,1)$isofile
    , your hd would be different
    Boot Info Script

    Comment


      #3
      Found the issue.

      My laptop (where this is being done) is formatted btrfs, so I had to point the set isofile= entry to reflect that. So here is the 40_custom entry that works:
      Code:
      menuentry "Gparted live" {
      set isofile="/@home/isos/gparted-live-0.28.1-1-i686.iso"
      loopback loop $isofile
      linux (loop)/live/vmlinuz boot=live config union=overlay username=user components noswap noeject vga=788 ip= net.ifnames=0 toram=filesystem.squashfs findiso=$isofile
      initrd (loop)/live/initrd.img
      }
      My laptop is successfully booted into Gparted from the .iso. Sweet.
      Using Kubuntu Linux since March 23, 2007
      "It is a capital mistake to theorize before one has data." - Sherlock Holmes

      Comment


        #4
        Neat!
        I suppose that one could run a distro from an ISO using that technique. And if one used a generic name in the grub menu and renamed new ISO's to that generic name they wouldn't have to touch the grub entry.
        "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
        – John F. Kennedy, February 26, 1962.

        Comment


          #5
          BTW, using /boot/grub/custom.cfg can be easier than /etc/grub.d/40_custom, because there's no need to run update-grub, and it can be edited from a live USB or booted to any OS.
          Regards, John Little

          Comment


            #6
            Originally posted by jlittle View Post
            BTW, using /boot/grub/custom.cfg can be easier than /etc/grub.d/40_custom, because there's no need to run update-grub, and it can be edited from a live USB or booted to any OS.
            Don't have /boot/grub/custom.cfg on Neon, so I can't use that route. /boot/grub/grub.cfg contains
            Code:
            #
            # DO NOT EDIT THIS FILE
            #
            # It is automatically generated by grub-mkconfig using templates
            # from /etc/grub.d and settings from /etc/default/grub
            #
            so editing that file is out as well. So that leaves just /etc/grub.d/40_custom as the file to modify.

            "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
            – John F. Kennedy, February 26, 1962.

            Comment


              #7
              Originally posted by GreyGeek View Post
              Don't have /boot/grub/custom.cfg on Neon...
              You don't have /etc/grub.d/41_custom? Neon must have an old version of grub. But 41_custom is quite simple:
              Code:
              #!/bin/sh
              cat <<EOF
              if [ -f \${config_directory}/custom.cfg ]; then
                source \${config_directory}/custom.cfg
              elif [ -z "\${config_directory}" -a -f \$prefix/custom.cfg ]; then
                source \$prefix/custom.cfg;
              fi
              EOF
              If you are editing 40_custom, you could easily add a 41_custom as above.
              Regards, John Little

              Comment

              Working...
              X