User:Illen/RAM Boot

From ReactOS Wiki
Jump to: navigation, search

This page used to be the original RAM disk installation guide, now it consist of additional information regarding RAM disk in ReactOS (such as alternative method for RAM disk installation using installfreeldr instead of syslinux/rufus, or booting ReactOS from a writable RAM disk).

ReactOS RAM disk installation

The following method is applicable only for ReactOS version 0.4.11 or newer.

Generally it is recommended to first try native USB boot (that is, flashing the official ISO with rufus or dd). If that fails or your hardware has only xHCI USB controllers (generally, Skylake/Ryzen and newer), try RAM disk boot.

You will need installfreeldr tool to write the FreeLDR boot sector, you can extract it from dev build images. On Linux, you can just clone this repo (git clone https://github.com/archeYR/installfreeldr-linux), compile it (cd installfreeldr-linux && gcc install.c volume.c -o installfreeldr), and run the binary as (./installfreeldr). Alternatively you can use a Windows version in a ReactOS VM with USB passthrough.

First, wipe your target USB drive clean (remove all the partitions). Make sure the partition table on your USB drive is MBR. Execute installfreeldr as following:

installfreeldr [drive letter on Windows/device label on Linux of your target USB drive] [fs_type (can be FAT32 or FAT)]

As pointed out by the tool itself, you need to get freeldr.sys and freeldr.ini files on root of your target USB drive. You can extract freeldr.sys (or setupldr.sys, and rename it) from loader folder on BootCD/LiveCD image, and create the blank freeldr.ini file.

You may have to mark the volume on your USB drive as active, you can do that with DISKPART/parted tool, or some 3rd party partition manager such as GParted.

Setting up FreeLoader

Now you will need to configure FreeLoader to load the ISO image to RAM and boot ReactOS from RAM disk. Here is the example of freeldr.ini configured to load the Setup or Live image:

[FREELOADER]
DefaultOS=Setup
TimeOut=5

[Display]
TitleText=ReactOS Setup
StatusBarColor=Cyan
StatusBarTextColor=Black
BackdropTextColor=White
BackdropColor=Blue
BackdropFillStyle=Medium
TitleBoxTextColor=White
TitleBoxColor=Red
MessageBoxTextColor=White
MessageBoxColor=Blue
MenuTextColor=Gray
MenuColor=Black
TextColor=Gray
SelectedTextColor=Black
SelectedColor=Gray
ShowTime=No
MenuBox=No
CenterMenu=No
MinimalUI=Yes
TimeText=Seconds until highlighted choice will be started automatically:   

[Operating Systems]
Setup_Debug="Setup (Debug)"
Setup_Screen="Setup (Screen)"
LiveCD="LiveCD"
LiveCD_Debug="LiveCD (Debug)"
LiveCD_Screen="LiveCD (Screen)"

[Setup_Debug]
BootType=ReactOSSetup
SystemPath=ramdisk(0)
Options=/RDPATH=bootcd.iso /RDEXPORTASCD

[Setup_Screen]
BootType=ReactOSSetup
SystemPath=ramdisk(0)
Options=/RDPATH=bootcd.iso /RDEXPORTASCD /SIFOPTIONSOVERRIDE /SOS /DEBUG /DEBUGPORT=SCREEN

[LiveCD]
BootType=Windows2003
SystemPath=ramdisk(0)\reactos
Options=/MININT /RDPATH=livecd.iso /RDEXPORTASCD

[LiveCD_Debug]
BootType=Windows2003
SystemPath=ramdisk(0)\reactos
Options=/MININT /RDPATH=livecd.iso /RDEXPORTASCD /SOS /DEBUG /DEBUGPORT=COM1

[LiveCD_Screen]
BootType=Windows2003
SystemPath=ramdisk(0)\reactos
Options=/MININT /RDPATH=livecd.iso /RDEXPORTASCD /SOS /DEBUG /DEBUGPORT=SCREEN

You can just copy & paste the configuration from above to your newly created freeldr.ini file.

At this point, the USB drive is fully prepared to RAM boot your ReactOS ISO image, just copy it onto root of USB drive (and remember to rename it as specified by /RDPATH in freeldr.ini).

Prepare the RAM bootable CD/DVD/BD

The following method is applicable only for ReactOS version 0.4.11 or newer.

It is possible to load the ReactOS image into RAM from compact discs as well. You can install ReactOS through optical drive connected to xHCI USB port (or any other unsupported interface).

You will need mkisofs utility (download the Win32 version here). Create the new folder anywhere you want and name it whatever you want (I will use "cdfiles" as a name here), this folder will hold the data that will be later burned onto a CD. Create freeldr.ini file in cdfiles folder, you can take the configuration from above. Extract setupldr.sys and its ISO boot sector (isoboot.bin) from BootCD/LiveCD image to cdfiles\loader (create the folder). Copy ReactOS BootCD and/or LiveCD to cdfiles folder, and then execute mkisofs as following:

mkisofs -no-emul-boot -iso-level 4 -eltorito-boot loader/isoboot.bin -o RAMBootCD.iso cdfiles

Now you should get the ISO image generated by mkisofs, which is ready to be burned onto optical disc. You can check the ISO image in VM software to make sure everything is alright.

Boot from writable RAM disk

The following method is applicable only for ReactOS version 0.4.14 or newer (0.4.15 or newer is recommended, as it supports FAT filesystem for HDD image).

Writable RAM disk might be very useful if native USB boot fails and you cannot install ReactOS on internal drive (be it, because the storage controller is unsupported or you simply don't want to install ReactOS). Unlike the default read-only RAM disk boot, which is very limited(for example, RAPPS will not work without a writable folder). It allows you to write data on a boot volume and therefore eases testing on modern hardware.

You will need a ramdisk.sys driver from Windows Server 2003. ReactOS ramdisk.sys does have a limited write support, however it's not quite enough yet for this task. You can download Service Pack 2 package(from Microsoft Download Center or Internet Archive), and extract the ramdisk driver (should be in a CAB archive named ramdisk.sy_ inside of the executable file) using an archiving tool, like 7zip (for both the exe and cab/.sy_ files).

Create a RAW HDD image that is no bigger than 480 MB, formatted with FAT32 filesystem (ext2 for ReactOS 0.4.14). I will be using ImDisk here, but you can use qemu-img on non-Windows OSes. Open ImDisk Virtual Disk Driver, press "Mount new...", choose a drive letter (I will use N: here), set size of virtual disk to 480 in megabytes, image file offset to 32256 in bytes, and device to Harddisk volume. Now you should get a prompt to format a N:, which is your newly created HDD image. Format it with FAT32 (for ReactOS 0.4.14 and ext2, you will need ext4fsd). Download ReactOS LiveCD if you haven't done so already, extract the reactos and Profiles folders of ISO to N:\, copy the Windows ramdisk.sys that you have extracted from SP2 package to N:\reactos\system32\drivers (and replace existing ramdisk.sys), right-click on N: drive and click "Save disk contents as image file", put the path where you want to save your new HDD image and keep the other settings as-is. From here on, you can either create a new ISO file with this HDD image and freeldr for DVD, or you can follow the ReactOS RAM disk installation for preparation of your USB drive for RAM disk boot. After preparing your USB drive, copy the HDD image onto root of USB drive, add /RDIMAGEOFFSET=32256 flag (the value which was specified in ImDisk when creating HDD image), remove /MININT and /RDEXPORTASCD flags in freeldr.ini, and also don't forget to correct the /RDPATH flag to point to the HDD image instead of a ISO. If everything went well, you should be able to boot to a LiveCD sort of system and also write to the boot volume (which is writable RAM disk).

Known issues

Load process of RAM-disk stuck on the screen with the progress bar

  1. Wait a bit more. It may take 1-10 minutes, depending on your USB drive and controller. If you are using USB 1.1 drive or controller, expect it to take hours until ReactOS image is loaded into RAM.
  2. Retry with a different USB-stick. The problem may be related to the local incompatibility of the computer's USB chipset and the internal controller of the USB flash drive.

The "Opening hive file failed!" error

After the 1st stage setup, you will (most likely) get the "Opening hive file failed!" error when attempting to load into 2nd stage setup. A workaround is to boot into LiveCD, check the drive and partition numbers using DISKPART, and update your freeldr.ini accordingly (in most cases, just need to lower rdisk value by 1). Another "hit or miss" method is to press F10 on a boot entry in FreeLDR menu, and try different system paths until you find the correct drive/partition numbers and successfully load ReactOS.

1st stage setup freezes randomly

It might happen due to following reasons:

  • You are installing ReactOS over an existing system installation. If so, please use some bootable partition manager (GParted for example), and remove all the partitions on the internal drive.
  • You are installing ReactOS on hardware with OHCI/UHCI (USB 1.0/1.1) or EHCI (USB 2.0) USB controller. Unplug all the USB devices and try again, if that doesn't help, unplug the USB drive with ReactOS installation, right after the RAM disk loading process is complete, it is not needed for setup. If you still have issues with setup, you have to create your own build with USB components disabled.

The "Setup could not find a harddisk." error

It means that either the UniATA driver has regressed and it does not work with your SATA controller at the moment, or your drive controller is just not supported. ReactOS has very limited SCSI support, there is only one driver for certain BusLogic controllers (BT 958 and derivatives). If ReactOS has no driver for your controller, you may have to slipstream the Windows driver for it (either from the Windows ISO or from vendor). It is also known that UniATA does not work with SATA controllers found in AMD X570 and newer systems (and possibly Intel Z390 and newer too). Please try the older ReactOS version (but not older than 0.4.11), and/or wait until it is fixed in master. You can also create the JIRA issue, if you believe your issue is not known yet. Note that ReactOS has no NVMe driver, so you can't install ReactOS on NVMe SSDs yet.

1st stage setup hangs at "Flushing cache"

It might happen for various reasons. The universal solution is just to wait a moment to ensure that the data was properly saved and then manually reset your computer, unfortunately you might have to do it each time you want to reboot your computer.

No input on USB perhipherals in 2nd stage setup

Many modern mainboards don't enable PS/2 emulation on ACPI-aware operating systems, please choose a Standard PC Uniprocessor computer type during 1st stage setup to workaround this problem.

Blue screen error with code 0xB4 (VIDEO_DRIVER_INIT_FAILURE) after 1st stage setup

Choosing a Standard PC Uniprocessor computer type or VGA display might be a solution for this problem too.

External links