VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/docs/TestBoxImaging.html

Last change on this file was 98107, checked in by vboxsync, 17 months ago

Manual (C) year updates.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 28.1 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6<meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
7<title>TestBoxImaging.txt</title>
8<style type="text/css">
9
10/*
11:Author: David Goodger (goodger@python.org)
12:Id: $Id: TestBoxImaging.html 98107 2023-01-17 22:56:50Z vboxsync $
13:Copyright: This stylesheet has been placed in the public domain.
14
15Default cascading style sheet for the HTML output of Docutils.
16
17See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
18customize this style sheet.
19*/
20
21/* used to remove borders from tables and images */
22.borderless, table.borderless td, table.borderless th {
23 border: 0 }
24
25table.borderless td, table.borderless th {
26 /* Override padding for "table.docutils td" with "! important".
27 The right padding separates the table cells. */
28 padding: 0 0.5em 0 0 ! important }
29
30.first {
31 /* Override more specific margin styles with "! important". */
32 margin-top: 0 ! important }
33
34.last, .with-subtitle {
35 margin-bottom: 0 ! important }
36
37.hidden {
38 display: none }
39
40.subscript {
41 vertical-align: sub;
42 font-size: smaller }
43
44.superscript {
45 vertical-align: super;
46 font-size: smaller }
47
48a.toc-backref {
49 text-decoration: none ;
50 color: black }
51
52blockquote.epigraph {
53 margin: 2em 5em ; }
54
55dl.docutils dd {
56 margin-bottom: 0.5em }
57
58object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
59 overflow: hidden;
60}
61
62/* Uncomment (and remove this text!) to get bold-faced definition list terms
63dl.docutils dt {
64 font-weight: bold }
65*/
66
67div.abstract {
68 margin: 2em 5em }
69
70div.abstract p.topic-title {
71 font-weight: bold ;
72 text-align: center }
73
74div.admonition, div.attention, div.caution, div.danger, div.error,
75div.hint, div.important, div.note, div.tip, div.warning {
76 margin: 2em ;
77 border: medium outset ;
78 padding: 1em }
79
80div.admonition p.admonition-title, div.hint p.admonition-title,
81div.important p.admonition-title, div.note p.admonition-title,
82div.tip p.admonition-title {
83 font-weight: bold ;
84 font-family: sans-serif }
85
86div.attention p.admonition-title, div.caution p.admonition-title,
87div.danger p.admonition-title, div.error p.admonition-title,
88div.warning p.admonition-title, .code .error {
89 color: red ;
90 font-weight: bold ;
91 font-family: sans-serif }
92
93/* Uncomment (and remove this text!) to get reduced vertical space in
94 compound paragraphs.
95div.compound .compound-first, div.compound .compound-middle {
96 margin-bottom: 0.5em }
97
98div.compound .compound-last, div.compound .compound-middle {
99 margin-top: 0.5em }
100*/
101
102div.dedication {
103 margin: 2em 5em ;
104 text-align: center ;
105 font-style: italic }
106
107div.dedication p.topic-title {
108 font-weight: bold ;
109 font-style: normal }
110
111div.figure {
112 margin-left: 2em ;
113 margin-right: 2em }
114
115div.footer, div.header {
116 clear: both;
117 font-size: smaller }
118
119div.line-block {
120 display: block ;
121 margin-top: 1em ;
122 margin-bottom: 1em }
123
124div.line-block div.line-block {
125 margin-top: 0 ;
126 margin-bottom: 0 ;
127 margin-left: 1.5em }
128
129div.sidebar {
130 margin: 0 0 0.5em 1em ;
131 border: medium outset ;
132 padding: 1em ;
133 background-color: #ffffee ;
134 width: 40% ;
135 float: right ;
136 clear: right }
137
138div.sidebar p.rubric {
139 font-family: sans-serif ;
140 font-size: medium }
141
142div.system-messages {
143 margin: 5em }
144
145div.system-messages h1 {
146 color: red }
147
148div.system-message {
149 border: medium outset ;
150 padding: 1em }
151
152div.system-message p.system-message-title {
153 color: red ;
154 font-weight: bold }
155
156div.topic {
157 margin: 2em }
158
159h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
160h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
161 margin-top: 0.4em }
162
163h1.title {
164 text-align: center }
165
166h2.subtitle {
167 text-align: center }
168
169hr.docutils {
170 width: 75% }
171
172img.align-left, .figure.align-left, object.align-left, table.align-left {
173 clear: left ;
174 float: left ;
175 margin-right: 1em }
176
177img.align-right, .figure.align-right, object.align-right, table.align-right {
178 clear: right ;
179 float: right ;
180 margin-left: 1em }
181
182img.align-center, .figure.align-center, object.align-center {
183 display: block;
184 margin-left: auto;
185 margin-right: auto;
186}
187
188table.align-center {
189 margin-left: auto;
190 margin-right: auto;
191}
192
193.align-left {
194 text-align: left }
195
196.align-center {
197 clear: both ;
198 text-align: center }
199
200.align-right {
201 text-align: right }
202
203/* reset inner alignment in figures */
204div.align-right {
205 text-align: inherit }
206
207/* div.align-center * { */
208/* text-align: left } */
209
210.align-top {
211 vertical-align: top }
212
213.align-middle {
214 vertical-align: middle }
215
216.align-bottom {
217 vertical-align: bottom }
218
219ol.simple, ul.simple {
220 margin-bottom: 1em }
221
222ol.arabic {
223 list-style: decimal }
224
225ol.loweralpha {
226 list-style: lower-alpha }
227
228ol.upperalpha {
229 list-style: upper-alpha }
230
231ol.lowerroman {
232 list-style: lower-roman }
233
234ol.upperroman {
235 list-style: upper-roman }
236
237p.attribution {
238 text-align: right ;
239 margin-left: 50% }
240
241p.caption {
242 font-style: italic }
243
244p.credits {
245 font-style: italic ;
246 font-size: smaller }
247
248p.label {
249 white-space: nowrap }
250
251p.rubric {
252 font-weight: bold ;
253 font-size: larger ;
254 color: maroon ;
255 text-align: center }
256
257p.sidebar-title {
258 font-family: sans-serif ;
259 font-weight: bold ;
260 font-size: larger }
261
262p.sidebar-subtitle {
263 font-family: sans-serif ;
264 font-weight: bold }
265
266p.topic-title {
267 font-weight: bold }
268
269pre.address {
270 margin-bottom: 0 ;
271 margin-top: 0 ;
272 font: inherit }
273
274pre.literal-block, pre.doctest-block, pre.math, pre.code {
275 margin-left: 2em ;
276 margin-right: 2em }
277
278pre.code .ln { color: grey; } /* line numbers */
279pre.code, code { background-color: #eeeeee }
280pre.code .comment, code .comment { color: #5C6576 }
281pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
282pre.code .literal.string, code .literal.string { color: #0C5404 }
283pre.code .name.builtin, code .name.builtin { color: #352B84 }
284pre.code .deleted, code .deleted { background-color: #DEB0A1}
285pre.code .inserted, code .inserted { background-color: #A3D289}
286
287span.classifier {
288 font-family: sans-serif ;
289 font-style: oblique }
290
291span.classifier-delimiter {
292 font-family: sans-serif ;
293 font-weight: bold }
294
295span.interpreted {
296 font-family: sans-serif }
297
298span.option {
299 white-space: nowrap }
300
301span.pre {
302 white-space: pre }
303
304span.problematic {
305 color: red }
306
307span.section-subtitle {
308 /* font-size relative to parent (h1..h6 element) */
309 font-size: 80% }
310
311table.citation {
312 border-left: solid 1px gray;
313 margin-left: 1px }
314
315table.docinfo {
316 margin: 2em 4em }
317
318table.docutils {
319 margin-top: 0.5em ;
320 margin-bottom: 0.5em }
321
322table.footnote {
323 border-left: solid 1px black;
324 margin-left: 1px }
325
326table.docutils td, table.docutils th,
327table.docinfo td, table.docinfo th {
328 padding-left: 0.5em ;
329 padding-right: 0.5em ;
330 vertical-align: top }
331
332table.docutils th.field-name, table.docinfo th.docinfo-name {
333 font-weight: bold ;
334 text-align: left ;
335 white-space: nowrap ;
336 padding-left: 0 }
337
338/* "booktabs" style (no vertical lines) */
339table.docutils.booktabs {
340 border: 0px;
341 border-top: 2px solid;
342 border-bottom: 2px solid;
343 border-collapse: collapse;
344}
345table.docutils.booktabs * {
346 border: 0px;
347}
348table.docutils.booktabs th {
349 border-bottom: thin solid;
350 text-align: left;
351}
352
353h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
354h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
355 font-size: 100% }
356
357ul.auto-toc {
358 list-style-type: none }
359
360</style>
361</head>
362<body>
363<div class="document">
364
365
366<div class="section" id="testbox-imaging-backup-restore">
367<h1>Testbox Imaging (Backup / Restore)</h1>
368<div class="section" id="introduction">
369<h2>Introduction</h2>
370<p>This document is explores deploying a very simple drive imaging solution to help
371avoid needing to manually reinstall testboxes when a disk goes bust or the OS
372install seems to be corrupted.</p>
373</div>
374</div>
375<div class="section" id="definitions-glossary">
376<h1>Definitions / Glossary</h1>
377<p>See AutomaticTestingRevamp.txt.</p>
378</div>
379<div class="section" id="objectives">
380<h1>Objectives</h1>
381<blockquote>
382<ul class="simple">
383<li>Off site, no admin interaction (no need for ILOM or similar).</li>
384<li>OS independent.</li>
385<li>Space and bandwidth efficient.</li>
386<li>As automatic as possible.</li>
387<li>Logging.</li>
388</ul>
389</blockquote>
390</div>
391<div class="section" id="overview-of-the-solution">
392<h1>Overview of the Solution</h1>
393<p>Here is a brief summary:</p>
394<blockquote>
395<ul class="simple">
396<li>Always boot testboxes via PXE using PXELINUX.</li>
397<li>Default configuration is local boot (hard disk / SSD)</li>
398<li>Restore/backup action triggered by machine specific PXE config.</li>
399<li>Boots special debian maintenance install off NFS.</li>
400<li>A maintenance service (systemd style) does the work.</li>
401<li>The service reads action from TFTP location and performs it.</li>
402<li>When done the service removes the TFTP machine specific config
403and reboots the system.</li>
404</ul>
405</blockquote>
406<dl class="docutils">
407<dt>Maintenance actions are:</dt>
408<dd><ul class="first last simple">
409<li>backup</li>
410<li>backup-again</li>
411<li>restore</li>
412<li>refresh-info</li>
413<li>rescue</li>
414</ul>
415</dd>
416</dl>
417<p>Possible modifier that indicates a subset of disk on testboxes with other OSes
418installed. Support for partition level backup/restore is not explored here.</p>
419<div class="section" id="how-to-use">
420<h2>How to use</h2>
421<p>To perform one of the above maintenance actions on a testbox, run the
422<tt class="docutils literal"><span class="pre">testbox-pxe-conf.sh</span></tt> script:</p>
423<pre class="literal-block">
424/mnt/testbox-tftp/pxeclient.cfg/testbox-pxe-conf.sh 10.165.98.220 rescue
425</pre>
426<p>Then trigger a reboot. The box will then boot the NFS rooted debian image and
427execute the maintenance action. On success, it will remove the testbox hex-IP
428config file and reboot again.</p>
429</div>
430</div>
431<div class="section" id="storage-server">
432<h1>Storage Server</h1>
433<p>The storage server will have three areas used here. Using NFS for all three
434avoids extra work getting CIFS sharing right too (NFS is already a pain).</p>
435<blockquote>
436<ol class="arabic simple">
437<li>/export/testbox-tftp - TFTP config area. Read-write.</li>
438<li>/export/testbox-backup - Images and logs. Read-write.</li>
439<li>/export/testbox-nfsroot - Custom debian. Read-only, no root squash.</li>
440</ol>
441</blockquote>
442</div>
443<div class="section" id="tftp-export-testbox-tftp">
444<h1>TFTP (/export/testbox-tftp)</h1>
445<p>The testbox-tftp share needs to be writable, root squashing is okay.</p>
446<p>We need files from both PXELINUX and SYSLINUX to make this work now. On a
447debian system, the <tt class="docutils literal">pxelinux</tt> and <tt class="docutils literal">syslinux</tt> packages needs to be
448installed. We actually do this further down when setting up the nfsroot, so
449it's possible to get them from there by postponing this step a little. On
450debian 8.6.0 the PXELINUX files are found in <tt class="docutils literal">/usr/lib/PXELINUX</tt> and the
451SYSLINUX ones in <tt class="docutils literal">/usr/lib/syslinux</tt>.</p>
452<p>The initial PXE image as well as associated modules comes in three variants,
453BIOS, 32-bit EFI and 64-bit EFI. We'll only need the BIOS one for now.
454Perform the following copy operations:</p>
455<pre class="literal-block">
456cp /usr/lib/PXELINUX/pxelinux.0 /mnt/testbox-tftp/
457cp /usr/lib/syslinux/modules/*/ldlinux.* /mnt/testbox-tftp/
458cp -R /usr/lib/syslinux/modules/bios /mnt/testbox-tftp/
459cp -R /usr/lib/syslinux/modules/efi32 /mnt/testbox-tftp/
460cp -R /usr/lib/syslinux/modules/efi64 /mnt/testbox-tftp/
461</pre>
462<p>For simplicity, all the testboxes boot using good old fashioned BIOS, no EFI.
463However, it doesn't really hurt to be prepared.</p>
464<p>The PXELINUX related files goes in the root of the testbox-tftp share. (As
465mentioned further down, these can be installed on a debian system by running
466<tt class="docutils literal"><span class="pre">apt-get</span> install pxelinux syslinux</tt>.) We need the <tt class="docutils literal">*pxelinux.0</tt> files
467typically found in <tt class="docutils literal">/usr/lib/PXELINUX/</tt> on debian systems (recent ones
468anyway). It is possible we may need one ore more fo the modules <a class="footnote-reference" href="#footnote-1" id="footnote-reference-1">[1]</a> that
469ships with PXELINUX/SYSLINUX, so do copy <tt class="docutils literal">/usr/lib/syslinux/modules</tt> to
470<tt class="docutils literal"><span class="pre">testbox-tftp/modules</span></tt> as well.</p>
471<p>The directory layout related to the configuration files is dictated by the
472PXELINUX configuration file searching algorithm <a class="footnote-reference" href="#footnote-2" id="footnote-reference-2">[2]</a>. Create a subdirectory
473<tt class="docutils literal">pxelinux.cfg/</tt> under <tt class="docutils literal"><span class="pre">testbox-tftp</span></tt> and create the world readable file
474<tt class="docutils literal">default</tt> with the following content:</p>
475<pre class="literal-block">
476PATH bios
477DEFAULT local-boot
478LABEL local-boot
479LOCALBOOT
480</pre>
481<p>This will make the default behavior to boot the local disk system.</p>
482<p>Copy the <tt class="docutils literal"><span class="pre">testbox-pxe-conf.sh</span></tt> script file found in the same directory as
483this document to <tt class="docutils literal"><span class="pre">/mnt/testbox-tftp/pxelinux.cfg/</span></tt>. Edit the copy to correct
484the IP addresses near the top, as well as any linux, TFTP and PXE details near
485the bottom of the file. This script will generate the PXE configuration file
486when performing maintenance on a testbox.</p>
487</div>
488<div class="section" id="images-and-logs-export-testbox-backup">
489<h1>Images and logs (/export/testbox-backup)</h1>
490<p>The testbox-backup share needs to be writable, root squashing is okay.</p>
491<p>In the root there must be a file <tt class="docutils literal"><span class="pre">testbox-backup</span></tt> so we can easily tell
492whether we've actually mounted the share or are just staring at an empty mount
493point directory.</p>
494<p>The <tt class="docutils literal"><span class="pre">testbox-maintenance.sh</span></tt> script maintains a global log in the root
495directory that's called <tt class="docutils literal">maintenance.log</tt>. Errors will be logged there as
496well as a ping and the action.</p>
497<p>We use a directory layout based on dotted decimal IP addresses here, so for a
498server with the IP 10.40.41.42 all its file will be under <tt class="docutils literal">10.40.41.42/</tt>:</p>
499<dl class="docutils">
500<dt><tt class="docutils literal">&lt;hostname&gt;</tt></dt>
501<dd>The name of the testbox (empty file). Help finding a testbox by name.</dd>
502<dt><tt class="docutils literal"><span class="pre">testbox-info.txt</span></tt></dt>
503<dd>Information about the testbox. Starting off with the name, decimal IP,
504PXELINUX style hexadecimal IP, and more.</dd>
505<dt><tt class="docutils literal">maintenance.log</tt></dt>
506<dd>Maintenance log file recording what the maintenance service does.</dd>
507<dt><tt class="docutils literal"><span class="pre">disk-devices.lst</span></tt></dt>
508<dd>Optional list of disk devices to consider backuping up or restoring. This is
509intended for testboxes with additional disks that are used for other purposes
510and should touched.</dd>
511<dt><tt class="docutils literal">sda.raw.gz</tt></dt>
512<dd>The gzipped raw copy of the sda device of the testbox.</dd>
513<dt><tt class="docutils literal"><span class="pre">sd[bcdefgh].raw.gz</span></tt></dt>
514<dd>The gzipped raw copy sdb, sdc, sde, sdf, sdg, sdh, etc if any of them exists
515and are disks/SSDs.</dd>
516<dt>Note! If it turns out we can be certain to get a valid host name, we might just</dt>
517<dd>switch to use the hostname as the directory name instead of the IP.</dd>
518</dl>
519</div>
520<div class="section" id="debian-nfs-root-export-testbox-nfsroot">
521<h1>Debian NFS root (/export/testbox-nfsroot)</h1>
522<p>The testbox-nfsroot share should be read-only and must <strong>not</strong> have root
523squashing enabled. Also, make sure setting the set-uid-bit is allowed by the
524server, or <tt class="docutils literal">su` and ``sudo</tt> won't work</p>
525<p>There are several ways of creating a debian nfsroot, but since we've got a
526tool like VirtualBox around we've just installed it in a VM, prepared it,
527and copied it onto the NFS server share.</p>
528<p>As of writing debian 8.6.0 is current, so a minimal 64-bit install of it was
529done in a VM. After installation the following modifications was done:</p>
530<blockquote>
531<ul>
532<li><p class="first"><tt class="docutils literal"><span class="pre">apt-get</span> install pxelinux syslinux <span class="pre">initramfs-tools</span> zip gddrescue sudo joe</tt>
533and optionally <tt class="docutils literal"><span class="pre">apt-get</span> install smbclient <span class="pre">cifs-utils</span></tt>.</p>
534</li>
535<li><p class="first"><tt class="docutils literal">/etc/default/grub</tt> was modified to set <tt class="docutils literal">GRUB_CMDLINE_LINUX_DEFAULT</tt> to
536<tt class="docutils literal">&quot;&quot;</tt> instead of <tt class="docutils literal">&quot;quiet&quot;</tt>. This allows us to see messages during boot
537and perhaps spot why something doesn't work on a testbox. Regenerate the
538grub configuration file by running <tt class="docutils literal"><span class="pre">update-grub</span></tt> afterwards.</p>
539</li>
540<li><p class="first"><tt class="docutils literal">/etc/sudoers</tt> was modified to allow the <tt class="docutils literal">vbox</tt> user use sudo without
541requring any password.</p>
542</li>
543<li><p class="first">Create the directory <tt class="docutils literal">/etc/systemd/system/getty&#64;tty1.service.d</tt> and create
544the file <tt class="docutils literal">noclear.conf</tt> in it with the following content:</p>
545<pre class="literal-block">
546[Service]
547TTYVTDisallocate=no
548</pre>
549<p>This stops getty from clearing VT1 and let us see the tail of the boot up
550messages, which includes messages from the testbox-maintenance service.</p>
551</li>
552<li><p class="first">Mount the testbox-nfsroot under <tt class="docutils literal">/mnt/</tt> with write privileges. (The write
553privileges are temporary - don't forget to remove them later on.):</p>
554<pre class="literal-block">
555mount -t nfs myserver.com:/export/testbox-nfsroot
556</pre>
557<p>Note! Adding <tt class="docutils literal"><span class="pre">-o</span> nfsvers=3</tt> may help with some NTFv4 servers.</p>
558</li>
559<li><p class="first">Copy the debian root and dev file system onto nfsroot. If you have ssh
560access to the NFS server, the quickest way to do it is to use <tt class="docutils literal">tar</tt>:</p>
561<pre class="literal-block">
562tar -cz --one-file-system -f /mnt/testbox-maintenance-nfsroot.tar.gz . dev/
563</pre>
564<p>An alternative is <tt class="docutils literal">cp <span class="pre">-ax</span> . /mnt/. &amp;&amp;&nbsp; cp <span class="pre">-ax</span> dev/. /mnt/dev/.</tt> but this
565is quite a bit slower, obviously.</p>
566</li>
567<li><p class="first">Edit <tt class="docutils literal">/etc/ssh/sshd_config</tt> setting <tt class="docutils literal">PermitRootLogin</tt> to <tt class="docutils literal">yes</tt> so we can ssh
568in as root later on.</p>
569</li>
570<li><p class="first">chroot into the nfsroot: <tt class="docutils literal">chroot /mnt/</tt></p>
571<blockquote>
572<ul>
573<li><p class="first"><tt class="docutils literal">mount <span class="pre">-o</span> proc proc /proc</tt></p>
574</li>
575<li><p class="first"><tt class="docutils literal">mount <span class="pre">-o</span> sysfs sysfs /sys</tt></p>
576</li>
577<li><p class="first"><tt class="docutils literal">mkdir <span class="pre">/mnt/testbox-tftp</span> <span class="pre">/mnt/testbox-backup</span></tt></p>
578</li>
579<li><p class="first">Recreate <tt class="docutils literal">/etc/fstab</tt> with:</p>
580<pre class="literal-block">
581proc /proc proc defaults 0 0
582/dev/nfs / nfs defaults 1 1
58310.42.1.1:/export/testbox-tftp /mnt/testbox-tftp nfs tcp,nfsvers=3,noauto 2 2
58410.42.1.1:/export/testbox-backup /mnt/testbox-backup nfs tcp,nfsvers=3,noauto 3 3
585</pre>
586<p>We use NFS version 3 as that works better for our NFS server and client,
587remove if not necessary. The <tt class="docutils literal">noauto</tt> option is to work around mount
588trouble during early bootup on some of our boxes.</p>
589</li>
590<li><p class="first">Do <tt class="docutils literal">mount <span class="pre">/mnt/testbox-tftp</span> &amp;&amp; mount <span class="pre">/mnt/testbox-backup</span></tt> to mount the
591two shares. This may be a good time to execute the instructions in the
592sections above relating to these two shares.</p>
593</li>
594<li><p class="first">Edit <tt class="docutils literal"><span class="pre">/etc/initramfs-tools/initramfs.conf</span></tt> and change the <tt class="docutils literal">MODULES</tt>
595value from <tt class="docutils literal">most</tt> to <tt class="docutils literal">netboot</tt>.</p>
596</li>
597<li><p class="first">Append <tt class="docutils literal">aufs</tt> to <tt class="docutils literal"><span class="pre">/etc/initramfs-tools/modules</span></tt>. The advanced
598multi-layered unification filesystem (aufs) enables us to use a
599read-only NFS root. <a class="footnote-reference" href="#footnote-3" id="footnote-reference-3">[3]</a> <a class="footnote-reference" href="#footnote-4" id="footnote-reference-4">[4]</a> <a class="footnote-reference" href="#footnote-5" id="footnote-reference-5">[5]</a></p>
600</li>
601<li><p class="first">Create <tt class="docutils literal"><span class="pre">/etc/initramfs-tools/scripts/init-bottom/00_aufs_init</span></tt> as
602an executable file with the following content:</p>
603<pre class="literal-block">
604#!/bin/sh
605# Don't run during update-initramfs:
606case &quot;$1&quot; in
607 prereqs)
608 exit 0;
609 ;;
610esac
611
612modprobe aufs
613mkdir -p /ro /rw /aufs
614mount -t tmpfs tmpfs /rw -o noatime,mode=0755
615mount --move $rootmnt /ro
616mount -t aufs aufs /aufs -o noatime,dirs=/rw:/ro=ro
617mkdir -p /aufs/rw /aufs/ro
618mount --move /ro /aufs/ro
619mount --move /rw /aufs/rw
620mount --move /aufs /root
621exit 0
622</pre>
623</li>
624<li><p class="first">Update the init ramdisk: <tt class="docutils literal"><span class="pre">update-initramfs</span> <span class="pre">-u</span> <span class="pre">-k</span> all</tt></p>
625<dl class="docutils">
626<dt>Note! It may be necessary to do <tt class="docutils literal">mount <span class="pre">-t</span> tmpfs tmpfs /var/tmp</tt> to help</dt>
627<dd><p class="first last">this operation succeed.</p>
628</dd>
629</dl>
630</li>
631<li><p class="first">Copy <tt class="docutils literal">/boot</tt> to <tt class="docutils literal"><span class="pre">/mnt/testbox-tftp/maintenance-boot/</span></tt>.</p>
632</li>
633<li><p class="first">Copy the <tt class="docutils literal"><span class="pre">testbox-maintenance.sh</span></tt> file found in the same directory as this
634document to <tt class="docutils literal">/root/scripts/</tt> (need to create the dir) and make it
635executable.</p>
636</li>
637<li><p class="first">Create the systemd service file for the maintenance service as
638<tt class="docutils literal"><span class="pre">/etc/systemd/system/testbox-maintenance.service</span></tt> with the content:</p>
639<pre class="literal-block">
640[Unit]
641Description=Testbox Maintenance
642After=network.target
643Before=getty&#64;tty1.service
644
645[Service]
646Type=oneshot
647RemainAfterExit=True
648ExecStart=/root/scripts/testbox-maintenance.sh
649ExecStartPre=/bin/echo -e \033%G
650ExecReload=/bin/kill -HUP $MAINPID
651WorkingDirectory=/tmp
652Environment=TERM=xterm
653StandardOutput=journal+console
654
655[Install]
656WantedBy=multi-user.target
657</pre>
658</li>
659<li><p class="first">Enable our service: <tt class="docutils literal">systemctl enable <span class="pre">/etc/systemd/system/testbox-maintenance.service</span></tt></p>
660</li>
661<li><p class="first">xxxx ... more ???</p>
662</li>
663<li><p class="first">Before leaving the chroot, do <tt class="docutils literal">mount /proc /sys <span class="pre">/mnt/testbox-*</span></tt>.</p>
664</li>
665</ul>
666</blockquote>
667</li>
668<li><p class="first">Testing the setup from a VM is kind of useful (if the nfs server can be
669convinced to accept root nfs mounts from non-privileged clinet ports):</p>
670<blockquote>
671<ul>
672<li><p class="first">Create a VM using the 64-bit debian profile. Let's call it &quot;pxe-vm&quot;.</p>
673</li>
674<li><p class="first">Mount the TFTP share somewhere, like M: or /mnt/testbox-tftp.</p>
675</li>
676<li><p class="first">Reconfigure the NAT DHCP and TFTP bits:</p>
677<pre class="literal-block">
678VBoxManage setextradata pxe-vm VBoxInternal/PDM/DriverTransformations/pxe/AboveDriver NAT
679VBoxManage setextradata pxe-vm VBoxInternal/PDM/DriverTransformations/pxe/Action mergeconfig
680VBoxManage setextradata pxe-vm VBoxInternal/PDM/DriverTransformations/pxe/Config/TFTPPrefix M:/
681VBoxManage setextradata pxe-vm VBoxInternal/PDM/DriverTransformations/pxe/Config/BootFile pxelinux.0
682</pre>
683</li>
684<li><p class="first">Create the file <tt class="docutils literal"><span class="pre">testbox-tftp/pxelinux.cfg/0A00020F</span></tt> containing:</p>
685<pre class="literal-block">
686PATH bios
687DEFAULT maintenance
688LABEL maintenance
689 MENU LABEL Maintenance (NFS)
690 KERNEL maintenance-boot/vmlinuz-3.16.0-4-amd64
691 APPEND initrd=maintenance-boot/initrd.img-3.16.0-4-amd64 ro ip=dhcp aufs=tmpfs \
692 boot=nfs root=/dev/nfs nfsroot=10.42.1.1:/export/testbox-nfsroot
693LABEL local-boot
694LOCALBOOT
695</pre>
696</li>
697</ul>
698</blockquote>
699</li>
700</ul>
701</blockquote>
702</div>
703<div class="section" id="troubleshooting">
704<h1>Troubleshooting</h1>
705<dl class="docutils">
706<dt><tt class="docutils literal"><span class="pre">PXE-E11</span></tt> or something like <tt class="docutils literal">No ARP reply</tt></dt>
707<dd>You probably got the TFTP and DHCP on different machines. Try move the TFTP
708to the same machine as the DHCP, then the PXE stack won't have to do any
709additional ARP resolving. Google results suggest that a congested network
710could use the ARP reply to get lost. Our suspicion is that it might also be
711related to the PXE stack shipping with the NIC.</dd>
712</dl>
713<hr class="docutils" />
714<table class="docutils footnote" frame="void" id="footnote-1" rules="none">
715<colgroup><col class="label" /><col /></colgroup>
716<tbody valign="top">
717<tr><td class="label"><a class="fn-backref" href="#footnote-reference-1">[1]</a></td><td>See <a class="reference external" href="http://www.syslinux.org/wiki/index.php?title=Category:Modules">http://www.syslinux.org/wiki/index.php?title=Category:Modules</a></td></tr>
718</tbody>
719</table>
720<table class="docutils footnote" frame="void" id="footnote-2" rules="none">
721<colgroup><col class="label" /><col /></colgroup>
722<tbody valign="top">
723<tr><td class="label"><a class="fn-backref" href="#footnote-reference-2">[2]</a></td><td>See <a class="reference external" href="http://www.syslinux.org/wiki/index.php?title=PXELINUX#Configuration">http://www.syslinux.org/wiki/index.php?title=PXELINUX#Configuration</a></td></tr>
724</tbody>
725</table>
726<table class="docutils footnote" frame="void" id="footnote-3" rules="none">
727<colgroup><col class="label" /><col /></colgroup>
728<tbody valign="top">
729<tr><td class="label"><a class="fn-backref" href="#footnote-reference-3">[3]</a></td><td>See <a class="reference external" href="https://en.wikipedia.org/wiki/Aufs">https://en.wikipedia.org/wiki/Aufs</a></td></tr>
730</tbody>
731</table>
732<table class="docutils footnote" frame="void" id="footnote-4" rules="none">
733<colgroup><col class="label" /><col /></colgroup>
734<tbody valign="top">
735<tr><td class="label"><a class="fn-backref" href="#footnote-reference-4">[4]</a></td><td>See <a class="reference external" href="http://shitwefoundout.com/wiki/Diskless_ubuntu">http://shitwefoundout.com/wiki/Diskless_ubuntu</a></td></tr>
736</tbody>
737</table>
738<table class="docutils footnote" frame="void" id="footnote-5" rules="none">
739<colgroup><col class="label" /><col /></colgroup>
740<tbody valign="top">
741<tr><td class="label"><a class="fn-backref" href="#footnote-reference-5">[5]</a></td><td>See <a class="reference external" href="http://debianaddict.com/2012/06/19/diskless-debian-linux-booting-via-dhcppxenfstftp/">http://debianaddict.com/2012/06/19/diskless-debian-linux-booting-via-dhcppxenfstftp/</a></td></tr>
742</tbody>
743</table>
744<hr class="docutils" />
745<table class="docutils field-list" frame="void" rules="none">
746<col class="field-name" />
747<col class="field-body" />
748<tbody valign="top">
749<tr class="field"><th class="field-name">Status:</th><td class="field-body">$Id: TestBoxImaging.html 98107 2023-01-17 22:56:50Z vboxsync $</td>
750</tr>
751<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Copyright (C) 2010-2023 Oracle Corporation.</td>
752</tr>
753</tbody>
754</table>
755</div>
756</div>
757</body>
758</html>
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use