It is worth noting that some of the Grub4dos commands (e.g. password, fallback, etc) are only used in configuration files – they are not relevant when using the command line. The configuration file is used to script boot options – the default menu is text based, alternatively a splash image can be used.
All commands in the configuration file must be in lower case. All boot options must begin with the command title, which should be followed with the text to be displayed in the boot menu (e.g. title Boot Windows XP will display the text “Boot Windows XP”.
Once the boot menu is displayed the selected menu option can be edited before booting (by pressing the [e] key), however the edits take place in memory and are not written to the configuration file.
Sample menu.lst file (included with Grub4dos download) -
NOTE - all lines starting with # are comments - they are not processed.
Menu colours can be set using the following command (default is white text on a black background, with current option being black text within a white highlight) -
Where a=text, b=background, c=selected option text, d=selected option highlight
Colours b and d must be one of the following - black, blue, green, cyan, red, magenta, brown, light-gray
Colours a and c must be one of the following - black, blue, green, cyan, red, magenta, brown, light-gray, dark-gray, light-blue, light-green, light-cyan, light-red, light-magenta, yellow and white.
E.g. the following menu.lst entry will display light blue text on a blue background with the selected option being in light red text within a red highlight (see screenshot 1. below) -
A boot (splash) screen can be used with a menu - the image will need to be in the .xpm format (which can be compressed with gzip) and must be 640x480 pixels with a maximum of 14 colours. For instructions on creating a splash image see next section (here). To display splash image splash.xpm.gz (in current root directory) the following entry should be used in menu.lst -
To display splash image splash.xpm.gz (saved in 1st partition on 1st hard disk drive) the following entry should be used -
By default the menu entry text will be white and the selected menu option will be black text within a white highlight. To change these colours use the following menu.lst entry -
Where RR is red, GG is green, and BB blue. Numbers must be in hexadecimal. In the following example the text will be displayed in MediumPurple1 (hex decimal value AB82FF) and the selected option will have MidnightBlue (hex decimal value 191970) text within a MediumPurple1 highlight – refer to figure 2. below.
It is possible to specify a default boot option by using the default command. If the timeout command is also specified, the system will wait for the set timeout period before booting the default entry.
To set a 10 second timeout use following entry -
To set a default entry (to be booted after timeout period has completed) use following entry (default 0=first menu entry, default 1=second menu entry, etc.) -
It is possible to change the default entry to the last option selected when Grub4dos was previously booted by using the default command followed by a file. E.g. -
The command default (hd0,0)/default specifies that an entry be written to the file default, on the first partition of the first hard disk (this file must be copied from the Grub4dos download – do not edit the file as it must remain 2048 bytes in size). If using this option, the drive containing the default file must be writable. The menu entry must also include the command savedefault – e.g.
To restrict access to the command line interface use the command password prior to any menu entries – e.g.
When booting Grub4dos with a password protected configuration file the default instructions will change from -
The user enters the [p] key to gain privileged control, followed by the specified password – which in the preceding example is administrator.
It is possible to use an encrypted password by using the command password --md5 followed by the encrypted password – in the following case “$1$ZjU0$k107noL9DOaClJEu6n6f91” is an encryption of administrator.
WARNING - do not generate your "md5 hash” password using another program as it is unlikely to be compatible with Grub4dos (see here). To ensure compatibility use the md5crypt command from within Grub4dos - see below.
To create an encrypted password, boot Grub4dos and press [c] to access a command line interface, then type the command md5crypt - this will prompt you to enter a password and will output the chosen password as an md5 hash (see figure 3. below).
It is also possible to restrict access to individual menu items when a password has been set by using the lock command, until the user enters the correct password (using [p] key to gain privileged control, followed by the password) any menu items designated with "lock" will not be accessible -
Alternatively the password command can be used to protect individual menu entries by specifying the password command within the entry – e.g.
md5 hash’s can also be used within menu entries. Different menu entries within the same configuration file can be protected with different passwords.
It is possible to create sub menus by using the configfile command, followed by the filename of the configuration file you want to load. E.g. menu.lst contents –
Will load submenu.lst. The submenu.lst configuration file follows the same format as menu.lst – a new menu colour scheme can be specified, default boot entry can be set, etc. Adding an option to return to the previous menu is recommended, to avoid being "stuck" in the submenu.
The command find --set-root combined with a filename can be used to locate a marker file on a device and set that device as the root for all further commands within the menu entry (or all further commands executed from the command line). E.g. –
The example above will search all supported partitions/devices for the file hdd.tag and will set the first device it finds, containing hdd.tag, as the root device. The partition boot sector of the device (chainloader +1 = first sector of current root device) will then be chainloaded.
It is possible to locate and load operating systems in this way. If for example Windows XP is installed, the following entry could be used -
If using the above example it is assumed that the NT loader ntldr is only present on one device. If multiple devices contain ntldr, the first one found will be set as the root device. As this could lead to the wrong installation booting, searching for unique tag/marker files are preferred. Devices are searched in the order –
Please note that ntldr (and other Windows loader/system files bootmgr and io.sys) must be on a partition on device (hd0), or Windows will not boot - see here for a full explanation and workaround.
It is possible to exclude foppy devices from the search by using the command --ignore-floppies - e.g. find --set-root --ignore-floppies /ntldr.
REMEMBER - find --set-root sometimes leads to unexpected behavior - e.g. if you have used the map command and the drive you are expecting to find the file on is no longer visible in Grub4dos. Always remember that the search stops with the first instance of the file you are scanning for. Even using marker files can result in unwanted behaviour if you had forgotten (or didn't know) that the file was on more than one device.
PREVIOUS INDEX NEXT