Difference between revisions of "LiveUSB"

From ReactOS Wiki
Jump to: navigation, search
(Vgal USB state: add new section)
m (Adding /MININT to the BootCD causes registry to not be populated after installation which fails booting.)
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Warning|With current versions of ReactOS, USB support is '''NOT''' advanced enough to successfully boot, and ReactOS will crash when it begins loading system USB drivers. See e.g. {{JIRA|7826}}. The following details for older versions are left here for historical reference and for use in the future when this feature becomes supported again.}}
+
{{Warning|There are known bugs in both ReactOS kernel and USB drivers, so LiveUSB boot may intermittently crash or not work at all. '''Using latest 0.4.15 nightly builds is a prerequisite!'''}}
  
== Preamble ==
+
== Introduction ==
Revision {{rev|55555}} of ReactOS introduced support for [[USB]] devices, and after some time it became possible to run the OS from a USB drive. In revision 55714 ReactOS was successfully installed and running from Patriot Xporter XT 8Gb USB stick. [[LiveCD]] revision 55995 has also been successfully executed from the same device using USB 1.1 [[OHCI]].
+
New USB stack by Vadim Galyant was enabled in build 0.4.13-dev-942-g88cf5b0. After storage stack replacement and massive memory management work (as of build 0.4.15-dev-1796-gb0c143c), LiveUSB started to work as intended. Previously only RAMDISK method was recommended.
 +
If regular LiveUSB does not work for you after 2-3 tries with different USB ports, you can try RAMDISK method.
  
Note: To install on a USB-HDD, it is preferable to use Bootcd; and for a USB flash drive, it is preferable to use [[LiveCD]]. Differences between installing on USB-HDD or USB flash drive are minor, but keep in mind that the resources (speed and storage space) of a USB flash drive can be much more limited than those of a hard drive. Flash drives also often have a limited lifetime of read and writes before they become damaged or unusable.
+
== Burning ReactOS to a USB drive ==
  
For more convenient use or testing of LiveUSB mode, you need to know the following things:
+
'''NOTE:''' To install ReactOS from USB drive, download a BootCD, but first make sure LiveCD boots for you. To run ReactOS only from USB drive, download LiveCD. You cannot install ReactOS yet from a LiveCD.
* If you install bootcd, the first phase of installation to a virtual HDD in a virtual machine is much faster than directly to the USB-stick. Therefore later in this article we will consider how to transfer files needed to start the second phase of the installation from a virtual machine to a flash drive/USB-HDD.
 
* If you install ReactOS to a USB-drive and install the MBR/VBR using the installer (without formatting the disk), then it is likely that the system will be unable to boot. If you wish to boot more than just ReactOS from a USB drive, please refer to the second paragraph of this article.
 
* You also need a motherboard capable of booting a USB drive.  This guide assumes you have one and that it is already configured.
 
  
== Vgal USB state ==
+
=== Bootable USB from an ISO ===
Here is the current state of Vadim Galyant [https://github.com/reactos/reactos/pull/245/#issuecomment-367211489 USB patches].
+
This is an ordinary way to prepare USB, feel free to follow any guide for Windows.
 +
* On Windows [https://rufus.ie/ Rufus] tool can be used for that
 +
* On Linux [https://unetbootin.github.io/ UNetBootin] can be used
 +
* '''ReactOS feature:''' the iso will work even if written in a raw <code>dd</code> mode
  
Additional notes are listed below the table.
+
=== Ramdisk (aka USB-RAM) boot ===
 +
The basic idea of this method is to dump the whole unchanged iso file into memory first (make a ramdisk) and then boot from it without touching the original media.
  
{| class="sortable wikitable"
+
For this method, you should prepare a flash drive first. It should have a FAT32 filesystem and the [https://en.wikipedia.org/wiki/Multiboot_specification Multiboot specification]-capable bootloader should be installed on it.
|-
+
For example, you can use [https://wiki.syslinux.org/wiki/index.php?title=Install syslinux]. Here is how to install it (for syslinux version 6.x):
! style="width: 3%;" | # apply seq
 
! style="" | Patch name
 
! style="" | # PR
 
! style="" | Status
 
! style="width: 6%;" | LiveUSB Required
 
|-
 
| 1
 
| [USBPORT] Transaction Translator
 
| [https://github.com/reactos/reactos/pull/283 #283]
 
| {{StatusCell|Unknown}} | Not merged
 
| {{StatusCell|Stable}} | Yes
 
|-
 
| 2
 
| [USBPORT] Correct size adressing for PA (01)
 
| N/A
 
| {{StatusCell|Unknown}} | Not merged
 
| {{StatusCell|Stable}} | Yes
 
|-
 
| 3
 
| [USBOHCI_NEW] Correct size adressing for PA
 
| N/A
 
| {{StatusCell|Unknown}} | Not merged
 
| {{StatusCell|Stable}} | Yes
 
|-
 
| 4
 
| [USBOHCI_NEW] Enable driver
 
| N/A
 
| {{StatusCell|Unknown}} | Not merged
 
| {{StatusCell|Stable}} | Yes
 
|-
 
| 5
 
| [USBUHCI_NEW] Bring-in new USB UHCI driver '''(requires patch 2, 3)'''
 
| [https://github.com/reactos/reactos/pull/245 #245]
 
| {{StatusCell|Unknown}} | Not merged
 
| {{StatusCell|Stable}} | Yes
 
|-
 
| 6
 
| [USBEHCI_NEW] Bring-in new USB EHCI driver '''(requires patch 2, 3)'''
 
| [https://github.com/reactos/reactos/pull/301 #301]
 
| {{StatusCell|Unknown}} | Not merged
 
| {{StatusCell|Stable}} | Yes
 
|-
 
| 7
 
| [USBSTOR_NEW] Bring-in new USB Storage driver
 
| [https://github.com/reactos/reactos/pull/308 #308]
 
| {{StatusCell|Unknown}} | Not merged
 
| {{StatusCell|Stable}} | Yes
 
|-
 
| 8
 
| [USBHUB] Black list for unsupported devices
 
| N/A
 
| {{StatusCell|Unknown}} | Not merged
 
| {{StatusCell|Unknown}} | H/W depend
 
|-
 
| 9
 
| [USBHUB] Make ReactOS bootable from USB
 
| N/A
 
| {{StatusCell|Unknown}} | Not merged
 
| {{StatusCell|Stable}} | Yes
 
|-
 
| 10
 
| [USBCCGP] Fix SelectConfiguration NULL handling
 
| N/A
 
| {{StatusCell|Unknown}} | Not merged
 
|
 
|-
 
| 11
 
| [HID] Bring-in new USB HID support
 
| N/A
 
| {{StatusCell|Unknown}} | Not merged
 
|
 
|-
 
| 12
 
| [NTOSKRNL][HAL] Allow USB boot in PnP Enumeration Worker
 
| N/A
 
| {{StatusCell|Unknown}} | Not merged
 
| {{StatusCell|Stable}} | Yes
 
|-
 
| 13
 
| [USBHUB] Move DPRINT after check Status
 
| [https://github.com/reactos/reactos/pull/282 #282]
 
| {{StatusCell|Stable}} | Merged
 
|
 
|-
 
| 14
 
| [NTOSKRNL][BOOT] Hack for ImportHwIDs
 
| N/A
 
| {{StatusCell|Unknown}} | Not merged
 
|
 
|-
 
| 15
 
| [NTOSKRNL][USETUP] Hack for USB keyboard in 1st Stage Setup
 
| N/A
 
| {{StatusCell|Unknown}} | Not merged
 
|
 
|-
 
| 16
 
| [NTOSKRNL] Fix and improve IopValidateID()
 
| [https://github.com/reactos/reactos/pull/341 #341]
 
| {{StatusCell|Stable}} | Merged
 
|
 
|-
 
| 17
 
| [USBPORT][USBHUB_NEW] Fix QueryIDs
 
| N/A
 
| {{StatusCell|Unknown}} | Not merged
 
|
 
|}
 
  
=== Additional notes ===
+
==== On Linux ====
* To achieve successfull Live USB boot, it is enough to merge all patches that are marked as '''Required'''.
 
* Before merging new UHCI and EHCI drivers, "'''Correct size adressing for PA'''" patches should be merged.
 
* Patch #8 with black list of devices is required to boot successfully on some machines, until the support for Isochronous Transfers would be implemented.
 
  
== Installing the system to a USB-drive ==
+
Plug in the flash drive and leave it unmounted.
This process is now extremely simple thanks to Rufus!  Rufus is a Windows/ReactOS application.  If you use a different system, you'll need to seek an alternate method (like [[Boot FreeLoader from GRUB|GRUB]] for Linux and BSD users, or [http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-mac-osx diskutil] for Mac users).
+
Then run these commands:
# Get the latest version of Rufus from http://rufus.akeo.ie/
+
<pre>
# [http://reactos.org/getbuilds Download] a current '''livecd''' or '''bootcd''' image of ReactOS
+
sudo mkfs.vfat /dev/sdb1
# Run Rufus (give admin rights if asked), and setup like this:
+
sudo syslinux --install /dev/sdb1
## Select your USB drive from the Device drop-down menu
+
</pre>
## Select "Create a bootable startup disk using"
+
Note: here, <code>/dev/sdb1</code> is a partition on a flash drive
## Choose "ISO Image" from that drop down menu
 
## Click the disk icon next to that drop down menu, and select the .ISO file
 
## (Optional) tweak the other Rufus settings – ONLY if you know what you're doing
 
# Click "Start" in Rufus.  Acknowledge that this operating will erase everything currently on your USB drive.  Wait a few moments while Rufus does its magic.
 
# Try to boot. (Please do not use a computer where you store important data in order to avoid data loss!)
 
  
If it works (hooray!) do NOT let ReactOS change the filesystem or the boot record.  Doing so will render ReactOS unbootable until you repeat the above process.
+
==== On Windows ====
  
If it doesn't work (damn) it could be either due to a bug in the USB driver or because of a system regression (or regression of driver). Try to use a working revision (check the beginning of the article). If they work then you're dealing with a regression. Please [http://jira.reactos.org/ report] about it to the developers. If they also do not work then your USB controller or USB drive is not yet supported. Please report this too as a new [http://jira.reactos.org/ bug].
+
Use [https://rufus.ie/ Rufus] tool:
 +
 
 +
* Select your flash drive
 +
* Click "Show advanced drive properties"
 +
* Boot selection: <code>Syslinux 6.x</code>
 +
* Partition scheme: <code>MBR</code>, File system: <code>FAT32</code>
 +
* Format the drive using selected options above
 +
* Click "Yes" if you got network to download the "ldlinux.c32" or download it manually from the net
 +
 
 +
==== Next common steps for both platforms ====
 +
 
 +
At this point, you should have a bootloader installed onto the drive. Now it's time to copy some files onto it.
 +
 
 +
'''Notice''': you may [https://svn.reactos.org/packages/usbramboot.zip download] all the required files, except iso images, in a zip-archive. It uses freeldr.sys from the [https://git.reactos.org/?p=reactos.git;a=commit;h=fb4591c48c568d138d9d7aeaa90db4bd5885c6aa fb4591c] commit.
 +
 
 +
* Now you need to copy <code>mboot.c32</code> and <code>libcom32.c32</code> syslinux libraries to the root
 +
* Then copy a freeldr.sys bootloader from ReactOS [[0.4.13]] or higher
 +
* Now you need to write some configuration files. First, <code>syslinux.cfg</code>:
 +
 
 +
<pre>
 +
DEFAULT ReactOS
 +
LABEL ReactOS
 +
  KERNEL mboot.c32
 +
  APPEND /freeldr.sys
 +
</pre>
 +
* Then <code>freeldr.ini</code>:
 +
<pre>
 +
[FREELOADER]
 +
DefaultOS=BootCD_Debug
 +
TimeOut=5
 +
 
 +
[Display]
 +
TitleText=ReactOS LiveUSB
 +
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]
 +
LiveCD="LiveCD"
 +
LiveCD_Debug="LiveCD (Debug)"
 +
LiveCD_Screen="LiveCD (Screen)"
 +
BootCD="BootCD"
 +
BootCD_Debug="BootCD (Debug)"
 +
BootCD_Screen="BootCD (Screen)"
 +
 
 +
[LiveCD]
 +
BootType=Windows2003
 +
SystemPath=ramdisk(0)\reactos
 +
Options=/MININT /RDPATH=livecd.iso /RDEXPORTASCD
 +
 
 +
[LiveCD_Debug]
 +
BootType=Windows2003
 +
SystemPath=ramdisk(0)\reactos
 +
Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT /RDPATH=livecd.iso /RDEXPORTASCD
 +
 
 +
[LiveCD_Screen]
 +
BootType=Windows2003
 +
SystemPath=ramdisk(0)\reactos
 +
Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT /RDPATH=livecd.iso /RDEXPORTASCD
 +
 
 +
[BootCD]
 +
BootType=ReactOSSetup
 +
SystemPath=ramdisk(0)\
 +
Options=/RDPATH=bootcd.iso /RDEXPORTASCD
 +
 
 +
[BootCD_Debug]
 +
BootType=ReactOSSetup
 +
SystemPath=ramdisk(0)\
 +
Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /RDPATH=bootcd.iso /RDEXPORTASCD
 +
 
 +
[BootCD_Screen]
 +
BootType=ReactOSSetup
 +
SystemPath=ramdisk(0)\
 +
Options=/DEBUG /DEBUGPORT=SCREEN /SOS /RDPATH=bootcd.iso /RDEXPORTASCD
 +
</pre>
 +
'''Note:''' for detailed explanation, see [[Boot options]]
 +
* Now place <code>bootcd.iso</code> and/or <code>livecd.iso</code> in the root of the disk (or whatever path configured in <code>freeldr.ini</code>)
 +
* Ready to boot
 +
 
 +
==Sending bug reports==
 +
 
 +
If it doesn't work, it could be either due to a bug in the kernel, USB drivers or in another place. To debug it, you can try to boot ReactOS from USB drive again with <code>Debug (Screen)</code> option at the FreeLoader. At the time you encounter a debug prompt (starting with <code>kdb:></code>), type <code>bt</code> and take the photo of backtrace, then you can report it in JIRA.
 +
 
 +
See [[Debugging]] and [[File Bugs]] for more details.
  
 
== References ==
 
== References ==
* [[Boot FreeLoader from GRUB]]
 
 
* ReactOS Live-in-RAM USB-stick creation tutorial https://youtu.be/eancDwmWyCw
 
* ReactOS Live-in-RAM USB-stick creation tutorial https://youtu.be/eancDwmWyCw
 +
* ReactOS LiveUSB Guide https://www.youtube.com/watch?v=pw1CGQR_dvQ
  
 
[[Category:Tutorial]]
 
[[Category:Tutorial]]

Latest revision as of 06:34, 19 March 2024

Icon speedy deletion.png Warning: There are known bugs in both ReactOS kernel and USB drivers, so LiveUSB boot may intermittently crash or not work at all. Using latest 0.4.15 nightly builds is a prerequisite!


Introduction

New USB stack by Vadim Galyant was enabled in build 0.4.13-dev-942-g88cf5b0. After storage stack replacement and massive memory management work (as of build 0.4.15-dev-1796-gb0c143c), LiveUSB started to work as intended. Previously only RAMDISK method was recommended. If regular LiveUSB does not work for you after 2-3 tries with different USB ports, you can try RAMDISK method.

Burning ReactOS to a USB drive

NOTE: To install ReactOS from USB drive, download a BootCD, but first make sure LiveCD boots for you. To run ReactOS only from USB drive, download LiveCD. You cannot install ReactOS yet from a LiveCD.

Bootable USB from an ISO

This is an ordinary way to prepare USB, feel free to follow any guide for Windows.

  • On Windows Rufus tool can be used for that
  • On Linux UNetBootin can be used
  • ReactOS feature: the iso will work even if written in a raw dd mode

Ramdisk (aka USB-RAM) boot

The basic idea of this method is to dump the whole unchanged iso file into memory first (make a ramdisk) and then boot from it without touching the original media.

For this method, you should prepare a flash drive first. It should have a FAT32 filesystem and the Multiboot specification-capable bootloader should be installed on it. For example, you can use syslinux. Here is how to install it (for syslinux version 6.x):

On Linux

Plug in the flash drive and leave it unmounted. Then run these commands:

sudo mkfs.vfat /dev/sdb1
sudo syslinux --install /dev/sdb1

Note: here, /dev/sdb1 is a partition on a flash drive

On Windows

Use Rufus tool:

  • Select your flash drive
  • Click "Show advanced drive properties"
  • Boot selection: Syslinux 6.x
  • Partition scheme: MBR, File system: FAT32
  • Format the drive using selected options above
  • Click "Yes" if you got network to download the "ldlinux.c32" or download it manually from the net

Next common steps for both platforms

At this point, you should have a bootloader installed onto the drive. Now it's time to copy some files onto it.

Notice: you may download all the required files, except iso images, in a zip-archive. It uses freeldr.sys from the fb4591c commit.

  • Now you need to copy mboot.c32 and libcom32.c32 syslinux libraries to the root
  • Then copy a freeldr.sys bootloader from ReactOS 0.4.13 or higher
  • Now you need to write some configuration files. First, syslinux.cfg:
DEFAULT ReactOS
LABEL ReactOS
  KERNEL mboot.c32
  APPEND /freeldr.sys
  • Then freeldr.ini:
[FREELOADER]
DefaultOS=BootCD_Debug
TimeOut=5

[Display]
TitleText=ReactOS LiveUSB
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]
LiveCD="LiveCD"
LiveCD_Debug="LiveCD (Debug)"
LiveCD_Screen="LiveCD (Screen)"
BootCD="BootCD"
BootCD_Debug="BootCD (Debug)"
BootCD_Screen="BootCD (Screen)"

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

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

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

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

[BootCD_Debug]
BootType=ReactOSSetup
SystemPath=ramdisk(0)\
Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /RDPATH=bootcd.iso /RDEXPORTASCD

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

Note: for detailed explanation, see Boot options

  • Now place bootcd.iso and/or livecd.iso in the root of the disk (or whatever path configured in freeldr.ini)
  • Ready to boot

Sending bug reports

If it doesn't work, it could be either due to a bug in the kernel, USB drivers or in another place. To debug it, you can try to boot ReactOS from USB drive again with Debug (Screen) option at the FreeLoader. At the time you encounter a debug prompt (starting with kdb:>), type bt and take the photo of backtrace, then you can report it in JIRA.

See Debugging and File Bugs for more details.

References