A collection of scripts for managing the rEFInd boot loader to simplify rebooting into specific operating systems from another booted OS instance. Particularly useful for dual-boot/multi-boot environments and remotely managed systems without the ability to choose boot entry over the network.
- Don't run any scripts without knowing what they do
- Always review script contents before execution
- Make sure you have proper backups of your EFI configuration
An all-in-one PowerShell script for Windows users that provides an interactive menu to manage rEFInd boot configuration.
Features:
- Automatic detection of EFI partitions with rEFInd
- Safe partition mounting with user consent
- Sets Linux (vmlinuz) as default boot option
- Interactive menu with multiple options
- Automatic backup creation before config changes
Menu Options:
- Detect and mount rEFInd partition
- Set Linux as default for next reboot
- Reboot computer now
- Run all steps automatically (A)
- Quit (Q)
Requirements:
- Windows with PowerShell
- Administrative rights to run as Administrator
- rEFInd boot manager installed on EFI partition
Usage:
# Run with default settings (mounts to R: drive)
.\reboot-to-linux-aio.ps1
# Specify custom drive letter
.\reboot-to-linux-aio.ps1 -PreferredLetter XA bash script for Linux users to set Windows as the default boot option in rEFInd.
Features:
- Automatically finds EFI partition mount point
- Sets Windows (Microsoft) as default boot option
- Creates automatic backup before changes
- Colored output for better readability
- Optional immediate reboot
Requirements:
- Linux with bash shell
- Root/sudo access
- rEFInd boot manager installed on EFI partition
- EFI partition mounted (usually at /boot/efi)
Usage:
# Make script executable
sudo chmod +x reboot-to-windows.sh
# Run with automatic EFI detection
sudo ./reboot-to-windows.sh
# Or specify EFI mount point manually
sudo ./reboot-to-windows.sh /boot/efi- Detection Phase: Script scans for EFI partitions with official ESP GUID
- Mount Phase: Mounts selected partition to specified drive letter (default: R:)
- Configuration: Updates
refind.confto setdefault_selection "vmlinuz" - Reboot: Optionally reboots immediately into Linux
- Detection Phase: Finds EFI partition at common mount points (/boot/efi, /efi, /boot)
- Backup: Creates backup of existing refind.conf
- Configuration: Updates
refind.confto setdefault_selection "Microsoft" - Reboot: Optionally reboots immediately into Windows
- Only accesses partitions with official EFI System Partition GUID
- Excludes Windows system disk entirely
- Uses temporary mount points for scanning (not permanent drive letters)
- Requires explicit user consent before mounting partitions
- Asks confirmation before unmounting existing drives
- Automatically requests sudo if not running as root
- Creates backup before modifying configuration
- Validates file read/write permissions
- Provides detailed error messages
- Asks confirmation before rebooting
Both scripts modify the refind.conf file located in:
/EFI/refind/refind.conf/EFI/BOOT/refind.conf
The scripts search both locations automatically.
"No EFI partitions with rEFInd folder were found"
- Ensure rEFInd is properly installed
- Check if EFI partition is on a different disk
- Verify partition has official ESP GUID
"Drive letter is already in use"
- Script will ask if you want to unmount it
- Choose 'Y' to proceed or 'N' to cancel
- Consider using different letter with
-PreferredLetterparameter
"Could not find EFI partition"
- Check if EFI partition is mounted:
mount | grep efi - Mount manually:
sudo mount /dev/sdXN /boot/efi - Specify mount point as argument to script
"Permission denied"
- Always run with sudo:
sudo ./reboot-to-windows.sh - Check if EFI partition is mounted read-only
"Could not find refind.conf"
- Verify rEFInd installation:
ls /boot/efi/EFI/refind/ - Check alternative location:
ls /boot/efi/EFI/BOOT/
Feel free to submit issues or pull requests if you find bugs or have suggestions for improvements.
These scripts are provided as-is for managing rEFInd boot configurations. Use at your own risk and always maintain backups of your EFI configuration.