Ventoy as bootloader: how to activated OS prober?

hi, i use ventoy as bootloader on my computer, then use configfile (grub command) to load nixos grub menu. it is succes, i can enter to nixos grub menu from ventoy.
my problem is, with that schema i cant use OS prober on nixos. help me to create the configuration.nix
this is my configuration.nix

  boot.loader.grub.enable = true;
  boot.loader.grub.device = "nodev"; # i use ventoy bootloader
  boot.loader.grub.useOSProber = true;

and this is the error message when i rebuild:

[root@nixos:/home/ramuni]# nixos-rebuild boot
building Nix...
building the system configuration...
this derivation will be built:
  /nix/store/c5ckdm78p289a05dazk6q523ald0v234-nixos-system-nixos-23.05.3427.e5f018cf150e.drv
building '/nix/store/c5ckdm78p289a05dazk6q523ald0v234-nixos-system-nixos-23.05.3427.e5f018cf150e.drv'...
updating GRUB 2 menu...
/nix/store/8fv91097mbh5049i9rglc73dx6kjg3qk-bash-5.2-p15/bin/bash: line 1: /etc/grub.d/30_os-prober: No such file or directory

my nixos version is NixOS 23.05.3427.e5f018cf150e
my computer only support MBR bootloader(no uefi)

I have many questions. Why do you
a) feel the need to use Ventoy on a desktop drive (I’m thinking you must want three partitions: Ventoy, Images, NixOS but… just use VMs???);
b) feel the need to have Ventoy use the NixOS GRUB menu (just use NixOS menu without Ventoy or the Ventoy menu???)

My hypothesis was that “nodev” causes 30_os-prober not to be generated. And after some investigation, I was right.

I think the error may be caused by the perl script here. and the error occurs because grub, one of the arguments passed to it here, is an empty string per here and here. The perl script looks for $targetPackage (which winds up being the grub argument, ""), interpolates that with $targetPackage/etc/grub.d/30_os-prober, and passes it into a shell; But, since $targetPackage is an empty string it resolves to /etc/grub.d/30_os-prober (which obviously doesn’t exist, nor is it expected to exist) rather than <some-store-path>/etc/grub.d/30_os-prober. This problem will actually occur with any path the perl script tries to grab from the GRUB store path as long as the device is “nodev”. With the way the module is now, it will always fail with those particular settings you wrote:

There should probably be an assertion for this or the module should be fixed if this is considered a valid use case. I recommend opening an issue about it anyway.

1.) i have some live iso file that i use daily so i need ventoy as bootloader.
if i use virtualbox it too heavy for my computer, only 2 core cpu, 2gb ram.
if i use flashdisk it too slow, only usb v2 port.

2.) if i only use ventoy without nixos grub, i cant generate/use other nixos rebuild. only one build that can added to ventoy manually.
if i use nixos grub and add ventoy to nixos grub, ventoy grub not work(cant detect iso’s)

i have some os on other storage so i need os-prober to generate automatically on grub.

@ramuni-muni I don’t have anything to help you with your issue but am interested in how you got this set up to work. I am trying a somewhat similar thing. I have a USB with Ventoy installed on it and now I want to setup Plugin.VtoyBoot . Ventoy such that there’s NixOS in a vhd file on the USB that can be used as a ‘portable’ installation of NixOS. I get stuck at the vtoyboot installation as it seems NixOS has its own initramfs implementation which vtoyboot doesn’t work with. Did you use the vtoyboot plugin at all? If not, how did you get Ventoy to hand-over to the NixOS GRUB?

@smm I add manually boot menu to ventoy that pointed to nixos grub.conf

1 Like