Dual booting another distro from the same drive, x86

Not sure how to approach what I want to achieve, namely install debian on the same drive alongside openwrt and be able to choose in grub which one I want to load. Since installation of openwrt happens by just writing the entire disk, I have tried installing linux after OpenWrt but haven't been able to make grub see the new installation, I tried changing /boot/efi for the new installation, from a live usb, but because bootloaders and the way they work confuse the hell out of me, I naturally only botched the installation and now the device can't see either OS.

OpenWrt does not require an entire disk. Prep a partition, dd OpenWrt onto it, install your Linux OS of choice and make its bootloader chainload the OpenWrt one. You might even be able to bypass the latter and load OpenWrt directly from your main bootloader.

This is what I am having trouble with. I installed manjaro on another partition but it won't boot, when I got to live usb i chroot-manjaro -a to try and rebuild grub, remembered to add UUID to /etc/fstab and manjaro boots in a rescue environment, spitting errors with the boot partition.

/boot is showing efi and another boot folder
as well as the kernel and initramfs files.
/boot/efi has a single folder called EFI and nothing else
/boot/efi/EFI has 2 folders: boot and manjaro, both have bootx64.efi files.

not sure if this is the right structure

/boot/grub/grub.cfg does not mention OpenWrt anywhere

Reinstall Manjaro first, then dd OpenWrt to a dedicated partition. OpenWrt won't mess with any bootloader.

1 Like

thanks, will try now.

I did install the rootfs only image but as expected os-prober on Debian does not find anything on the rootfs partition. /boot does not show vmlinuz file for OpenWrt, only for Debian. How can I obtain the vmlinuz file for OpenWrt and put it there?
OpenWrt wont mess with the bootloader and that is an issue because I don't know how to get the vmlinuz and initramfs files. I can edit /boot/grub/grub.cfg but without the kernel and initramfs I cant boot no matter what.

Openwrt doesn't use initramfs, unless it's an initramfs image.

Download the kernel binary, and the rootfs.

Put the kernel in /boot, and write the rootfs.

Modify grub.

You can copy and modify the entry from the combined Openwrt image.
It also depends on if your grub uses the new scan, to look for boot options, or if it keeps a list.
Openwrt uses the latter.

that would be the generic-kernel.bin, right? So, uh... I know it's a stupid question but how do I extract vmlinuz out of it? Is it only vmlinuz I need from it?

which entry? Do you mean the entry I need to put inside grub.cfg?

You rename it :slight_smile:

Vmlinuz is just a name.

Yes, and add it to your existing grub.
root= will have to be modified though.

1 Like

Thank you, that worked. I already had done all of that, I just couldn't make sense of how to get the vmlinuz file.
I am not sure however what is going to happen to the bootloader if say I rebuild or even update grub (with grub-update) from Debian - would OpenWrt disappear?

Depends on what grub-update does, creates a new conf file ?

Create one under a new name, see if the Openwrt entry still exists?

nope, update-grub overwrites the grub.cfg with no trace of OpenWrt, even though in /etc/default/grub I have set 'disable os prober' to false, i.e. it probes but cannot recognise vmlinuz as a linux image.
Well, I will just write down the code and store it in a txt file on Debian desktop, if Debian updates break my grub, I will know what to do, otherwise I will not touch it.

I think grub-update writes the new config to the screen, unless you > it, but I use Fedora, where things might be slightly different.

Debian just rewrites the GRUB config in-place.

@granuloma No way to include a separate stub with just the OpenWrt parameters, which gets parsed when you rebuild the config?


1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.