mirror of
https://github.com/TrentSPalmer/trentdocs_website.git
synced 2026-11-08 05:55:09 -08:00
add arch linux instructions to stupid_kvm_tricks
This commit is contained in:
1 parent
1721d26e54
commit
27a11c0656
5 files changed
+122
-21
No files matched your search
@@ -22,7 +22,55 @@ virt-install \
|
||||
--location ./ubuntu-16.04.3-server-amd64.iso \
|
||||
--extra-args 'console=ttyS0,115200n8 serial'
|
||||
```
|
||||
## virt-install Arch Linux
|
||||
The `--extra-args` option lets you use a serial console. But the
|
||||
`--extra-args` option only works if you also use an `--location`
|
||||
option. But the `--location` option can only be used with certain isos.
|
||||
So use `--cdrom` instead of `--location`, drop the `--extra-args`,
|
||||
and instruct the kernel to boot with a serial console with a parameter
|
||||
at the boot splash screen.
|
||||
|
||||
```bash
|
||||
qemu-img create -f qcow2 /var/lib/libvirt/images/arch.qcow2 20G
|
||||
|
||||
virt-install --name arch --ram 4096 \
|
||||
--disk path=/var/lib/libvirt/images/arch.qcow2,size=20 \
|
||||
--vcpus 2 \
|
||||
--os-type linux \
|
||||
--os-variant ubuntu16.04 \
|
||||
--network bridge=virbr0 \
|
||||
--graphics none \
|
||||
--console pty,target_type=serial \
|
||||
--cdrom /var/lib/libvirt/images/archlinux-2018.02.01-x86_64.iso
|
||||
```
|
||||
|
||||
the arch boot splash screen will appear in your terminal and you can
|
||||
tap the "tab" key to edit boot parameters
|
||||
|
||||
add "console=ttyS0" to kernel command line parameters
|
||||
|
||||
before
|
||||
```bash
|
||||
> .linux boot/x86_64/vmlinuz archisobasedir=arch archisolabel=ARCH_201802 initrd=boot/intel_ucode.img,boot/x86_64/archiso.img
|
||||
```
|
||||
after
|
||||
```bash
|
||||
> .linux boot/x86_64/vmlinuz archisobasedir=arch archisolabel=ARCH_201802 initrd=boot/intel_ucode.img,boot/x86_64/archiso.img console=ttyS0
|
||||
```
|
||||
```bash
|
||||
|
||||
arch boots ...
|
||||
...
|
||||
...
|
||||
...
|
||||
|
||||
root@archiso ~ # lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
loop0 7:0 0 432M 1 loop /run/archiso/sfs/airootfs
|
||||
sr0 11:0 1 539M 0 rom /run/archiso/bootmnt
|
||||
vda 254:0 0 20G 0 disk
|
||||
root@archiso ~ #
|
||||
```
|
||||
## Change the Network Interface
|
||||
br0 gets addresses from the network router, but what if you want
|
||||
your vm to have be on the virbr0 192.168.122.0/24 subnet?
|
||||
@@ -177,3 +225,4 @@ Delete snapshot
|
||||
```bash
|
||||
virsh snapshot-delete --domain dcing --snapshotname dcing-snap0
|
||||
```
|
||||
|
||||
+1
-1
@@ -261,5 +261,5 @@
|
||||
|
||||
<!--
|
||||
MkDocs version : 0.17.2
|
||||
Build Date UTC : 2018-02-11 16:32:53
|
||||
Build Date UTC : 2018-02-13 12:50:47
|
||||
-->
|
||||
@@ -582,7 +582,7 @@
|
||||
},
|
||||
{
|
||||
"location": "/stupid_kvm_tricks/",
|
||||
"text": "Stupid KVM Tricks\n\n\nvirt-install ubuntu16.04\n\n\nCreate the disk image\n\n\nqemu-img create -f qcow2 /var/lib/libvirt/images/xenial.qcow2 20G\n\n\nCommand to run the install\n\n\nvirt-install \\\n --name xenial \\\n --ram 4096 \\\n --disk path=/var/lib/libvirt/images/xenial.qcow2,size=20 \\\n --vcpus 4 \\\n --os-type linux \\\n --os-variant ubuntu16.04 \\\n --network bridge=br0 \\\n --graphics none \\\n --console pty,target_type=serial \\\n --location ./ubuntu-16.04.3-server-amd64.iso \\\n --extra-args 'console=ttyS0,115200n8 serial'\n\n\n\n\nChange the Network Interface\n\n\nbr0 gets addresses from the network router, but what if you want\nyour vm to have be on the virbr0 192.168.122.0/24 subnet?\n\n\nvirsh edit xenial\n\n\nAnd then 'J' all the way down to the bottom, change the interface name from br0 to\nvirbr0, \n\n\nvirsh start xenial\n\n\nand then look for the machine with nmap\n\n\nnmap -sn 192.168.122.0/24\n\n\nClone the VM\n\n\nIn this case we don't have to pre-allocate the disk image because virt-clone will do that\nfor us.\n\n\nvirt-clone --original xenial --name xenial-clone \\\n --file /var/lib/libvirt/images/xenial-clone.qcow2\n\n\n\n\nClone the VM to another Machine\n\n\nFirst dump the xml that defines the virtual machine.\n\n\nvirsh dumpxml xenial > xenial.xml\n\n\n\n\nThen copy both \nxenial.xml\n and \nxenial.qcow2\n to the new host machine. On the new kvm\nhost you'll want to at least make sure your vm has the correct CPU architecture.\nThe command to get a list of supported kvm cpu architectures is:\n\n\nvirsh cpu-models <arch>\n# i.e.\nvirsh cpu-models x86_64\n\n\n\n\nAfter you edit \nxenial.xml\n and update the correct cpu architecture, mv \nxenial.qcow2\n\nto \n/var/lib/libvirt/images/\n, clone it. \nvirt-clone\n will handle generating new\nmac addresses for the network interfaces.\n\n\n <cpu mode='custom' match='exact'>\n <model fallback='allow'>Haswell-noTSX</model>\n </cpu>\n# i.e. change to above to\n <cpu mode='custom' match='exact'>\n <model fallback='allow'>SandyBridge</model>\n </cpu>\n\n\n\n\n\nvirt-clone --original-xml xenial.xml --name xenial-clone \\\n --file /var/lib/libvirt/images/xenial-clone.qcow2\n\n\n\n\nWhat is the os-type and os-variant type names?\n\n\nosinfo-query os\n\n\nmisc\n\n\n\n\nStart the vm \nvirsh start xenial\n \n\n\nList all the vms \nvirsh list --all\n \n\n\nStop the vm \nvirsh destroy xenial\n \n\n\nDelete the vm \nvirsh undefine xenial\n \n\n\n\n\nvirsh help\n\n\nThe \nvirsh help\n command returns a long chart of help information. But each section has\na keyword.\n\n\nTake for instance the command \nvirsh help monitor\n. From this we\nsee the \ndomiflist\n subcommand (among others). Unfortunately \ndomifaddr\n doesn't seem to\nwork on the Ubuntu:16.04 host, but there are other ways to find the ip address of\na virtual machine.\n\n\nSo now if you want to see what host interface the vm \nxenial\n is attached to,\ntype. \n\n\nvirsh domiflist xenial\n\n\n\n\nwhich returns:\n\n\nInterface Type Source Model MAC\n-------------------------------------------------------\nvnet1 bridge virbr0 virtio 52:54:00:58:bf:75\n\n\n\n\nSo now we can find the address of virbr0 on the host machine.\n\n\nifconfig virbr0\n\n\n\n\nwhich returns:\n\n\nvirbr0 Link encap:Ethernet HWaddr 52:54:00:38:87:38 \n inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0\n UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1\n RX packets:1351 errors:0 dropped:0 overruns:0 frame:0\n TX packets:3037 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:1000 \n RX bytes:232346 (232.3 KB) TX bytes:502916 (502.9 KB)\n\n\n\n\nand thus we know what subnet to scan with nmap to find the ip address of the vm\n\n\nnmap -sn 192.168.122.0/24\n\n\n\n\nSnapshots\n\n\nCreate snapshot of vm \ndcing\n\n\nvirsh snapshot-create-as --domain dcing --name dcing-snap0\n\n\n\n\nBut you don't need to name your snapshots because they are listed by time.\n\n\nvirsh snapshot-create --domain dcing\n\n\n\n\nList snapshots for vm \ndcing\n\n\nvirsh snapshot-list --domain dcing\n\n Name Creation Time State\n------------------------------------------------------------\n 1518366561 2018-02-11 08:29:21 -0800 shutoff\n dcing-snap0 2018-02-11 08:22:57 -0800 shutoff\n\n\n\n\nRevert dcing to snap0\n\n\nvirsh snapshot-revert --domain dcing --snapshotname dcing-snap0\n\n\n\n\nDelete snapshot\n\n\nvirsh snapshot-delete --domain dcing --snapshotname dcing-snap0",
|
||||
"text": "Stupid KVM Tricks\n\n\nvirt-install ubuntu16.04\n\n\nCreate the disk image\n\n\nqemu-img create -f qcow2 /var/lib/libvirt/images/xenial.qcow2 20G\n\n\nCommand to run the install\n\n\nvirt-install \\\n --name xenial \\\n --ram 4096 \\\n --disk path=/var/lib/libvirt/images/xenial.qcow2,size=20 \\\n --vcpus 4 \\\n --os-type linux \\\n --os-variant ubuntu16.04 \\\n --network bridge=br0 \\\n --graphics none \\\n --console pty,target_type=serial \\\n --location ./ubuntu-16.04.3-server-amd64.iso \\\n --extra-args 'console=ttyS0,115200n8 serial'\n\n\n\n\nvirt-install Arch Linux\n\n\nThe \n--extra-args\n option lets you use a serial console. But the\n\n--extra-args\n option only works if you also use an \n--location\n\noption. But the \n--location\n option can only be used with certain isos.\nSo use \n--cdrom\n instead of \n--location\n, drop the \n--extra-args\n,\nand instruct the kernel to boot with a serial console with a parameter\nat the boot splash screen.\n\n\nqemu-img create -f qcow2 /var/lib/libvirt/images/arch.qcow2 20G\n\nvirt-install --name arch --ram 4096 \\\n --disk path=/var/lib/libvirt/images/arch.qcow2,size=20 \\\n --vcpus 2 \\\n --os-type linux \\\n --os-variant ubuntu16.04 \\ \n --network bridge=virbr0 \\\n --graphics none \\ \n --console pty,target_type=serial \\\n --cdrom /var/lib/libvirt/images/archlinux-2018.02.01-x86_64.iso\n\n\n\n\nthe arch boot splash screen will appear in your terminal and you can \ntap the \"tab\" key to edit boot parameters\n\n\nadd \"console=ttyS0\" to kernel command line parameters\n\n\nbefore\n\n\n> .linux boot/x86_64/vmlinuz archisobasedir=arch archisolabel=ARCH_201802 initrd=boot/intel_ucode.img,boot/x86_64/archiso.img\n\n\n\n\nafter\n\n\n> .linux boot/x86_64/vmlinuz archisobasedir=arch archisolabel=ARCH_201802 initrd=boot/intel_ucode.img,boot/x86_64/archiso.img console=ttyS0\n\n\n\n\n\narch boots ...\n...\n...\n...\n\nroot@archiso ~ # lsblk\nNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT\nloop0 7:0 0 432M 1 loop /run/archiso/sfs/airootfs\nsr0 11:0 1 539M 0 rom /run/archiso/bootmnt\nvda 254:0 0 20G 0 disk \nroot@archiso ~ # \n\n\n\n\nChange the Network Interface\n\n\nbr0 gets addresses from the network router, but what if you want\nyour vm to have be on the virbr0 192.168.122.0/24 subnet?\n\n\nvirsh edit xenial\n\n\nAnd then 'J' all the way down to the bottom, change the interface name from br0 to\nvirbr0, \n\n\nvirsh start xenial\n\n\nand then look for the machine with nmap\n\n\nnmap -sn 192.168.122.0/24\n\n\nClone the VM\n\n\nIn this case we don't have to pre-allocate the disk image because virt-clone will do that\nfor us.\n\n\nvirt-clone --original xenial --name xenial-clone \\\n --file /var/lib/libvirt/images/xenial-clone.qcow2\n\n\n\n\nClone the VM to another Machine\n\n\nFirst dump the xml that defines the virtual machine.\n\n\nvirsh dumpxml xenial > xenial.xml\n\n\n\n\nThen copy both \nxenial.xml\n and \nxenial.qcow2\n to the new host machine. On the new kvm\nhost you'll want to at least make sure your vm has the correct CPU architecture.\nThe command to get a list of supported kvm cpu architectures is:\n\n\nvirsh cpu-models <arch>\n# i.e.\nvirsh cpu-models x86_64\n\n\n\n\nAfter you edit \nxenial.xml\n and update the correct cpu architecture, mv \nxenial.qcow2\n\nto \n/var/lib/libvirt/images/\n, clone it. \nvirt-clone\n will handle generating new\nmac addresses for the network interfaces.\n\n\n <cpu mode='custom' match='exact'>\n <model fallback='allow'>Haswell-noTSX</model>\n </cpu>\n# i.e. change to above to\n <cpu mode='custom' match='exact'>\n <model fallback='allow'>SandyBridge</model>\n </cpu>\n\n\n\n\n\nvirt-clone --original-xml xenial.xml --name xenial-clone \\\n --file /var/lib/libvirt/images/xenial-clone.qcow2\n\n\n\n\nWhat is the os-type and os-variant type names?\n\n\nosinfo-query os\n\n\nmisc\n\n\n\n\nStart the vm \nvirsh start xenial\n \n\n\nList all the vms \nvirsh list --all\n \n\n\nStop the vm \nvirsh destroy xenial\n \n\n\nDelete the vm \nvirsh undefine xenial\n \n\n\n\n\nvirsh help\n\n\nThe \nvirsh help\n command returns a long chart of help information. But each section has\na keyword.\n\n\nTake for instance the command \nvirsh help monitor\n. From this we\nsee the \ndomiflist\n subcommand (among others). Unfortunately \ndomifaddr\n doesn't seem to\nwork on the Ubuntu:16.04 host, but there are other ways to find the ip address of\na virtual machine.\n\n\nSo now if you want to see what host interface the vm \nxenial\n is attached to,\ntype. \n\n\nvirsh domiflist xenial\n\n\n\n\nwhich returns:\n\n\nInterface Type Source Model MAC\n-------------------------------------------------------\nvnet1 bridge virbr0 virtio 52:54:00:58:bf:75\n\n\n\n\nSo now we can find the address of virbr0 on the host machine.\n\n\nifconfig virbr0\n\n\n\n\nwhich returns:\n\n\nvirbr0 Link encap:Ethernet HWaddr 52:54:00:38:87:38 Line truncated
|
||||
"title": "Stupid KVM Tricks"
|
||||
},
|
||||
{
|
||||
@@ -595,6 +595,11 @@
|
||||
"text": "Create the disk image qemu-img create -f qcow2 /var/lib/libvirt/images/xenial.qcow2 20G Command to run the install virt-install \\\n --name xenial \\\n --ram 4096 \\\n --disk path=/var/lib/libvirt/images/xenial.qcow2,size=20 \\\n --vcpus 4 \\\n --os-type linux \\\n --os-variant ubuntu16.04 \\\n --network bridge=br0 \\\n --graphics none \\\n --console pty,target_type=serial \\\n --location ./ubuntu-16.04.3-server-amd64.iso \\\n --extra-args 'console=ttyS0,115200n8 serial'",
|
||||
"title": "virt-install ubuntu16.04"
|
||||
},
|
||||
{
|
||||
"location": "/stupid_kvm_tricks/#virt-install-arch-linux",
|
||||
"text": "The --extra-args option lets you use a serial console. But the --extra-args option only works if you also use an --location \noption. But the --location option can only be used with certain isos.\nSo use --cdrom instead of --location , drop the --extra-args ,\nand instruct the kernel to boot with a serial console with a parameter\nat the boot splash screen. qemu-img create -f qcow2 /var/lib/libvirt/images/arch.qcow2 20G\n\nvirt-install --name arch --ram 4096 \\\n --disk path=/var/lib/libvirt/images/arch.qcow2,size=20 \\\n --vcpus 2 \\\n --os-type linux \\\n --os-variant ubuntu16.04 \\ \n --network bridge=virbr0 \\\n --graphics none \\ \n --console pty,target_type=serial \\\n --cdrom /var/lib/libvirt/images/archlinux-2018.02.01-x86_64.iso the arch boot splash screen will appear in your terminal and you can \ntap the \"tab\" key to edit boot parameters add \"console=ttyS0\" to kernel command line parameters before > .linux boot/x86_64/vmlinuz archisobasedir=arch archisolabel=ARCH_201802 initrd=boot/intel_ucode.img,boot/x86_64/archiso.img after > .linux boot/x86_64/vmlinuz archisobasedir=arch archisolabel=ARCH_201802 initrd=boot/intel_ucode.img,boot/x86_64/archiso.img console=ttyS0 \narch boots ...\n...\n...\n...\n\nroot@archiso ~ # lsblk\nNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT\nloop0 7:0 0 432M 1 loop /run/archiso/sfs/airootfs\nsr0 11:0 1 539M 0 rom /run/archiso/bootmnt\nvda 254:0 0 20G 0 disk \nroot@archiso ~ #",
|
||||
"title": "virt-install Arch Linux"
|
||||
},
|
||||
{
|
||||
"location": "/stupid_kvm_tricks/#change-the-network-interface",
|
||||
"text": "br0 gets addresses from the network router, but what if you want\nyour vm to have be on the virbr0 192.168.122.0/24 subnet? virsh edit xenial And then 'J' all the way down to the bottom, change the interface name from br0 to\nvirbr0, virsh start xenial and then look for the machine with nmap nmap -sn 192.168.122.0/24",
|
||||
|
||||
+19
-19
@@ -4,7 +4,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/apt_pinning_artful_aardvark_packages_in_xenial_xerus/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/lxd_container_home_server_networking_for_dummies/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/lxd_container_foo/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/how_to_reassign_a_static_ip_address_with_dnsmasq/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/serve_and_share_apps_from_your_phone_with_fdroid/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/nspawn/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/gentoo_lxd_container/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/mastodon_on_arch/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/debian_nspawn_container_on_arch_for_testing_apache_configurations/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/dynamic_cacheing_nginx_reverse_proxy_for_pacman/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/freebsd_jails_on_freenas/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/arch_redis_nspawn/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/arch_postgresql_nspawn/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/misc_tips_troubleshooting/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/self_signed_certs/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/selfoss_on_centos7/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/stupid_package_manager_tricks/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
|
||||
<url>
|
||||
<loc>/stupid_kvm_tricks/</loc>
|
||||
<lastmod>2018-02-11</lastmod>
|
||||
<lastmod>2018-02-13</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
|
||||
@@ -148,6 +148,8 @@
|
||||
|
||||
<li><a class="toctree-l3" href="#virt-install-ubuntu1604">virt-install ubuntu16.04</a></li>
|
||||
|
||||
<li><a class="toctree-l3" href="#virt-install-arch-linux">virt-install Arch Linux</a></li>
|
||||
|
||||
<li><a class="toctree-l3" href="#change-the-network-interface">Change the Network Interface</a></li>
|
||||
|
||||
<li><a class="toctree-l3" href="#clone-the-vm">Clone the VM</a></li>
|
||||
@@ -219,6 +221,51 @@
|
||||
--extra-args 'console=ttyS0,115200n8 serial'
|
||||
</code></pre>
|
||||
|
||||
<h2 id="virt-install-arch-linux">virt-install Arch Linux</h2>
|
||||
<p>The <code>--extra-args</code> option lets you use a serial console. But the
|
||||
<code>--extra-args</code> option only works if you also use an <code>--location</code>
|
||||
option. But the <code>--location</code> option can only be used with certain isos.
|
||||
So use <code>--cdrom</code> instead of <code>--location</code>, drop the <code>--extra-args</code>,
|
||||
and instruct the kernel to boot with a serial console with a parameter
|
||||
at the boot splash screen.</p>
|
||||
<pre><code class="bash">qemu-img create -f qcow2 /var/lib/libvirt/images/arch.qcow2 20G
|
||||
|
||||
virt-install --name arch --ram 4096 \
|
||||
--disk path=/var/lib/libvirt/images/arch.qcow2,size=20 \
|
||||
--vcpus 2 \
|
||||
--os-type linux \
|
||||
--os-variant ubuntu16.04 \
|
||||
--network bridge=virbr0 \
|
||||
--graphics none \
|
||||
--console pty,target_type=serial \
|
||||
--cdrom /var/lib/libvirt/images/archlinux-2018.02.01-x86_64.iso
|
||||
</code></pre>
|
||||
|
||||
<p>the arch boot splash screen will appear in your terminal and you can
|
||||
tap the "tab" key to edit boot parameters</p>
|
||||
<p>add "console=ttyS0" to kernel command line parameters</p>
|
||||
<p>before</p>
|
||||
<pre><code class="bash">> .linux boot/x86_64/vmlinuz archisobasedir=arch archisolabel=ARCH_201802 initrd=boot/intel_ucode.img,boot/x86_64/archiso.img
|
||||
</code></pre>
|
||||
|
||||
<p>after</p>
|
||||
<pre><code class="bash">> .linux boot/x86_64/vmlinuz archisobasedir=arch archisolabel=ARCH_201802 initrd=boot/intel_ucode.img,boot/x86_64/archiso.img console=ttyS0
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="bash">
|
||||
arch boots ...
|
||||
...
|
||||
...
|
||||
...
|
||||
|
||||
root@archiso ~ # lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
loop0 7:0 0 432M 1 loop /run/archiso/sfs/airootfs
|
||||
sr0 11:0 1 539M 0 rom /run/archiso/bootmnt
|
||||
vda 254:0 0 20G 0 disk
|
||||
root@archiso ~ #
|
||||
</code></pre>
|
||||
|
||||
<h2 id="change-the-network-interface">Change the Network Interface</h2>
|
||||
<p>br0 gets addresses from the network router, but what if you want
|
||||
your vm to have be on the virbr0 192.168.122.0/24 subnet?</p>
|
||||
|
||||
Reference in new issue
Block a user