Difference between revisions of "LiveUSB"

From ReactOS Wiki
Jump to: navigation, search
m (On Windows)
 
(53 intermediate revisions by 19 users not shown)
Line 1: Line 1:
In revision 55555 in ReactOS was introduced support for USB devices, and after some time it became possible to run the OS from a USB drive. In revision 55714 system was successfully installed and running from Patriot Xporter XT 8Gb USB stick.
+
{{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!'''}}
LiveCD revision 55995 has also been successfully executed from the same device using USB 1.1 OHCI.
 
  
Note: To install on USB-HDD is preferable to use Bootcd, and for USB flash drive more preferable option is LiveCD. Differences between installing on USB-HDD or USB flash drive are tiny, but keep in mind that the resource of a USB flash drive is much smaller than that of hard drives. Although ReactOS is not Windows, and intentional resource exhaustion (excessive overwriting of files by the system) should be small or even not present.
+
== 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.
  
For more convenient use or testing of LiveUSB mode, you need to know the following things:
+
== Burning ReactOS to a USB drive ==
* 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 will setup 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. And if you want to load from a flash drive not only ReactOS, please refer to the second paragraph of this article.
 
  
=Installing the system 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.
  
==Transferring files from VM to USB-drive==
+
=== Bootable USB from an ISO ===
First of all, you need to install and run on your computer a virtual machine that supports virtual hard disks format vmdk. These VMs are, for example, [[VirtualBox]] and [[VMware | VMWare Player]]. Then, install ReactOS in a virtual machine, then close the VM.
+
This is an ordinary way to prepare USB, feel free to follow any guide for Windows.
Next, you need to download the command-line utility [http://downloads.vmware.com/d/details/disk_mount_utility_5_5_driver_tools/JSpiZGR0cGJkd2U= VMWare Disk Mount Utility]
+
* On Windows [https://rufus.ie/ Rufus] tool can be used for that
Go using command line to the program's folder and execute:
+
* 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
  
vmware-mount x: path_to_the_vmdk_file
+
=== 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.
  
Copy the files from mounted drive to USB-Drive
+
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):
  
Disassemble the image using next command:
+
==== On Linux ====
  
vmware-mount / d x:
+
Plug in the flash drive and leave it unmounted.
 +
Then run these commands:
 +
<pre>
 +
sudo mkfs.vfat /dev/sdb1
 +
sudo syslinux --install /dev/sdb1
 +
</pre>
 +
Note: here, <code>/dev/sdb1</code> is a partition on a flash drive
  
Note: If you want to use other formats of virtual hard disks, then you have to use other similar utilities.
+
==== On Windows ====
  
==Installing the MBR==
+
Use [https://rufus.ie/ Rufus] tool:
To load ReactOS you can use Grub4Dos. Get the latest version of the archive [http://sourceforge.net/projects/grub4dos/files/GRUB4DOS/ GRUB], as well as  [http://sourceforge.net/projects/grub4dos/files/grubinst/ GUI installer].
 
* Extract the installer, copy to its folder files from GRUB package.
 
* Run the GRUB GUI, choose from the disk list your USB flash drive (if you're using Windows, then the number can be found in the Disk Manager). Click to install. Close the window with the message about successful installation.
 
* Copy file called "grub" to your USB drive.
 
* If a partition on a flash drive is not active, then make it activeusing any partition management utility.
 
* Create a menu.lst using next template:
 
  
color blue/green yellow/red white/magenta white/magenta
+
* Select your flash drive
timeout 30
+
* Click "Show advanced drive properties"
default/default
+
* Boot selection: <code>Syslinux 6.x</code>
+
* Partition scheme: <code>MBR</code>, File system: <code>FAT32</code>
title ReactOS
+
* Format the drive using selected options above
root (hd0, 0)
+
* Click "Yes" if you got network to download the "ldlinux.c32" or download it manually from the net
kernel/freeldr.sys
 
 
title ReactLive
 
root (hd0, 0)
 
kernel/loader / setupldr.sys
 
 
title reboot
 
reboot
 
  
Done.
+
==== Next common steps for both platforms ====
  
Try to boot. If it doesn't work (damn) it could be either due to a bug in the USB driver or because the system regression (or regression of driver). Try to use working revision (check the beginning of the article). If they work then you're dealing with regression. Please [http://www.reactos.org/bugzilla/ report] about it to developers. If they also do not work then your USB controller or USB drive is not yet supported. Please report this too as new [http://www.reactos.org/bugzilla/ bug].
+
At this point, you should have a bootloader installed onto the drive. Now it's time to copy some files onto it.
  
==References==
+
'''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.
[[Boot_FreeLoader_from_GRUB]]
+
 
 +
* 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=/MININT /RDPATH=bootcd.iso /RDEXPORTASCD
 +
 
 +
[BootCD_Debug]
 +
BootType=ReactOSSetup
 +
SystemPath=ramdisk(0)\
 +
Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT /RDPATH=bootcd.iso /RDEXPORTASCD
 +
 
 +
[BootCD_Screen]
 +
BootType=ReactOSSetup
 +
SystemPath=ramdisk(0)\
 +
Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT /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 ==
 +
* 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]]

Latest revision as of 13:12, 13 March 2022

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=/MININT /RDPATH=bootcd.iso /RDEXPORTASCD

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

[BootCD_Screen]
BootType=ReactOSSetup
SystemPath=ramdisk(0)\
Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT /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