Hello everyone! Can Openwrt and Windows 10 be installed in the same partition of the same hard disk for dual booting? If so, what should be done? Thanks!
yes,
but it's not a openwrt question, but one for the boot loader.
have a look at rEFInd.
booting openwrt isn't any different than dual booting any vanilla Linux dist and Windows.
you could also boot openwrt off a flash drive, to avoid the dual boot.
Install virtual machine like hyperv , vmware play or virtualbox. You happy windows happy openwrt part happy.
Thanks! I know that the USB disk can be booted, just find out whether the same hard disk and different partitions can be dual-booted. I tested it like this:
- partition, including EFI, NTFS (for windows). EXT4 for openwrt,
- Install windows,
- Use Ubuntu USB to boot the system, and use the DD command to copy openwrt.img to EXT4.
- adp install refind or copy directly from diskgineus in windows.
- After booting from the hard disk, the refind menu can appear normally and can enter Windows. However, when you select openwrt, you will reach the gnu prompt but not the openwrt prompt. I tried adding the following to refind.cfg, but that didn't work either. :menuentry "OpenWrt" {
icon /EFI/refind/icons/os_linux.png
volume "kernel"
loader /boot/vmlinuz
options "root=PARTUUID=87332CCE-E68C-42F8-8121-08EAA111F060 rootwait console=tty0 console=ttyS0,115200n8"'''
You need to point out a drive, or partition ?
In theory, but not even Ubuntu desktop can solve this problem.
You can install whatever you want on a Windows computer, but nothing can be greater than Windows so Windows will always start and boot first whatever you think about it.
And you can’t install windows on anything else than ntfs or exFat and none of them are linux friendly with file permission capabilities, you can only use exFat to be precise. And a partion can only be one file format.
My best advice if you want to mix Microsoft and Unix in one single dual boot setup is to get a lot of strong drinks and a bag of headache pills first.
The OpenWrt images, regardless of BIOS or UEFI, are not built with dual-booting or sharing its block device with other operating systems in mind. That does not mean it would be impossible, but as-is, it's not possible. Not that it really makes sense to dual-boot your router with a desktop OS of any kind.
The easiest option, apart from going virtual, would be to give it its own USB stick/ sdhc card or similar to boot from - and for OpenWrt, there is not really any disadvantage (or speed penalty) in doing so.
Yes, there are way to work around these limitations, with more advanced bootloaders, some special bootloader configurations, dissecting kernel & rootfs to be more accessible to the bootloader, etc. but those won't play nice with sysupgrade. Quite a lot of development would have to go into this, to make it generic- and safe enough to be merged, it's possible, but not really a priority - unless you make it yours.
Do yourself a favour, depending on your intentions, look into virtualization (hyper-v, virtualbox, vmware, etc.) or 'invest' (less than-) a fiver into the smallest/ cheapest USB stick or sdhc card you can find.
Thanks a lot!
I beg to differ.
Every computer I've ever bought has come by default with whatever version of Windows for the day (XP, Vista, Win7,8,9,10,11,12) and for each one the first thing I do is to set the main drive for Linux/Windows dual boot with Linux as the default boot OS.
Set BIOS to boot to USB, boot a Linux Live USB, use gparted
to make room for Linux, install your Linux distro.
You’ll end up with, in order, Grub Menu to boot for eg. Ubuntu Boot (default), Ubuntu Advanced Options, Window Boot Manager, et al. Flawless.
@hopes
No need for dual boot or a VM. A 4GB USB with an X86 OpenWrt image will happily perform just as well with zero headaches at all.
The question is why we need dual-boot function on a PC + OpenWrt?
My solution is the PC running Windows or Ubuntu + Docker.
And the openwrt is running in the Docker.
But that isn’t a single partition, is it?
Virtualization, not containerization - so qemu-kvm, virtualbox, hyper-v, vmware, etc. pp. Running OpenWrt as a docker container is not supported and dangerous/ insecure.
Windows + Docker or Ubuntu + Docker, it's native Docker. Not use VM.
Then running full function openwrt in the Docker, should be no problem, I see this on YouTube.
Except that it is a major problem, both in terms of functionality and security.
Again:
virtualization: yes
containerization (docker, lxc, lxd, vserver, virtuozzo, etc.): no, hell no.
youtube isn't the arbiter of reality.
Docker can only run “in the family” containers, containers is pretty much only sandbox isolated add-ons to the underlaying operation systems which uses the underlaying systems resources.
That means you can’t run a windows container in a linux/unix based docker system and vice versa because windows doesn’t run on kernels and unix system does.
As OpenWrt hard-depends on being able to (un-)load (its own!) kernel modules at will, have raw hardware access to network devices and do sysctl settings as needed, a container (which prevents this from succeeding) cannot work with OpenWrt. Yes, you will see a pretty webinterface, but the functionality is seriously compromised (functionally and security wise), this is not supported and likely never will be.
Running OpenWrt in a VM (!= container) is fully supported (not saying this is the best idea for production systems, but it's fully supported).
We do have a lot of users in the forum that put a “=“ between luci and openwrt.
Is there luci, then we have a working OpenWrt. No luci is then a crashed openwrt.
It doesn’t seem to be a big bunch of “normal stable release download” users that know luci is just a package suite of other small luci packages that makes up a complete luci Graphical User Interface to the uhttpd server.
The really interesting thing is that we have more users seeing dropbear as a strange add-on to OpenWrt that should be turned off or removed. And dropbear is actually included in the core packages of OpenWrt!?
That may be the perception, but luci is just a pretty picture - it does nothing functionally. What use are the pretty pictures, if the primary functions of a router don't work and rip glaring security issues into your network.
Don't get me wrong, I don't have anything against luci (on the contrary), but luci by itself is not sufficient.
How to install OpenWRT on Windows box then dual boot with Windows BCD
- Create an OpenWRT bootable USB for the computer-router and configure it as required (see Youtube). You do not need a USB greater than 4GB.
- Also: Install the OpenWRT package blkid.
opkg update
opkg install blkid
-
With a Ubuntu liveusb use gparted to resize/shrink the Windows (NTFS) partition (hd0) ==> (/dev/sda1) to give you enough free space to copy all partitions of the OpenWRT USB.
-
Create an extended partition in the free space.
-
Use dd to copy each partition from the USB into the free space of the new extended partition.
-
Reboot your computer into Windows.
-
Download and install EasyBCD
-
Use EasyBCD to add the OpenWRT boot option to the Windows boot menu.
“EasyBCD is a software utility for Windows that lets you control and configure the BCD/BOOTMGR bootloader for Windows 7, Windows 10, and Windows 11” -
Open EasyBCD
-
Press Add New Entry from the EasyBCD Toolbox list.
-
Select the NeoGrub Tab from the Operating Systems Choices
-
Press install. Name your new boot item OpenWRT.
We will edit the list’s boot string once the PARTUUID is identified. -
Reboot the computer and select OpenWRT
-
You may see a prompt that says grub> and your system doesn't boot. EasyBSD did not find your OpenWRT boot partition (kernel) and openwrt grub.cfg. You must search for the OpenWRT boot partition on the Windows hard drive (hd0) and then modify C:\NST\menu.lst created by EasyBSD. At the grub4dos prompt you need to find the Openwrt's kernel vmlinuz file on the hard drive.
grub> find --set-root /boot/vmlinuz
-
Note the rootfs partition and the other partition.
-
Once found examine the grub.cfg file.
grub> cat (hd0,#)/boot/grub/grub.cfg
You will notice the file contains the PARTUUID of your OpenWRT USB. -
Leave the OpenWRT USB inserted but load the kernel from the (hd0,#) you found. At the grub prompt enter:
grub> kernel (hd0,#)/boot/vmlinuz
grub> set root=(hd0,#)/
grub> boot
Your computer should reboot using the hard drive's kernel and the OpenWRT USB.
-
At the OpenWRT prompt blkid will show a list of PARTUUID for your USB and your Windows harddrive partitions.
# sudo blkid
-
Copy the PARTUUID for rootfs of the harddrive
-
Reboot into Windows
-
Modify the C:\NST\menu.lst file created by EasyBCD. Replace the root partition PARTUUID of the OpenWRT USB with the OpenWRT rootfs partition PARTUUID on the hard drive.
Also, set the timeout and default boot OS.
My old rootfs partition PARTUUID=80cdd189-4ce8-125d-9e5c-32a6bb5c6502
New rootfs partition PARTUUID=6fded4a8-08
Example C:\NST\menu.lst file
# NeoSmart NeoGrub Bootloader Configuration File
#
# This is the NeoGrub configuration file and should be located at C:\NST\menu.lst
# Please see the EasyBCD Documentation for information on how to create/modify entries:
# http://neosmart.net/wiki/display/EBCD/
# serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 --rtscts=off terminal_input console serial; terminal_output console serial
default 0
timeout 5
title OpenWRT
find --set-root /boot/vmlinuz
kernel /boot/vmlinuz root=PARTUUID=6fded4a8-08 rootwait console=tty0 console=ttyS0,115200n8 noinitrd
initrd /boot/grub/core.img
title OpenWRT2 Failsafe
find --set-root /boot/vmlinuz
kernel /boot/vmlinuz failsafe=true root=PARTUUID=6fded4a8-08 rootwait console=tty0 console=ttyS0,115200n8 noinitrd
initrd /boot/grub/core.img
################### End C:\NST\menu.lst #######################