File: virt-customize.1

package info (click to toggle)
guestfs-tools 1.52.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 69,236 kB
  • sloc: ansic: 15,698; ml: 15,621; sh: 7,396; xml: 5,478; makefile: 3,601; perl: 1,535; lex: 135; yacc: 128; python: 80
file content (697 lines) | stat: -rw-r--r-- 32,185 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Podwrapper::Man 1.52.3 (Pod::Simple 3.45)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\"
.\" Required to disable full justification in groff 1.23.0.
.if n .ds AD l
.\" ========================================================================
.\"
.IX Title "virt-customize 1"
.TH virt-customize 1 2025-02-18 guestfs-tools-1.52.3 "Virtualization Support"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH 名前
.IX Header "名前"
virt\-customize \- Customize a virtual machine
.SH 書式
.IX Header "書式"
.Vb 7
\& virt\-customize
\&    [ \-a disk.img [ \-a disk.img ... ] | \-d domname ]
\&    [\-\-attach ISOFILE] [\-\-attach\-format FORMAT]
\&    [ \-c URI | \-\-connect URI ] [ \-n | \-\-dry\-run ]
\&    [ \-\-format FORMAT] [ \-m MB | \-\-memsize MB ]
\&    [ \-\-network | \-\-no\-network ]
\&    [ \-q | \-\-quiet ] [\-\-smp N] [ \-v | \-\-verbose ] [\-x]
\&
\&
\&
\& virt\-customize [ \-V | \-\-version ]
.Ve
.SH 説明
.IX Header "説明"
Virt\-customize can customize a virtual machine (disk image) by installing packages, editing configuration files, and so on.
.PP
Virt\-customize modifies the guest or disk image \fIin place\fR.  The guest must be shut down.  If you want to preserve the existing contents of the guest, \fIyou must snapshot, copy or clone the disk first\fR.
.PP
You do \fInot\fR need to run virt\-customize as root.  In fact we\*(Aqd generally recommend that you don\*(Aqt.
.PP
Related tools include: \fBvirt\-sysprep\fR\|(1) and \fBvirt\-builder\fR\|(1).
.SH オプション
.IX Header "オプション"
.IP \fB\-\-help\fR 4
.IX Item "--help"
簡単なヘルプを表示します。
.IP "\fB\-a\fR file" 4
.IX Item "-a file"
.PD 0
.IP "\fB\-\-add\fR file" 4
.IX Item "--add file"
.PD
仮想マシンからディスクイメージの \fIfile\fR を追加します。
.Sp
ディスクイメージの形式は自動的に検出されます。強制的に特定の形式を使用するには \fI\-\-format\fR オプションを使用します。
.IP "\fB\-a\fR URI" 4
.IX Item "-a URI"
.PD 0
.IP "\fB\-\-add\fR URI" 4
.IX Item "--add URI"
.PD
Add a remote disk.  The URI format is compatible with guestfish.  See "ADDING REMOTE STORAGE" in \fBguestfish\fR\|(1).
.IP "\fB\-\-attach\fR ISOFILE" 4
.IX Item "--attach ISOFILE"
The given disk is attached to the libguestfs appliance.  This is used to provide extra software repositories or other data for customization.
.Sp
You probably want to ensure the volume(s) or filesystems in the attached disks are labelled (or use an ISO volume name) so that you can mount them by label in your run\-scripts:
.Sp
.Vb 2
\& mkdir /tmp/mount
\& mount LABEL=EXTRA /tmp/mount
.Ve
.Sp
You can have multiple \fI\-\-attach\fR options, and the format can be any disk format (not just an ISO).
.IP "\fB\-\-attach\-format\fR FORMAT" 4
.IX Item "--attach-format FORMAT"
Specify the disk format for the next \fI\-\-attach\fR option.  The \f(CW\*(C`FORMAT\*(C'\fR is usually \f(CW\*(C`raw\*(C'\fR or \f(CW\*(C`qcow2\*(C'\fR.  Use \f(CW\*(C`raw\*(C'\fR for ISOs.
.IP \fB\-\-colors\fR 4
.IX Item "--colors"
.PD 0
.IP \fB\-\-colours\fR 4
.IX Item "--colours"
.PD
Use ANSI colour sequences to colourize messages.  This is the default when the output is a tty.  If the output of the program is redirected to a file, ANSI colour sequences are disabled unless you use this option.
.IP "\fB\-c\fR URI" 4
.IX Item "-c URI"
.PD 0
.IP "\fB\-\-connect\fR URI" 4
.IX Item "--connect URI"
.PD
libvirt を使用していると、指定された \fIURI\fR に接続します。  省略すると、デフォルトの libvirt ハイパーバイザーに接続します。
.Sp
ゲストのブロックデバイスを直接指定していると((\fI\-a\fR))、libvirt は何も使用されません。
.IP "\fB\-d\fR guest" 4
.IX Item "-d guest"
.PD 0
.IP "\fB\-\-domain\fR guest" 4
.IX Item "--domain guest"
.PD
名前付きの libvirt 仮想マシンからすべてのディスクを追加します。  名前の代わりに仮想マシンの UUID を使用できます。
.IP \fB\-n\fR 4
.IX Item "-n"
.PD 0
.IP \fB\-\-dry\-run\fR 4
.IX Item "--dry-run"
.PD
Perform a read\-only "dry run" on the guest.  This runs the sysprep operation, but throws away any changes to the disk at the end.
.IP \fB\-\-echo\-keys\fR 4
.IX Item "--echo-keys"
When prompting for keys and passphrases, virt\-customize normally turns echoing off so you cannot see what you are typing.  If you are not worried about Tempest attacks and there is no one else in the room you can specify this flag to see what you are typing.
.IP "\fB\-\-format\fR raw|qcow2|.." 4
.IX Item "--format raw|qcow2|.."
.PD 0
.IP "\fB\-\-format\fR auto" 4
.IX Item "--format auto"
.PD
The default for the \fI\-a\fR option is to auto\-detect the format of the disk image.  Using this forces the disk format for \fI\-a\fR options which follow on the command line.  Using \fI\-\-format auto\fR switches back to auto\-detection for subsequent \fI\-a\fR options.
.Sp
例:
.Sp
.Vb 1
\& virt\-customize \-\-format raw \-a disk.img
.Ve
.Sp
forces raw format (no auto\-detection) for \fIdisk.img\fR.
.Sp
.Vb 1
\& virt\-customize \-\-format raw \-a disk.img \-\-format auto \-a another.img
.Ve
.Sp
forces raw format (no auto\-detection) for \fIdisk.img\fR and reverts to auto\-detection for \fIanother.img\fR.
.Sp
仮想マシンのディスクイメージが信頼できない raw 形式である場合、 ディスク形式を指定するためにこのオプションを使用すべきです。 これにより、悪意のある仮想マシンにより起こり得る セキュリティ問題を回避できます (CVE\-2010\-3851)。
.IP "\fB\-\-key\fR SELECTOR" 4
.IX Item "--key SELECTOR"
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection.
.RS 4
.IP "\fB\-\-key\fR NAME\fB:key:\fRKEY_STRING" 4
.IX Item "--key NAME:key:KEY_STRING"
.PD 0
.IP "\fB\-\-key\fR UUID\fB:key:\fRKEY_STRING" 4
.IX Item "--key UUID:key:KEY_STRING"
.IP "\fB\-\-key\fR \fBall:key:\fRKEY_STRING" 4
.IX Item "--key all:key:KEY_STRING"
.PD
\&\f(CW\*(C`NAME\*(C'\fR is the libguestfs device name (eg. \f(CW\*(C`/dev/sda1\*(C'\fR).  \f(CW\*(C`UUID\*(C'\fR is
the device UUID.  \f(CW\*(C`all\*(C'\fR means try the key against any encrypted
device.
.Sp
Use the specified \f(CW\*(C`KEY_STRING\*(C'\fR as passphrase.
.IP "\fB\-\-key\fR NAME\fB:file:\fRFILENAME" 4
.IX Item "--key NAME:file:FILENAME"
.PD 0
.IP "\fB\-\-key\fR UUID\fB:file:\fRFILENAME" 4
.IX Item "--key UUID:file:FILENAME"
.IP "\fB\-\-key\fR \fBall:file:\fRFILENAME" 4
.IX Item "--key all:file:FILENAME"
.PD
Read the passphrase from \fIFILENAME\fR.
.IP "\fB\-\-key\fR NAME\fB:clevis\fR" 4
.IX Item "--key NAME:clevis"
.PD 0
.IP "\fB\-\-key\fR UUID\fB:clevis\fR" 4
.IX Item "--key UUID:clevis"
.IP "\fB\-\-key\fR \fBall:clevis\fR" 4
.IX Item "--key all:clevis"
.PD
Attempt passphrase\-less unlocking for the device with Clevis, over the
network.  Please refer to "ENCRYPTED DISKS" in \fBguestfs\fR\|(3) for more
information on network\-bound disk encryption (NBDE).
.Sp
Note that if any such option is present on the command line, QEMU user
networking will be automatically enabled for the libguestfs appliance.
.RE
.RS 4
.RE
.IP \fB\-\-keys\-from\-stdin\fR 4
.IX Item "--keys-from-stdin"
Read key or passphrase parameters from stdin.  The default is
to try to read passphrases from the user by opening \fI/dev/tty\fR.
.Sp
If there are multiple encrypted devices then you may need to supply
multiple keys on stdin, one per line.
.IP "\fB\-m\fR MB" 4
.IX Item "-m MB"
.PD 0
.IP "\fB\-\-memsize\fR MB" 4
.IX Item "--memsize MB"
.PD
Change the amount of memory allocated to \fI\-\-run\fR scripts.  Increase this if you find that \fI\-\-run\fR scripts or the \fI\-\-install\fR option are running out of memory.
.Sp
The default can be found with this command:
.Sp
.Vb 1
\& guestfish get\-memsize
.Ve
.IP \fB\-\-network\fR 4
.IX Item "--network"
.PD 0
.IP \fB\-\-no\-network\fR 4
.IX Item "--no-network"
.PD
Enable or disable network access from the guest during the installation.
.Sp
Enabled is the default.  Use \fI\-\-no\-network\fR to disable access.
.Sp
The network only allows outgoing connections and has other minor limitations.  See "NETWORK" in \fBvirt\-rescue\fR\|(1).
.Sp
If you use \fI\-\-no\-network\fR then certain other options such as \fI\-\-install\fR will not work.
.Sp
This does not affect whether the guest can access the network once it has been booted, because that is controlled by your hypervisor or cloud environment and has nothing to do with virt\-customize.
.Sp
Generally speaking you should \fInot\fR use \fI\-\-no\-network\fR.  But here are some reasons why you might want to:
.RS 4
.IP 1. 4
Because the libguestfs backend that you are using doesn\*(Aqt support the network.  (See: "BACKEND" in \fBguestfs\fR\|(3)).
.IP 2. 4
Any software you need to install comes from an attached ISO, so you don\*(Aqt need the network.
.IP 3. 4
You don’t want untrusted guest code trying to access your host network when running virt\-customize.  This is particularly an issue when you don\*(Aqt trust the source of the operating system templates.  (See "SECURITY" below).
.IP 4. 4
You don’t have a host network (eg. in secure/restricted environments).
.RE
.RS 4
.RE
.IP \fB\-q\fR 4
.IX Item "-q"
.PD 0
.IP \fB\-\-quiet\fR 4
.IX Item "--quiet"
.PD
Don’t print log messages.
.Sp
To enable detailed logging of individual file operations, use \fI\-x\fR.
.IP "\fB\-\-smp\fR N" 4
.IX Item "--smp N"
Enable N ≥ 2 virtual CPUs for \fI\-\-run\fR scripts to use.
.IP \fB\-v\fR 4
.IX Item "-v"
.PD 0
.IP \fB\-\-verbose\fR 4
.IX Item "--verbose"
.PD
デバッグ用の冗長なメッセージを有効にします。
.IP \fB\-V\fR 4
.IX Item "-V"
.PD 0
.IP \fB\-\-version\fR 4
.IX Item "--version"
.PD
バージョン番号を表示して、終了します。
.IP \fB\-\-wrap\fR 4
.IX Item "--wrap"
Wrap error, warning, and informative messages.  This is the default when the output is a tty.  If the output of the program is redirected to a file, wrapping is disabled unless you use this option.
.IP \fB\-x\fR 4
.IX Item "-x"
libguestfs API 呼び出しのトレースを有効にします。
.SS "Customization options"
.IX Subsection "Customization options"
.IP "\fB\-\-append\-line\fR FILE:LINE" 4
.IX Item "--append-line FILE:LINE"
Append a single line of text to the \f(CW\*(C`FILE\*(C'\fR.  If the file does not already end with a newline, then one is added before the appended line.  Also a newline is added to the end of the \f(CW\*(C`LINE\*(C'\fR string automatically.
.Sp
For example (assuming ordinary shell quoting) this command:
.Sp
.Vb 1
\& \-\-append\-line \*(Aq/etc/hosts:10.0.0.1 foo\*(Aq
.Ve
.Sp
will add either \f(CW\*(C`10.0.0.1 foo⏎\*(C'\fR or \f(CW\*(C`⏎10.0.0.1 foo⏎\*(C'\fR to the file, the latter only if the existing file does not already end with a newline.
.Sp
\&\f(CW\*(C`⏎\*(C'\fR represents a newline character, which is guessed by looking at the existing content of the file, so this command does the right thing for files using Unix or Windows line endings.  It also works for empty or non\-existent files.
.Sp
To insert several lines, use the same option several times:
.Sp
.Vb 2
\& \-\-append\-line \*(Aq/etc/hosts:10.0.0.1 foo\*(Aq
\& \-\-append\-line \*(Aq/etc/hosts:10.0.0.2 bar\*(Aq
.Ve
.Sp
To insert a blank line before the appended line, do:
.Sp
.Vb 2
\& \-\-append\-line \*(Aq/etc/hosts:\*(Aq
\& \-\-append\-line \*(Aq/etc/hosts:10.0.0.1 foo\*(Aq
.Ve
.IP "\fB\-\-chmod\fR PERMISSIONS:FILE" 4
.IX Item "--chmod PERMISSIONS:FILE"
Change the permissions of \f(CW\*(C`FILE\*(C'\fR to \f(CW\*(C`PERMISSIONS\*(C'\fR.
.Sp
\&\fINote\fR: \f(CW\*(C`PERMISSIONS\*(C'\fR by default would be decimal, unless you prefix it with \f(CW0\fR to get octal, ie. use \f(CW0700\fR not \f(CW700\fR.
.IP "\fB\-\-chown\fR UID:GID:PATH" 4
.IX Item "--chown UID:GID:PATH"
Change the owner user and group ID of a file or directory in the guest. Note:
.RS 4
.IP \(bu 4
Only numeric UIDs and GIDs will work, and these may not be the same inside the guest as on the host.
.IP \(bu 4
This will not work with Windows guests.
.RE
.RS 4
.Sp
例:
.Sp
.Vb 1
\& virt\-customize \-\-chown \*(Aq0:0:/var/log/audit.log\*(Aq
.Ve
.Sp
See also: \fI\-\-upload\fR.
.RE
.IP "\fB\-\-commands\-from\-file\fR FILENAME" 4
.IX Item "--commands-from-file FILENAME"
Read the customize commands from a file, one (and its arguments)  each line.
.Sp
Each line contains a single customization command and its arguments, for example:
.Sp
.Vb 3
\& delete /some/file
\& install some\-package
\& password some\-user:password:its\-new\-password
.Ve
.Sp
Empty lines are ignored, and lines starting with \f(CW\*(C`#\*(C'\fR are comments and are ignored as well.  Furthermore, arguments can be spread across multiple lines, by adding a \f(CW\*(C`\e\*(C'\fR (continuation character) at the of a line, for example
.Sp
.Vb 2
\& edit /some/file:\e
\&   s/^OPT=.*/OPT=ok/
.Ve
.Sp
The commands are handled in the same order as they are in the file, as if they were specified as \fI\-\-delete /some/file\fR on the command line.
.IP "\fB\-\-copy\fR SOURCE:DEST" 4
.IX Item "--copy SOURCE:DEST"
Copy files or directories recursively inside the guest.
.Sp
Wildcards cannot be used.
.IP "\fB\-\-copy\-in\fR LOCALPATH:REMOTEDIR" 4
.IX Item "--copy-in LOCALPATH:REMOTEDIR"
Copy local files or directories recursively into the disk image, placing them in the directory \f(CW\*(C`REMOTEDIR\*(C'\fR (which must exist).
.Sp
Wildcards cannot be used.
.IP "\fB\-\-delete\fR PATH" 4
.IX Item "--delete PATH"
Delete a file from the guest.  Or delete a directory (and all its contents, recursively).
.Sp
You can use shell glob characters in the specified path.  Be careful to escape glob characters from the host shell, if that is required.  For example:
.Sp
.Vb 1
\& virt\-customize \-\-delete \*(Aq/var/log/*.log\*(Aq.
.Ve
.Sp
See also: \fI\-\-upload\fR, \fI\-\-scrub\fR.
.IP "\fB\-\-edit\fR FILE:EXPR" 4
.IX Item "--edit FILE:EXPR"
Edit \f(CW\*(C`FILE\*(C'\fR using the Perl expression \f(CW\*(C`EXPR\*(C'\fR.
.Sp
表現がシェルにより変更されるのを防ぐために、適切に引用符でくくるよう注意してください。
.Sp
このオプションは Perl 5 がインストールされているときのみ利用可能であることに注意してください。
.Sp
See "NON\-INTERACTIVE EDITING" in \fBvirt\-edit\fR\|(1).
.IP "\fB\-\-firstboot\fR SCRIPT" 4
.IX Item "--firstboot SCRIPT"
Install \f(CW\*(C`SCRIPT\*(C'\fR inside the guest, so that when the guest first boots up, the script runs (as root, late in the boot process).
.Sp
The script is automatically chmod +x after installation in the guest.
.Sp
The alternative version \fI\-\-firstboot\-command\fR is the same, but it conveniently wraps the command up in a single line script for you.
.Sp
You can have multiple \fI\-\-firstboot\fR options.  They run in the same order that they appear on the command line.
.Sp
Please take a look at "FIRST BOOT SCRIPTS" in \fBvirt\-builder\fR\|(1) for more information and caveats about the first boot scripts.
.Sp
See also \fI\-\-run\fR.
.IP "\fB\-\-firstboot\-command\fR \*(AqCMD+ARGS\*(Aq" 4
.IX Item "--firstboot-command 'CMD+ARGS'"
Run command (and arguments) inside the guest when the guest first boots up (as root, late in the boot process).
.Sp
You can have multiple \fI\-\-firstboot\fR options.  They run in the same order that they appear on the command line.
.Sp
Please take a look at "FIRST BOOT SCRIPTS" in \fBvirt\-builder\fR\|(1) for more information and caveats about the first boot scripts.
.Sp
See also \fI\-\-run\fR.
.IP "\fB\-\-firstboot\-install\fR PKG,PKG.." 4
.IX Item "--firstboot-install PKG,PKG.."
Install the named packages (a comma\-separated list).  These are installed when the guest first boots using the guest’s package manager (eg. apt, yum, etc.) and the guest’s network connection.
.Sp
For an overview on the different ways to install packages, see "INSTALLING PACKAGES" in \fBvirt\-builder\fR\|(1).
.IP "\fB\-\-hostname\fR HOSTNAME" 4
.IX Item "--hostname HOSTNAME"
Set the hostname of the guest to \f(CW\*(C`HOSTNAME\*(C'\fR.  You can use a dotted hostname.domainname (FQDN) if you want.
.IP "\fB\-\-inject\-qemu\-ga\fR METHOD" 4
.IX Item "--inject-qemu-ga METHOD"
Inject the QEMU Guest Agent into a Windows guest.  The guest agent communicates with qemu through a socket in order to provide enhanced features (see \fBqemu\-ga\fR\|(8)).  This operation also injects a firstboot script so that the Guest Agent is installed when the guest boots.
.Sp
The parameter is the same as used by the \fI\-\-inject\-virtio\-win\fR operation.
.Sp
Note that to do a full conversion of a Windows guest from a foreign hypervisor like VMware (which involves many other operations)  you should use the \fBvirt\-v2v\fR\|(1) tool instead of this.
.IP "\fB\-\-inject\-virtio\-win\fR METHOD" 4
.IX Item "--inject-virtio-win METHOD"
Inject virtio\-win drivers into a Windows guest.  These drivers add virtio accelerated drivers suitable when running on top of a hypervisor that supports virtio (such as qemu/KVM).  The operation also adjusts the Windows Registry so that the drivers are installed when the guest boots.
.Sp
The parameter can be one of:
.RS 4
.IP ISO 4
.IX Item "ISO"
The path to the ISO image containing the virtio\-win drivers (eg. \fI/usr/share/virtio\-win/virtio\-win.iso\fR).
.IP DIR 4
.IX Item "DIR"
The directory containing the unpacked virtio\-win drivers (eg. \fI/usr/share/virtio\-win\fR).
.IP "\fB""osinfo""\fR" 4
.IX Item """osinfo"""
The literal string \f(CW"osinfo"\fR means to use the libosinfo database to locate the drivers.  (See \fBosinfo\-query\fR\|(1).
.RE
.RS 4
.Sp
Note that to do a full conversion of a Windows guest from a foreign hypervisor like VMware (which involves many other operations)  you should use the \fBvirt\-v2v\fR\|(1) tool instead of this.
.RE
.IP "\fB\-\-install\fR PKG,PKG.." 4
.IX Item "--install PKG,PKG.."
Install the named packages (a comma\-separated list).  These are installed during the image build using the guest’s package manager (eg. apt, yum, etc.) and the host’s network connection.
.Sp
For an overview on the different ways to install packages, see "INSTALLING PACKAGES" in \fBvirt\-builder\fR\|(1).
.Sp
See also \fI\-\-update\fR, \fI\-\-uninstall\fR.
.IP "\fB\-\-link\fR TARGET:LINK[:LINK..]" 4
.IX Item "--link TARGET:LINK[:LINK..]"
Create symbolic link(s) in the guest, starting at \f(CW\*(C`LINK\*(C'\fR and pointing at \f(CW\*(C`TARGET\*(C'\fR.
.IP "\fB\-\-mkdir\fR DIR" 4
.IX Item "--mkdir DIR"
Create a directory in the guest.
.Sp
This uses \f(CW\*(C`mkdir\ \-p\*(C'\fR so any intermediate directories are created, and it also works if the directory already exists.
.IP "\fB\-\-move\fR SOURCE:DEST" 4
.IX Item "--move SOURCE:DEST"
Move files or directories inside the guest.
.Sp
Wildcards cannot be used.
.IP \fB\-\-no\-logfile\fR 4
.IX Item "--no-logfile"
Scrub \f(CW\*(C`builder.log\*(C'\fR (log file from build commands) from the image after building is complete.  If you don\*(Aqt want to reveal precisely how the image was built, use this option.
.Sp
See also: "LOG FILE".
.IP \fB\-\-no\-selinux\-relabel\fR 4
.IX Item "--no-selinux-relabel"
Do not attempt to correct the SELinux labels of files in the guest.
.Sp
In such guests that support SELinux, customization automatically relabels files so that they have the correct SELinux label.  (The relabeling is performed immediately, but if the operation fails, customization will instead touch \fI/.autorelabel\fR on the image to schedule a relabel operation for the next time the image boots.)  This option disables the automatic relabeling.
.Sp
The option is a no\-op for guests that do not support SELinux.
.IP "\fB\-\-password\fR USER:SELECTOR" 4
.IX Item "--password USER:SELECTOR"
Set the password for \f(CW\*(C`USER\*(C'\fR.  (Note this option does \fInot\fR create the user account).
.Sp
See "USERS AND PASSWORDS" in \fBvirt\-builder\fR\|(1) for the format of the \f(CW\*(C`SELECTOR\*(C'\fR field, and also how to set up user accounts.
.IP "\fB\-\-password\-crypto\fR md5|sha256|sha512" 4
.IX Item "--password-crypto md5|sha256|sha512"
When the virt tools change or set a password in the guest, this option sets the password encryption of that password to \f(CW\*(C`md5\*(C'\fR, \f(CW\*(C`sha256\*(C'\fR or \f(CW\*(C`sha512\*(C'\fR.
.Sp
\&\f(CW\*(C`sha256\*(C'\fR and \f(CW\*(C`sha512\*(C'\fR require glibc ≥ 2.7 (check \fBcrypt\fR\|(3) inside the guest).
.Sp
\&\f(CW\*(C`md5\*(C'\fR will work with relatively old Linux guests (eg. RHEL 3), but is not secure against modern attacks.
.Sp
The default is \f(CW\*(C`sha512\*(C'\fR unless libguestfs detects an old guest that didn\*(Aqt have support for SHA\-512, in which case it will use \f(CW\*(C`md5\*(C'\fR.  You can override libguestfs by specifying this option.
.Sp
Note this does not change the default password encryption used by the guest when you create new user accounts inside the guest.  If you want to do that, then you should use the \fI\-\-edit\fR option to modify \f(CW\*(C`/etc/sysconfig/authconfig\*(C'\fR (Fedora, RHEL) or \f(CW\*(C`/etc/pam.d/common\-password\*(C'\fR (Debian, Ubuntu).
.IP "\fB\-\-root\-password\fR SELECTOR" 4
.IX Item "--root-password SELECTOR"
Set the root password.
.Sp
See "USERS AND PASSWORDS" in \fBvirt\-builder\fR\|(1) for the format of the \f(CW\*(C`SELECTOR\*(C'\fR field, and also how to set up user accounts.
.Sp
Note: In virt\-builder, if you \fIdon\*(Aqt\fR set \fI\-\-root\-password\fR then the guest is given a \fIrandom\fR root password.
.IP "\fB\-\-run\fR SCRIPT" 4
.IX Item "--run SCRIPT"
Run the shell script (or any program) called \f(CW\*(C`SCRIPT\*(C'\fR on the disk image. The script runs virtualized inside a small appliance, chrooted into the guest filesystem.
.Sp
The script is automatically chmod +x.
.Sp
If libguestfs supports it then a limited network connection is available but it only allows outgoing network connections.  You can also attach data disks (eg. ISO files) as another way to provide data (eg. software packages) to the script without needing a network connection (\fI\-\-attach\fR).  You can also upload data files (\fI\-\-upload\fR).
.Sp
You can have multiple \fI\-\-run\fR options.  They run in the same order that they appear on the command line.
.Sp
See also: \fI\-\-firstboot\fR, \fI\-\-attach\fR, \fI\-\-upload\fR.
.IP "\fB\-\-run\-command\fR \*(AqCMD+ARGS\*(Aq" 4
.IX Item "--run-command 'CMD+ARGS'"
Run the command and arguments on the disk image.  The command runs virtualized inside a small appliance, chrooted into the guest filesystem.
.Sp
If libguestfs supports it then a limited network connection is available but it only allows outgoing network connections.  You can also attach data disks (eg. ISO files) as another way to provide data (eg. software packages) to the script without needing a network connection (\fI\-\-attach\fR).  You can also upload data files (\fI\-\-upload\fR).
.Sp
You can have multiple \fI\-\-run\-command\fR options.  They run in the same order that they appear on the command line.
.Sp
See also: \fI\-\-firstboot\fR, \fI\-\-attach\fR, \fI\-\-upload\fR.
.IP "\fB\-\-scrub\fR FILE" 4
.IX Item "--scrub FILE"
Scrub a file from the guest.  This is like \fI\-\-delete\fR except that:
.RS 4
.IP \(bu 4
It scrubs the data so a guest could not recover it.
.IP \(bu 4
It cannot delete directories, only regular files.
.RE
.RS 4
.RE
.IP \fB\-\-selinux\-relabel\fR 4
.IX Item "--selinux-relabel"
This is a compatibility option that does nothing.
.IP "\fB\-\-sm\-attach\fR SELECTOR" 4
.IX Item "--sm-attach SELECTOR"
Attach to a pool using \f(CW\*(C`subscription\-manager\*(C'\fR.
.Sp
See "SUBSCRIPTION\-MANAGER" in \fBvirt\-builder\fR\|(1) for the format of the \f(CW\*(C`SELECTOR\*(C'\fR field.
.IP "\fB\-\-sm\-credentials\fR SELECTOR" 4
.IX Item "--sm-credentials SELECTOR"
Set the credentials for \f(CW\*(C`subscription\-manager\*(C'\fR.
.Sp
See "SUBSCRIPTION\-MANAGER" in \fBvirt\-builder\fR\|(1) for the format of the \f(CW\*(C`SELECTOR\*(C'\fR field.
.IP \fB\-\-sm\-register\fR 4
.IX Item "--sm-register"
Register the guest using \f(CW\*(C`subscription\-manager\*(C'\fR.
.Sp
This requires credentials being set using \fI\-\-sm\-credentials\fR.
.IP \fB\-\-sm\-remove\fR 4
.IX Item "--sm-remove"
Remove all the subscriptions from the guest using \f(CW\*(C`subscription\-manager\*(C'\fR.
.IP \fB\-\-sm\-unregister\fR 4
.IX Item "--sm-unregister"
Unregister the guest using \f(CW\*(C`subscription\-manager\*(C'\fR.
.IP "\fB\-\-ssh\-inject\fR USER[:SELECTOR]" 4
.IX Item "--ssh-inject USER[:SELECTOR]"
Inject an ssh key so the given \f(CW\*(C`USER\*(C'\fR will be able to log in over ssh without supplying a password.  The \f(CW\*(C`USER\*(C'\fR must exist already in the guest.
.Sp
See "SSH KEYS" in \fBvirt\-builder\fR\|(1) for the format of the \f(CW\*(C`SELECTOR\*(C'\fR field.
.Sp
You can have multiple \fI\-\-ssh\-inject\fR options, for different users and also for more keys for each user.
.IP "\fB\-\-tar\-in\fR TARFILE:REMOTEDIR" 4
.IX Item "--tar-in TARFILE:REMOTEDIR"
Copy local files or directories from a local tar file called \f(CW\*(C`TARFILE\*(C'\fR into the disk image, placing them in the directory \f(CW\*(C`REMOTEDIR\*(C'\fR (which must exist).  Note that the tar file must be uncompressed (\fI.tar.gz\fR files will not work here)
.IP "\fB\-\-timezone\fR TIMEZONE" 4
.IX Item "--timezone TIMEZONE"
Set the default timezone of the guest to \f(CW\*(C`TIMEZONE\*(C'\fR.  Use a location string like \f(CW\*(C`Europe/London\*(C'\fR
.IP "\fB\-\-touch\fR FILE" 4
.IX Item "--touch FILE"
This command performs a \fBtouch\fR\|(1)\-like operation on \f(CW\*(C`FILE\*(C'\fR.
.IP "\fB\-\-truncate\fR FILE" 4
.IX Item "--truncate FILE"
This command truncates \f(CW\*(C`FILE\*(C'\fR to a zero\-length file. The file must exist already.
.IP "\fB\-\-truncate\-recursive\fR PATH" 4
.IX Item "--truncate-recursive PATH"
This command recursively truncates all files under \f(CW\*(C`PATH\*(C'\fR to zero\-length.
.IP "\fB\-\-uninstall\fR PKG,PKG.." 4
.IX Item "--uninstall PKG,PKG.."
Uninstall the named packages (a comma\-separated list).  These are removed during the image build using the guest’s package manager (eg. apt, yum, etc.).  Dependent packages may also need to be uninstalled to satisfy the request.
.Sp
See also \fI\-\-install\fR, \fI\-\-update\fR.
.IP \fB\-\-update\fR 4
.IX Item "--update"
Do the equivalent of \f(CW\*(C`yum update\*(C'\fR, \f(CW\*(C`apt\-get upgrade\*(C'\fR, or whatever command is required to update the packages already installed in the template to their latest versions.
.Sp
See also \fI\-\-install\fR, \fI\-\-uninstall\fR.
.IP "\fB\-\-upload\fR FILE:DEST" 4
.IX Item "--upload FILE:DEST"
Upload local file \f(CW\*(C`FILE\*(C'\fR to destination \f(CW\*(C`DEST\*(C'\fR in the disk image.  File owner and permissions from the original are preserved, so you should set them to what you want them to be in the disk image.
.Sp
\&\f(CW\*(C`DEST\*(C'\fR could be the final filename.  This can be used to rename the file on upload.
.Sp
If \f(CW\*(C`DEST\*(C'\fR is a directory name (which must already exist in the guest)  then the file is uploaded into that directory, and it keeps the same name as on the local filesystem.
.Sp
See also: \fI\-\-mkdir\fR, \fI\-\-delete\fR, \fI\-\-scrub\fR.
.IP "\fB\-\-write\fR FILE:CONTENT" 4
.IX Item "--write FILE:CONTENT"
Write \f(CW\*(C`CONTENT\*(C'\fR to \f(CW\*(C`FILE\*(C'\fR.
.SH SELinux
.IX Header "SELinux"
For guests which make use of SELinux, special handling for them might be needed when using operations which create new files or alter existing ones.
.PP
For further details, see "SELINUX" in \fBvirt\-builder\fR\|(1).
.SH 終了ステータス
.IX Header "終了ステータス"
このプログラムは、成功すると 0 を返します。または、エラーが起きると 1 を返します。
.SH 環境変数
.IX Header "環境変数"
.ie n .IP """VIRT_TOOLS_DATA_DIR""" 4
.el .IP \f(CWVIRT_TOOLS_DATA_DIR\fR 4
.IX Item "VIRT_TOOLS_DATA_DIR"
This can point to the directory containing data files used for Windows firstboot installation.
.Sp
Normally you do not need to set this.  If not set, a compiled\-in default will be used (something like \fI/usr/share/virt\-tools\fR).
.Sp
This directory may contain the following files:
.RS 4
.IP \fIrhsrvany.exe\fR 4
.IX Item "rhsrvany.exe"
This is the RHSrvAny Windows binary, used to install a "firstboot" script in Windows guests.  It is required if you intend to use the \fI\-\-firstboot\fR or \fI\-\-firstboot\-command\fR options with Windows guests.
.Sp
See also: \f(CW\*(C`https://github.com/rwmjones/rhsrvany\*(C'\fR
.IP \fIpvvxsvc.exe\fR 4
.IX Item "pvvxsvc.exe"
This is a Windows binary shipped with SUSE VMDP, used to install a "firstboot" script in Windows guests.  It is required if you intend to use the \fI\-\-firstboot\fR or \fI\-\-firstboot\-command\fR options with Windows guests.
.RE
.RS 4
.RE
.PP
他の環境変数は "環境変数" in \fBguestfs\fR\|(3) を参照してください。
.SH 関連項目
.IX Header "関連項目"
\&\fBguestfs\fR\|(3), \fBguestfish\fR\|(1), \fBvirt\-builder\fR\|(1), \fBvirt\-clone\fR\|(1), \fBvirt\-rescue\fR\|(1), \fBvirt\-resize\fR\|(1), \fBvirt\-sparsify\fR\|(1), \fBvirt\-sysprep\fR\|(1), \fBvirsh\fR\|(1), \fBlvcreate\fR\|(8), \fBqemu\-img\fR\|(1), \fBscrub\fR\|(1), http://libguestfs.org/, http://libvirt.org/.
.SH 著者
.IX Header "著者"
Richard W.M. Jones http://people.redhat.com/~rjones/
.SH COPYRIGHT
.IX Header "COPYRIGHT"
Copyright (C) 2011\-2023 Red Hat Inc.
.SH LICENSE
.IX Header "LICENSE"
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
.PP
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110\-1301 USA.
.SH BUGS
.IX Header "BUGS"
To get a list of bugs against libguestfs, use this link:
https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
.PP
To report a new bug against libguestfs, use this link:
https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
.PP
When reporting a bug, please supply:
.IP \(bu 4
The version of libguestfs.
.IP \(bu 4
Where you got libguestfs (eg. which Linux distro, compiled from source, etc)
.IP \(bu 4
Describe the bug accurately and give a way to reproduce it.
.IP \(bu 4
Run \fBlibguestfs\-test\-tool\fR\|(1) and paste the \fBcomplete, unedited\fR
output into the bug report.