xref: /freebsd/usr.sbin/bhyveload/bhyveload.8 (revision f81cdf24ba5436367377f7c8e8f51f6df2a75ca7)
1.\"
2.\" Copyright (c) 2012 NetApp Inc
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd January 12, 2024
27.Dt BHYVELOAD 8
28.Os
29.Sh NAME
30.Nm bhyveload
31.Nd load a
32.Fx
33guest inside a bhyve virtual machine
34.Sh SYNOPSIS
35.Nm
36.Op Fl C
37.Op Fl S
38.Op Fl c Ar cons-dev
39.Op Fl d Ar disk-path
40.Op Fl e Ar name=value
41.Op Fl h Ar host-path
42.Op Fl l Ar os-loader
43.Op Fl m Ar memsize Ns Op Ar K|k|M|m|G|g|T|t
44.Ar vmname
45.Sh DESCRIPTION
46.Nm
47is used to load a
48.Fx
49guest inside a
50.Xr bhyve 4
51virtual machine.
52.Pp
53.Nm
54is based on
55.Xr loader 8
56and will present an interface identical to the
57.Fx
58loader on the user's terminal.
59This behavior can be changed by specifying a different OS loader.
60.Pp
61The virtual machine is identified as
62.Ar vmname
63and will be created if it does not already exist.
64.Sh OPTIONS
65The following options are available:
66.Bl -tag -width indent
67.It Fl c Ar cons-dev
68.Ar cons-dev
69is a
70.Xr tty 4
71device to use for
72.Nm
73terminal I/O.
74.Pp
75The text string "stdio" is also accepted and selects the use of
76unbuffered standard I/O. This is the default value.
77.It Fl d Ar disk-path
78The
79.Ar disk-path
80is the pathname of the guest's boot disk image.
81.It Fl e Ar name=value
82Set the
83.Fx
84loader environment variable
85.Ar name
86to
87.Ar value .
88.Pp
89The option may be used more than once to set more than one environment
90variable.
91.It Fl h Ar host-path
92The
93.Ar host-path
94is the directory at the top of the guest's boot filesystem.
95.It Fl l Ar os-loader
96Specify a different OS loader.
97By default
98.Nm
99will use
100.Pa /boot/userboot.so ,
101which presents a standard
102.Fx
103loader.
104.It Fl m Ar memsize Ns Op Ar K|k|M|m|G|g|T|t
105.Ar memsize
106is the amount of memory allocated to the guest.
107.Pp
108The
109.Ar memsize
110argument may be suffixed with one of
111.Cm K ,
112.Cm M ,
113.Cm G
114or
115.Cm T
116(either upper or lower case) to indicate a multiple of
117Kilobytes, Megabytes, Gigabytes or Terabytes
118respectively.
119.Pp
120.Ar memsize
121defaults to 256M.
122.It Fl C
123Include guest memory in the core file when
124.Nm
125dumps core.
126This is intended for debugging an OS loader as it allows inspection of
127the guest memory.
128.It Fl S
129Wire guest memory.
130.El
131.Sh EXAMPLES
132To create a virtual machine named
133.Ar freebsd-vm
134that boots off the ISO image
135.Pa /freebsd/release.iso
136and has 1GB memory allocated to it:
137.Pp
138.Dl "bhyveload -m 1G -d /freebsd/release.iso freebsd-vm"
139.Pp
140To create a virtual machine named
141.Ar test-vm
142with 256MB of memory allocated, the guest root filesystem under the host
143directory
144.Pa /user/images/test
145and terminal I/O sent to the
146.Xr nmdm 4
147device
148.Pa /dev/nmdm1B
149.Pp
150.Dl "bhyveload -m 256MB -h /usr/images/test -c /dev/nmdm1B test-vm"
151.Sh SEE ALSO
152.Xr bhyve 4 ,
153.Xr nmdm 4 ,
154.Xr vmm 4 ,
155.Xr bhyve 8 ,
156.Xr loader 8
157.Sh HISTORY
158.Nm
159first appeared in
160.Fx 10.0 ,
161and was developed at NetApp Inc.
162.Sh AUTHORS
163.Nm
164was developed by
165.An -nosplit
166.An Neel Natu Aq Mt neel@FreeBSD.org
167at NetApp Inc with a lot of help from
168.An Doug Rabson Aq Mt dfr@FreeBSD.org .
169.Sh BUGS
170.Nm
171can only load
172.Fx
173as a guest.
174.Sh SECURITY CONSIDERATIONS
175Note that in some configurations,
176.Nm
177will execute guest loader scripts in the context of the host machine.
178Note, however, that
179.Nm
180will enter a
181.Xr capsicum 4
182sandbox before it loads the
183.Ar os-loader
184or executes any loader scripts.
185On the host filesystem, the sandbox will only have access to the path specified
186by the
187.Fl h
188flag, the contents of the
189.Pa /boot
190directory if
191.Fl l
192was not specified, and the chosen console device.
193.Pp
194Note that the guest loader scripts are already subject to some limitations that
195are not relaxed simply because we are running in userland.
196For instance, any I/O on the loader's
197.Dq host
198device that can be done in loader scripts is limited to the interface that
199.Nm
200provides, which itself will restrict paths that can be touched to those within
201a specified
202.Fl h
203directory, if any.
204Access to files within
205.Pa /boot
206inside the sandbox would require arbitrary code execution in userboot, and
207userboot is usually provided by the host machine rather than anything that is
208a part of the guest image.
209All access to the
210.Fl h
211directory as well as
212.Pa /boot
213is strictly read-only in the sandbox.
214