/[gentoo]/xml/htdocs/doc/en/liveusb.xml
Gentoo

Diff of /xml/htdocs/doc/en/liveusb.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.12 Revision 1.13
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/liveusb.xml,v 1.12 2006/12/22 07:33:38 nightmorph Exp $ --> 3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/liveusb.xml,v 1.13 2007/05/10 15:51:09 neysx Exp $ -->
4 4
5<guide link="/doc/en/liveusb.xml"> 5<guide link="/doc/en/liveusb.xml">
6<title>Gentoo Linux LiveUSB HOWTO</title> 6<title>Gentoo Linux LiveUSB HOWTO</title>
7 7
8<author title="Author"> 8<author title="Author">
9 <mail link="henrik@brixandersen.dk">Henrik Brix Andersen</mail> 9 <mail link="henrik@brixandersen.dk">Henrik Brix Andersen</mail>
10</author> 10</author>
11<author title="Editor">
12 <mail link="neysx@gentoo.org">Xavier Neys</mail>
13</author>
11 14
12<abstract> 15<abstract>
13This HOWTO explains how to create a Gentoo Linux LiveUSB or, in other words, 16This HOWTO explains how to create a Gentoo Linux LiveUSB or, in other words,
14how to emulate a Gentoo Linux Installation CD using an USB flash drive. 17how to emulate an x86 or AMD64 Gentoo Linux LiveCD using a USB flash drive.
15</abstract> 18</abstract>
16 19
17<!-- The content of this document is licensed under the CC-BY-SA license --> 20<!-- The content of this document is licensed under the CC-BY-SA license -->
18<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 21<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
19<license/> 22<license/>
20 23
21<version>1.7</version> 24<version>2</version>
22<date>2006-12-21</date> 25<date>2007-05-10</date>
23 26
24<chapter> 27<chapter>
25<title>Introduction</title> 28<title>Introduction</title>
26<section> 29<section>
27<title>The LiveUSB</title> 30<title>The LiveUSB</title>
28<body> 31<body>
29 32
30<p> 33<p>
31This HOWTO explains how to create a <e>Gentoo Linux LiveUSB</e> or, in other 34This HOWTO explains how to create a <e>Gentoo Linux LiveUSB</e> or, in other
32words, how to emulate a Gentoo Linux Installation CD using an USB flash drive. 35words, how to emulate an x86 or AMD64 Gentoo Linux LiveCD using a USB flash
33This is particularly useful for installing Gentoo Linux on a modern laptop with 36drive. This is particularly useful for installing Gentoo Linux on a modern
34no CD-ROM drive. 37laptop with no CD-ROM drive.
35</p> 38</p>
36 39
37<p> 40<p>
38Although the instructions found in this document aim at emulating a Gentoo 41Although the instructions found in this document aim at emulating a Gentoo
39Linux Installation CD using an USB flash drive, they should work for any 42Linux LiveCD using a USB flash drive, they should work for any arbitrary block
40arbitrary block device as long as you adjust the device names accordingly. 43device as long as you adjust the device names accordingly.
41</p> 44</p>
42 45
43</body> 46</body>
44</section> 47</section>
45<section> 48<section>
49<p> 52<p>
50In order to use a Gentoo Linux LiveUSB you need the following: 53In order to use a Gentoo Linux LiveUSB you need the following:
51</p> 54</p>
52 55
53<ul> 56<ul>
54 <li>Bootable USB flash drive (at least 64MB)</li> 57 <li>Bootable USB flash drive with at least 1GB</li>
55 <li>
56 x86 computer with support for booting from USB 58 <li>i686 or x86_64 computer with support for booting from USB</li>
57 </li>
58</ul> 59</ul>
59 60
60<p> 61<p>
61You will also need access to the following for creating the LiveUSB: 62You will also need access to the following for creating the LiveUSB:
62</p> 63</p>
66 A computer running Gentoo Linux (or alternatively another Linux 67 A computer running Gentoo Linux (or alternatively another Linux
67 distribution) 68 distribution)
68 </li> 69 </li>
69</ul> 70</ul>
70 71
72<note>
73If you want to use the minimal CD on a smaller key or boot a &lt;i686 system,
74you need to follow the procedure described in this document with a
75<b>2006.0</b> minimal CD image because of a <uri
76link="http://bugs.gentoo.org/show_bug.cgi?id=173117">bug</uri> in more recent
77releases.
78</note>
79
71</body> 80</body>
72</section> 81</section>
73</chapter> 82</chapter>
74<chapter> 83<chapter>
75<title>Preparing the USB flash drive</title> 84<title>Preparing the USB flash drive</title>
81These instructions will erase all data from the USB flash drive. Make sure to 90These instructions will erase all data from the USB flash drive. Make sure to
82backup your data first. 91backup your data first.
83</warn> 92</warn>
84 93
85<impo> 94<impo>
86This HOWTO assumes that the <path>/dev/sda</path> device node corresponds to 95This HOWTO assumes that the <path>/dev/sdc</path> device node corresponds to
87your USB flash drive. If you have other SCSI-like devices make sure to use the 96your USB flash drive. If you have other SCSI-like devices make sure to use the
88correct device node. 97correct device node.
89</impo> 98</impo>
90 99
91<p> 100<p>
92Create a FAT32 partition on your USB flash drive and mark it bootable using 101Create a FAT16 partition on your USB flash drive and mark it bootable using
93<c>fdisk</c>. An example partitioning scheme can be seen below: 102<c>fdisk</c>. An example partitioning scheme can be seen below:
94</p> 103</p>
95 104
105<note>
106If your key is 4GB or larger, use partition type <c>b</c> (W95 FAT32).
107</note>
108
96<pre caption="Example partitioning scheme"> 109<pre caption="Example partitioning scheme">
97# <i>fdisk -l /dev/sda</i> 110# <i>fdisk -l /dev/sdc</i>
98 111
99Disk /dev/sda: 1048 MB, 1048313856 bytes 112Disk /dev/sdc: 2063 MB, 2063597056 bytes
10033 heads, 61 sectors/track, 1017 cylinders 113255 heads, 63 sectors/track, 250 cylinders
101Units = cylinders of 2013 * 512 = 1030656 bytes 114Units = cylinders of 16065 * 512 = 8225280 bytes
102 115
103 Device Boot Start End Blocks Id System 116 Device Boot Start End Blocks Id System
104/dev/sda1 * 1 1017 1023580 b W95 FAT32 117/dev/sdc1 * 1 250 2008124+ 6 FAT16
105</pre> 118</pre>
106 119
107</body> 120</body>
108</section> 121</section>
109<section> 122<section>
110<title>Creating the filesystem</title> 123<title>Creating the filesystem</title>
111<body> 124<body>
112 125
113<p> 126<p>
114Create a FAT32 filesystem on the USB flash drive using <c>mkdosfs</c>: 127Create a FAT16 filesystem on the USB flash drive using <c>mkdosfs</c>:
115</p> 128</p>
129
130<note>
131If your key is 4GB or larger, use <c>-F 32</c> to create a FAT32 filesystem.
132</note>
116 133
117<pre caption="Running mkdosfs"> 134<pre caption="Running mkdosfs">
118<comment>(Make sure you have sys-fs/dosfstools installed)</comment> 135<comment>(Make sure you have sys-fs/dosfstools installed)</comment>
119# <i>emerge -av sys-fs/dosfstools</i> 136# <i>emerge -av sys-fs/dosfstools</i>
120# <i>mkdosfs -F 32 /dev/sda1</i> 137# <i>mkdosfs -F 16 /dev/sdc1</i>
121mkdosfs 2.11 (12 Mar 2005) 138mkdosfs 2.11 (12 Mar 2005)
122</pre> 139</pre>
123 140
124</body> 141</body>
125</section> 142</section>
133</p> 150</p>
134 151
135<pre caption="Installing a master boot record"> 152<pre caption="Installing a master boot record">
136<comment>(Make sure you have sys-boot/syslinux-3.00 or later installed)</comment> 153<comment>(Make sure you have sys-boot/syslinux-3.00 or later installed)</comment>
137# <i>emerge -av '>sys-boot/syslinux-3'</i> 154# <i>emerge -av '>sys-boot/syslinux-3'</i>
138# <i>dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda</i> 155# <i>dd if=/usr/lib/syslinux/mbr.bin of=/dev/sdc</i>
1390+1 records in 1560+1 records in
1400+1 records out 1570+1 records out
158304 bytes (304 B) copied, 0.0162317 s, 18.7 kB/s
141</pre> 159</pre>
142 160
143</body> 161</body>
144</section> 162</section>
145</chapter>
146<chapter> 163</chapter>
164
165<chapter>
147<title>Copying the files</title> 166<title>Copying the files to your key</title>
148<section> 167<section>
149<title>Mounting the Gentoo Linux Installation CD</title> 168<title>Mounting the Gentoo Linux Installation CD</title>
150<body> 169<body>
151 170
152<warn>
153This guide is designed only to be used with Gentoo 2006.0. Do not attempt to
154use a 2006.1 CD or newer; you will end up with an unbootable USB disk.
155</warn>
156
157<p> 171<p>
158Download the <path>install-x86-minimal-2006.0.iso</path> file from your 172Download either <path>livecd-i686-installer-2007.0.iso</path> or
173<path>livecd-amd64-installer-2007.0.iso</path> from your local Gentoo Linux
159local Gentoo Linux <uri link="/main/en/where.xml">mirror</uri> site and mount 174<uri link="/main/en/where.xml">mirror</uri> site and mount the ISO image on
160the ISO image on <path>/mnt/cdrom/</path> as shown below: 175<path>/mnt/cdrom</path> as shown below:
161</p> 176</p>
162 177
163<pre caption="Mounting the Gentoo Linux Installation CD ISO image"> 178<pre caption="Mounting the Gentoo Linux Installation CD ISO image">
164<comment>(Create the /mnt/cdrom/ mount point if needed)</comment> 179<comment>(Create the /mnt/cdrom mount point if needed)</comment>
165# <i>mkdir -p /mnt/cdrom</i> 180# <i>mkdir -p /mnt/cdrom</i>
166# <i>mount -o loop,ro -t iso9660 install-x86-minimal-2006.0.iso /mnt/cdrom/</i> 181# <i>mount -o loop,ro -t iso9660 livecd-i686-installer-2007.0.iso /mnt/cdrom</i>
167</pre> 182</pre>
168 183
169<note> 184<note>
170If you receive a <e>Could not find any loop device</e> error message when 185If you receive a <e>Could not find any loop device</e> error message when
171mounting the iso, you need to enable the <c>Loopback device support</c> option 186mounting the iso, you need to enable the <c>Loopback device support</c> option
177<section> 192<section>
178<title>Mounting the LiveUSB</title> 193<title>Mounting the LiveUSB</title>
179<body> 194<body>
180 195
181<p> 196<p>
182Mount the newly formatted USB flash drive on <path>/mnt/usb/</path> as shown 197Mount the newly formatted USB flash drive on <path>/mnt/usb</path> as shown
183below: 198below:
184</p> 199</p>
185 200
186<pre caption="Mounting the USB flash drive"> 201<pre caption="Mounting the USB flash drive">
187<comment>(Create the /mnt/usb/ mount point if needed)</comment> 202<comment>(Create the /mnt/usb mount point if needed)</comment>
188# <i>mkdir -p /mnt/usb</i> 203# <i>mkdir -p /mnt/usb</i>
189# <i>mount -t vfat /dev/sda1 /mnt/usb/</i> 204# <i>mount -t vfat /dev/sdc1 /mnt/usb</i>
190</pre> 205</pre>
191 206
192</body> 207</body>
193</section> 208</section>
194<section> 209<section>
200need to be reordered a bit as we will be using the <c>syslinux</c> bootloader 215need to be reordered a bit as we will be using the <c>syslinux</c> bootloader
201instead of <c>isolinux</c>: 216instead of <c>isolinux</c>:
202</p> 217</p>
203 218
204<pre caption="Copying the files"> 219<pre caption="Copying the files">
205# <i>cp -r /mnt/cdrom/* /mnt/usb/</i> 220# <i>cp -r /mnt/cdrom/* /mnt/usb</i>
206# <i>mv /mnt/usb/isolinux/* /mnt/usb/</i> 221# <i>mv /mnt/usb/isolinux/* /mnt/usb</i>
207# <i>mv /mnt/usb/isolinux.cfg /mnt/usb/syslinux.cfg</i> 222# <i>mv /mnt/usb/isolinux.cfg /mnt/usb/syslinux.cfg</i>
208# <i>rm -rf /mnt/usb/isolinux*</i> 223# <i>rm -rf /mnt/usb/isolinux*</i>
209 224
210<comment>(The memtest86 kernel needs to be renamed for loading it via syslinux)</comment> 225<comment>(The memtest86 kernel needs to be renamed for loading it via syslinux)</comment>
211# <i>mv /mnt/usb/memtest86 /mnt/usb/memtest</i> 226# <i>mv /mnt/usb/memtest86 /mnt/usb/memtest</i>
214<p> 229<p>
215You can now unmount the ISO image: 230You can now unmount the ISO image:
216</p> 231</p>
217 232
218<pre caption="Unmounting the ISO image"> 233<pre caption="Unmounting the ISO image">
219# <i>umount /mnt/cdrom/</i> 234# <i>umount /mnt/cdrom</i>
220</pre> 235</pre>
221 236
222</body> 237</body>
223</section> 238</section>
224<section> 239<section>
225<title>Adjusting the bootloader configuration</title> 240<title>Adjusting the bootloader configuration</title>
226<body> 241<body>
227 242
228<p> 243<p>
229Adjust the syslinux configuration file using <c>sed</c> as shown below. The 244Adjust the syslinux configuration file using <c>sed</c> as shown below. The
230<c>dobladecenter</c> parameter will introduce some extra delays before 245<c>slowusb</c> parameter will introduce some extra delays before attempting to
231attempting to mount the filesystem. This is needed to allow the USB 246mount the filesystem. This is needed to allow the USB flash drive to settle
232flash drive to settle upon detection. 247upon detection.
233</p> 248</p>
234 249
235<pre caption="Adjusting the boot parameters"> 250<pre caption="Adjusting the boot parameters">
236# <i>sed -i \ 251# <i>sed -i \
237 -e "s:cdroot:cdroot dobladecenter:" \ 252 -e "s:cdroot:cdroot slowusb:" \
238 -e "s:kernel memtest86:kernel memtest:" \ 253 -e "s:kernel memtest86:kernel memtest:" \
239 /mnt/usb/syslinux.cfg</i> 254 /mnt/usb/syslinux.cfg</i>
240</pre> 255</pre>
241 256
242<note>
243Consider adding <c>docache</c> to the boot parameters. This will allow running
244<c>umount /mnt/cdrom/</c> after booting so that you can unplug the USB flash
245drive. Do not enable this unless the target computer has at least 128MB RAM.
246</note>
247
248<!--
249(2006.1 workaround) posted by nightmorph
250
251Background:
252After some lengthy discussion with Robin Johnson (robbat2) on IRC, it turns out
253that the reason why 2006.1 fails to work with this guide is because inside the
254initramfs, it specifies -t iso9660..but usb flash isn't this filetype, it's
255vfat. 2006.0 was much better and just specified mount -t auto. so the thing is
256to install an ~arch version of genkernel (3.4.4, still ~arch as of 2006-11-04)
257and reconfigure syslinux.config to point at the renamed files.
258
259Obviously, unmasking an ~arch version is never desirable in documentation, so we
260need some more alternatives...since 3.4.4 was only created at the end of
261october; not likely to go stable all that soon.
262
263Procedure:
264After adjusting the parameters, and before the disk is unmounted/bootloader
265installed, the following must be done for ~arch genkernel. Please replace (dash)
266with an actual - , since the damned xmllint throws a "comment not terminated"
267error.
268
269# echo "sys-kernel/genkernel" &gt;&gt; /etc/portage/package.keywords
270# genkernel (dash)(dash)bootdir=/mnt/usb (dash)(dash)install all
271(not sure if syslinux has been installed previously yet)
272# nano -w syslinux.cfg
273(Edit it to point at the new filenames installed by genkernel)
274(might be worth renaming to the ones normally used by syslinux, as
275if the kernel name is too long, "vfat might bite")
276
277(might need to re-run syslinux as specified below to pick up the new names,
278though maybe this renaming step should be in the section below?)
279# syslinux /dev/sda1
280
281TODO:
282- if/when this document changes, brix requested some time ago that he be renamed
283"Original Author" and be moved to the bottom of the credits list.
284- if/when this fix goes in, robbat2 deserves credit: this is his solution after
285 all, and it works.
286
287-->
288
289</body> 257</body>
290</section> 258</section>
291</chapter> 259</chapter>
260
292<chapter> 261<chapter>
293<title>Installing a bootloader</title> 262<title>Installing a bootloader</title>
294<section> 263<section>
295<title>Unmounting the drive</title> 264<title>Unmounting the drive</title>
296<body> 265<body>
298<p> 267<p>
299Make sure you unmount the USB flash drive before installing the bootloader: 268Make sure you unmount the USB flash drive before installing the bootloader:
300</p> 269</p>
301 270
302<pre caption="Unmounting the USB flash drive"> 271<pre caption="Unmounting the USB flash drive">
303# <i>umount /mnt/usb/</i> 272# <i>umount /mnt/usb</i>
304</pre> 273</pre>
305 274
306</body> 275</body>
307</section> 276</section>
308<section> 277<section>
312<p> 281<p>
313Finally install the <c>syslinux</c> bootloader on the USB flash drive: 282Finally install the <c>syslinux</c> bootloader on the USB flash drive:
314</p> 283</p>
315 284
316<pre caption="Running syslinux"> 285<pre caption="Running syslinux">
317# <i>syslinux /dev/sda1</i> 286# <i>syslinux /dev/sdc1</i>
318</pre> 287</pre>
319 288
320<impo> 289<impo>
321You will need to rerun <c>syslinux /dev/sda1</c> each time you modify the 290You will need to rerun <c>syslinux /dev/sdc1</c> each time you modify the
322<path>syslinux.cfg</path> file for the configuration changes to take affect. 291<path>syslinux.cfg</path> file for the configuration changes to take affect.
323</impo> 292</impo>
324 293
325</body> 294</body>
326</section> 295</section>

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

  ViewVC Help
Powered by ViewVC 1.1.20