Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Booting from IMG file fails root block device not found in
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
KatsuoRyuu
n00b
n00b


Joined: 08 Nov 2016
Posts: 54

PostPosted: Sun Mar 22, 2020 5:51 pm    Post subject: Booting from IMG file fails root block device not found in Reply with quote

Hi

Im trying to boot Gentoo from a IMG file, and is somewhat successfull.
The kernel, initramfs, ucode are being loaded, but as soon as they are loaded im getting an error saying the system is unable to find the root block device.

i am using the following configuration:
/etc/40_custom:
Code:

menuentry "Gentoo IMG file" {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_gpt
    insmod ext2
    set imgfile="/boot/5.5.5-gentoo-v1-amdgpu-2020-03-21.img"
    set kernelimg="/boot/kernel-genkernel-x86_64-5.5.5-gentoo-v1-amdgpu"
    set initramfs="/boot/initramfs-genkernel-x86_64-5.5.5-gentoo-v1-amdgpu"
    set initucode="/boot/amd-uc.img"
    search --no-floppy -f --set=root_partition $imgfile
    probe -u $root_partition --set=disk_uuid
    set root_disk="/dev/disk/by-uuid/$disk_uuid"
    loopback loop $imgfile   

    echo   'Loading Linux x86_64-5.5.5-gentoo-v1-amdgpu from IMG file ...'
    linux  (loop)$kernelimg  img_dev=$root_disk img_loop=$imgfile init=/usr/lib/systemd/systemd boot=casper splash=silent,theme:gentoo console=tty1 quiet
    echo   'Loading initial ramdisk from IMG file ...'
    initrd  (loop)$initucode (loop)$initramfs
}


I know normally you would set the `root=/dev/xzy` but i dont know how to set this when booting from an image.

I hope anybody has been playing with this before and is able to help?
Back to top
View user's profile Send private message
fturco
Veteran
Veteran


Joined: 08 Dec 2010
Posts: 1181
Location: Italy

PostPosted: Sun Mar 22, 2020 6:36 pm    Post subject: Reply with quote

Please post the contents of the GRUB_CMDLINE_LINUX variable from /etc/default/grub.
Back to top
View user's profile Send private message
KatsuoRyuu
n00b
n00b


Joined: 08 Nov 2016
Posts: 54

PostPosted: Sun Mar 22, 2020 6:50 pm    Post subject: Reply with quote

Hi Fturco

Code:

GRUB_CMDLINE_LINUX="init=/usr/lib/systemd/systemd"


if there is anything else needed please let me know, on a note this implementation is a custom menuentry dont know what that variable will help with?
Back to top
View user's profile Send private message
KatsuoRyuu
n00b
n00b


Joined: 08 Nov 2016
Posts: 54

PostPosted: Mon Mar 23, 2020 5:35 am    Post subject: Reply with quote

So I have noticed that grub is booting correctly, but after the initial load from grub it seems gentoo is unable to find the mountable root file system.
basically upon boot you get a console where you and enter the root block device.

if i enter `/dev/sda2` which is my boot drive it starts without any problem. But my `/` is now the harddrive, I would like to have the iso/img file as the rootfs. This would be for a secure rescue option or a custom system.

My thinking is i would either set it to load `/dev/sda2` as the root drive and then bind the dirs from the image to the /etc /bin /lib etc but I feel that is the wrong way to do it.
I found that Manjaro seems to be able to boot from an iso image, with my current configuration, so im wondering if there is something i am missing somewhere else.

Anybody tried this before?
Back to top
View user's profile Send private message
fturco
Veteran
Veteran


Joined: 08 Dec 2010
Posts: 1181
Location: Italy

PostPosted: Mon Mar 23, 2020 10:02 am    Post subject: Reply with quote

I don't know if this can help you, but I have a USB flash drive with ISO images from Ubuntu.

Example GRUB configuration:
Code:
menuentry "Ubuntu 19.10" {
    set iso=/iso/ubuntu-19.10-desktop-amd64.iso
    loopback loop $iso
    linux (loop)/casper/vmlinuz boot=casper quiet splash iso-scan/filename=$iso
    initrd (loop)/casper/initrd
  }


Gentoo ISO images probably need a different set of parameters, but I haven't tried doing that yet.
Back to top
View user's profile Send private message
KatsuoRyuu
n00b
n00b


Joined: 08 Nov 2016
Posts: 54

PostPosted: Sat Apr 18, 2020 8:06 am    Post subject: Reply with quote

Sorry for the late reply.

I will try looking into this, thanks for the suggestion, will report back if it works
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum