How to skip the GRUB menu in an x86 virtual machine

I am writing a script to manage a network of QEMU virtual machines running different versions of OpenWrt. Well, at least that is the goal, but I am struggling to get started. :sunglasses:

I am using openwrt-18.06.4-x86-64-combined-ext4.img . The very first thing I get is the GRUB menu, which pauses for 5 seconds on start-up. I want to streamline the process, because I am constantly modifying the script and restarting everything.

Is there any way to skip the GRUB menu and start the default kernel immediately? Hopefully without having to rebuild OpenWrt.

Many thanks in advance,
rdiez

@rdiez, welcome to the community.

Just edit the countdown timer.

https://www.gnu.org/software/grub/manual/grub/html_node/timeout.html

Thanks for your answer. I know how to do that on Linux, but how do I do that in the OpenWrt image I downloaded? Do I need to rebuild the image? Or may this can be done within the OpenWrt system, butn then, is the procedure the same? I mean, is there an "update-grub2" script like in Ubuntu?

Just plug your stick in a pc, mount partition 1 and edit grub config.... easy! You should be able to do this within openwrt but you'd have to mount the partition first / install a friendlier editor ( vim, joe, nano etc. )

1 Like

On a VM you would mount the virtual disk into the host OS. Or boot up OpenWrt, mount the sda1 boot partition to /mnt, and edit files. Ordinarily only sda2 the rootfs is mounted.

1 Like

Thanks for your answers. Editing GRUB configuration files is not enough, you then need to regenerate/update some binary data on disk from those configuration files with "sudo update-grub2" (on Ubuntu). That will probably not work if you mount an OpenWrt partition, because your operating system does not actually know how to handle a foreign GRUB on a foreign OpenWrt system.

openwrt != ubuntu
grub != grub2

OpenWrt does seem to use GRUB 2.

But today I finally learnt how to do this. There is a configuration setting (make menuconfig) called GRUB_TIMEOUT. The default is 5 seconds. Setting it to 0 skips the menu.

2 Likes

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