I must be confused...
You say that you are physically booting the installer LiveUSB for a (VM)?
You say that, but... That is not what your script says:
Originally Posted by
bradley-coder7
Code:
virt-install \
--name testunit2 \
--os-variant ubuntu24.04 \
--hvm \
--vcpus 2 \
--cpu host \
--memory 4096 \
--location ./ubuntu.iso,kernel=casper/vmlinuz,initrd=casper/initrd \
--network default,model=virtio \
--disk size=20 \
--graphics vnc
That looks like an ISO file right? If it where a LiveUSB, yo uwould have the path to it there... And it would not have 'a filename'. RightEspeciall one ending in *.iso...
Like this example:
Code:
# virt-install --virt-type kvm --name centos --ram 1024 \
--disk /tmp/centos-7-01.qcow2,format=qcow2 \
--network network=default \
--graphics vnc,listen=0.0.0.0 --noautoconsole \
--os-type=linux --os-variant=centos7.9 \
--location=/data/iso/CentOS-7.9-x86_64-DVD-2009.iso
The '--location' is smarter than you are giving it credit
Code:
--location OPTIONS
Distribution tree installation source. virt-install can recognize certain distribution
trees and fetches a bootable kernel/initrd pair to launch the install.
With libvirt 0.9.4 or later, network URL installs work for remote connections. virt-
install will download kernel/initrd to the local machine, and then upload the media to
the remote host. This option requires the URL to be accessible by both the local and
remote host.
--location allows things like --extra-args for kernel arguments, and using
--initrd-inject. If you want to use those options with CDROM media, you have a few
options:
* Run virt-install as root and do --location ISO
* Mount the ISO at a local directory, and do --location DIRECTORY
* Mount the ISO at a local directory, export that directory over local http, and do
--location http://localhost/DIRECTORY
The "LOCATION" can take one of the following forms:
http://host/path
An HTTP server location containing an installable distribution image.
ftp://host/path
An FTP server location containing an installable distribution image.
nfs:host:/path or nfs://host/path
An NFS server location containing an installable distribution image. This requires
running virt-install as root.
DIRECTORY
Path to a local directory containing an installable distribution image. Note that
the directory will not be accessible by the guest after initial boot, so the OS
installer will need another way to access the rest of the install media.
ISO Mount the ISO and probe the directory. This requires running virt-install as root,
and has the same VM access caveat as DIRECTORY.
Some distro specific url samples:
Fedora/Red Hat Based
http://download.fedoraproject.org/pub/fedora/linux/releases/21/Server/x86_64/os
Debian
http://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/
Ubuntu
http://us.archive.ubuntu.com/ubuntu/dists/wily/main/installer-amd64/
Suse
http://download.opensuse.org/distribution/11.0/repo/oss/
Mandriva
ftp://ftp.uwsg.indiana.edu/linux/mandrake/official/2009.0/i586/
Mageia
ftp://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia/distrib/1
You could have gotten away with
Code:
--location ./ubuntu.iso
If it were an installer LiveUSB, it would have been some like /dev/sgb1 or mounted to a directory, something like /media/$USER/samsung-16gb/ or /mnt...
I use ISO files. I don't usually use option '--location', but rather --cdrom or --disk... but none is wrong between those 3. Just different ways to to that.
Code:
--cdrom=/data/ISO/Fedora-14-x86_64-Live-Desktop.iso
Code:
--cdrom OPTIONS
File or device used as a virtual CD-ROM device. It can be path to an ISO image, or to
a CDROM device. It can also be a URL from which to fetch/access a minimal boot ISO
image. The URLs take the same format as described for the "--location" argument. If a
cdrom has been specified via the "--disk" option, and neither "--cdrom" nor any other
install option is specified, the "--disk" cdrom is used as the install media.
--disk OPTIONS
Specifies media to use as storage for the guest, with various options. The general
format of a disk string is
--disk opt1=val1,opt2=val2,...
The simplest invocation to create a new 10G disk image and associated disk device:
--disk size=10
virt-install will generate a path name, and place it in the default image location for
the hypervisor. To specify media, the command can either be:
--disk /some/storage/path[,opt1=val1]...
or explicitly specify one of the following arguments:
path
A path to some storage media to use, existing or not. Existing media can be a file
or block device.
Specifying a non-existent path implies attempting to create the new storage, and
will require specifying a 'size' value. Even for remote hosts, virt-install will
try to use libvirt storage APIs to automatically create the given path.
If the hypervisor supports it, path can also be a network URL, like
http://example.com/some-disk.img . For network paths, they hypervisor will
directly access the storage, nothing is downloaded locally.
pool
An existing libvirt storage pool name to create new storage on. Requires
specifying a 'size' value.
vol An existing libvirt storage volume to use. This is specified as
'poolname/volname'.
Other available options:
device
Disk device type. Value can be 'cdrom', 'disk', 'lun' or 'floppy'. Default is
'disk'. If a 'cdrom' is specified, and no install method is chosen, the cdrom is
used as the install media.
boot_order
Guest installation with multiple disks will need this parameter to boot correctly
after being installed. A boot_order parameter will take values 1,2,3,... Devices
with lower value has higher priority.
bus Disk bus type. Value can be 'ide', 'sata', 'scsi', 'usb', 'virtio' or 'xen'. The
default is hypervisor dependent since not all hypervisors support all bus types.
removable
Sets the removable flag (/sys/block/$dev/removable on Linux). Only used with QEMU
and bus=usb. Value can be 'on' or 'off'.
readonly
Set drive as readonly (takes 'on' or 'off')
shareable
Set drive as shareable (takes 'on' or 'off')
size
size (in GiB) to use if creating new storage
sparse
whether to skip fully allocating newly created storage. Value is 'yes' or 'no'.
Default is 'yes' (do not fully allocate) unless it isn't supported by the
underlying storage type.
The initial time taken to fully-allocate the guest virtual disk (sparse=no) will
be usually balanced by faster install times inside the guest. Thus use of this
option is recommended to ensure consistently high performance and to avoid I/O
errors in the guest should the host filesystem fill up.
backing_store
Path to a disk to use as the backing store for the newly created image.
cache
The cache mode to be used. The host pagecache provides cache memory. The cache
value can be 'none', 'writethrough', 'directsync', 'unsafe' or 'writeback'.
'writethrough' provides read caching. 'writeback' provides read and write caching.
'directsync' bypasses the host page cache. 'unsafe' may cache all content and
ignore flush requests from the guest.
discard
Whether discard (also known as "trim" or "unmap") requests are ignored or passed
to the filesystem. The value can be either "unmap" (allow the discard request to
be passed) or "ignore" (ignore the discard request). Since 1.0.6 (QEMU and KVM
only)
format
Disk image format. For file volumes, this can be 'raw', 'qcow2', 'vmdk', etc. See
format types in <http://libvirt.org/storage.html> for possible values. This is
often mapped to the driver_type value as well.
If not specified when creating file images, this will default to 'qcow2'.
If creating storage, this will be the format of the new image. If using an
existing image, this overrides libvirt's format auto-detection.
driver_name
Driver name the hypervisor should use when accessing the specified storage.
Typically does not need to be set by the user.
driver_type
Driver format/type the hypervisor should use when accessing the specified storage.
Typically does not need to be set by the user.
io Disk IO backend. Can be either "threads" or "native".
error_policy
How guest should react if a write error is encountered. Can be one of "stop",
"ignore", or "enospace"
serial
Serial number of the emulated disk device. This is used in linux guests to set
/dev/disk/by-id symlinks. An example serial number might be: WD-WMAP9A966149
startup_policy
It defines what to do with the disk if the source file is not accessible. See
possible values in <http://www.libvirt.org/formatdomain.html#elementsDisks>
See the examples section for some uses. This option deprecates -f/--file,
-s/--file-size, --nonsparse, and --nodisks.
Use --disk=? to see a list of all available sub options. Complete details at
<http://libvirt.org/formatdomain.html#elementsDisks>
Like this:
Code:
# virt-install \
--name=FE --ram=756 --vcpus=1 \
--file=/var/lib/libvirt/images/FE.img --network bridge:br0 \
--nographics --os-type=linux \
--extra-args='console=tty0' -v \
--cdrom=/data/ISO/Fedora-Workstation-Live-x86_64-39-1.5.iso
Bookmarks