pop-os / pop

A project for managing all Pop!_OS sources
https://system76.com/pop
2.42k stars 84 forks source link

Menu entry in grub for LiveCD #2239

Open ZiViZiViZ opened 2 years ago

ZiViZiViZ commented 2 years ago

Distribution: Any

Related Application and/or Package Version: LiveCD

Issue/Bug Description: Need to be able to add Pop!_OS to grub in order to easily try/install the OS

jacobgkau commented 2 years ago

Can you please clarify this issue? Are you running on a UEFI system or a legacy BIOS system that is incapable of UEFI? Are you attempting to add a live disc to your installed system's GRUB, or are you talking about a GRUB installation on your live disk? Are you using some third-party utility to create the disc?


System76 customers can reach out to support for technical assistance. For non-System76 hardware, you can seek community support on Reddit or Mattermost.

ZiViZiViZ commented 2 years ago

I mean boot to the LiveCD installation ISO from GRUB For example here are few entries that work:

menuentry 'Try Manjaro'  {
   set isoFile='/LiveCDs/manjaro-gnome-21.2.1-minimal-220301-linux510.iso'
   set imgDisk='/dev/disk/by-uuid/2949bg8d-a603-333z-x2aw-g98f1a3c866h'
   rmmod tpm
   loopback loop (hd1,2)$isoFile
   linux  (loop)/boot/vmlinuz-x86_64 img_dev=$imgDisk img_loop=$isoFile copytoram
   initrd (loop)/boot/intel_ucode.img (loop)/boot/initramfs-x86_64.img
}
menuentry 'Try Debian' {
    loopback root (hd1,2)'/LiveCDs/debian-buster-mini-gtk.iso'
    linux    (root)/linux priority=low vga=788 toram --- quiet
    initrd   (root)/initrd.gz
}
menuentry 'Try Ubuntu' {
     set isofile='/LiveCDs/ubuntu-21.10-desktop-amd64.iso'
     rmmod tpm
     loopback root (hd1,2)$isofile
     linux (root)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject toram --
     initrd (root)/casper/initrd
}
ZiViZiViZ commented 2 years ago

I tried different things for Pop!_OS For example:

menuentry "Try Pop_OS" pop-os {
   set isoFile='/LiveCDs/pop-os_20.10_amd64_intel_6.iso'
   set imgDisk='/dev/disk/by-uuid/2949bg8d-a603-333z-x2aw-g98f1a3c866h'
   rmmod tpm
   loopback loop (hd1,2)$isoFile
   linux  (loop)/boot/vmlinuz img_dev=$imgDisk img_loop=$isoFile copytoram
   initrd (root)/casper_pop-os_20.10_amd64_intel_debug_14/initrd.gz
}

However, I could not get it to work :disappointed:

crass commented 1 year ago

Here's how to do what you want. From some other system, extract the file /boot/grub/grub.cfg from the iso to the directory where you have the iso and rename is as popos.cfg (but it could be anything). Edit that file such that the menu entry looks similar to the below (I'm using a different iso):

menuentry "Try Pop_OS" pop-os {
   set isoFile='/isos/pop-os_22.04_amd64_nvidia_17.iso'
   rmmod tpm
   loopback loop (hd1,2)$isoFile
   set root=loop
   linux /casper_pop-os_22.04_amd64_nvidia_debug_275/vmlinuz.efi boot=casper live-media-path=/casper_pop-os_22.04_amd64_nvidia_debug_275 hostname=pop-os username=pop-os noprompt modules_load=nvidia nvidia-drm.modeset=0 iso-scan/filename=/isos/pop-os_22.04_amd64_nvidia_17.iso ---

   initrd /casper_pop-os_22.04_amd64_nvidia_debug_275/initrd.gz
}

Now when you boot into GRUB, run from the command line the command configfile (hd1,2)/isos/popos.cfg. Then hit escape to get back to the menu and a new menu item should have been added for "Try Pop_OS", select that.

This should get you most, if not all, of the way there. The real key is that the kernel commandline parameter iso-scan/filename=<absolute path to iso> must be provided for the casper scripts to look for the iso as a file on some recognizable filesystem.