abbbi / kiss-bootstrap

Bootstrap kiss linux into qemu boot image
4 stars 1 forks source link

Image fails to boot if kiss-bootstrap is executed on kiss linux. #2

Open eudaldgr opened 4 years ago

eudaldgr commented 4 years ago

I'm unable to create a bootable image from your script, maybe I'm missing some parameters to configure in the kernel to manipulate NBD's or maybe some part of qemu that I forget, but don't boot the images I create with your script, only those you push.

abbbi commented 4 years ago

Logging output for sure would help. There are some requirements such as the kernel NBD module for mapping the qemu images to real disks, which are then prepared and written with the data.

eudaldgr commented 4 years ago

Yeah i have the NBD module, that was an example. My issue was that there is no documentation about what this script needs, so i can create the image, but these image can't boot unlike yours, it was into a infinite loop where grub try to boot from hard disk. So there is something missing in my system, that's all.

eudaldgr commented 4 years ago

https://0x0.st/idv2.png

Your image on the right, mine on the left.

It's only a screenshot, but mine it's in a loop that shows that and reboots immediately in less than a second, until you kill the virtual machine.

abbbi commented 4 years ago

without logs, no idea what is going wrong.

eudaldgr commented 4 years ago

My qemu logs are empty.

abbbi commented 4 years ago

im talking about the output of the kiss-bootstrap script.

eudaldgr commented 4 years ago

There are no errors, it just reboots to infinity. Ok, script logs.

abbbi commented 4 years ago

If GRUB does not boot, it fails to find its entry address, so there is most probably going something wrong with the NBD mappings or grub executed in the chroot that is used to setup the disk does not work correctly.

eudaldgr commented 4 years ago

Well, this is the logs, https://termbin.com/vdhy

abbbi commented 4 years ago

grub bootloader installed correctly in your run. The grub bootloader is setu plike this:

        chroot_exec "grub-install --target=i386-pc ${NBD_DEV}"  ${TARGET_DIR}                               
        chroot_exec "grub-mkconfig -o /boot/grub/grub.cfg" ${TARGET_DIR}                                  
        sed -i 's/nbd0p2/sda2/g' ${TARGET_DIR}/boot/grub/grub.cfg  

the last statement is required to replace the root device in the grub.cfg, making it /dev/sdaX instead of the NBD mapped device.

I think this is where things might go wrong on your system.. Probably the bootloader references the wrong root disk/partition.

eudaldgr commented 4 years ago

No, the sed command worked. I'm trying right now to run your script inside a virtual machine with linux mint, and the image created boots well. Your image was created inside a KISSLinux machine or under other distro?

abbbi commented 4 years ago

Im usually building on a Debian system.

eudaldgr commented 4 years ago

Well, so maybe this script doesn't work with KISS. It build, but wrong, unable to boot correctly. But i can't figure why...

Something is missing, to build this.

abbbi commented 4 years ago

One would need to check both images the one working and not working for differences. The grub installation is executed within the chroot and should not depend on any components outside the system the build script is executed on.

Does it even show the GRUB menu? If it doesnt show the menu, it fails so early its not having access to its second stage files which are on disk (thus, fails to access the disk, somehow). If it shows the menu, one could at least try several grub commands to see what is going on..

eudaldgr commented 4 years ago

It doesn't show the menu.