add arch linux instructions to stupid_kvm_tricks

This commit is contained in:
Trent Palmer 2018-02-13 04:50:57 -08:00
parent 1721d26e54
commit 27a11c0656
5 changed files with 122 additions and 21 deletions

View File

@ -22,7 +22,55 @@ virt-install \
--location ./ubuntu-16.04.3-server-amd64.iso \ --location ./ubuntu-16.04.3-server-amd64.iso \
--extra-args 'console=ttyS0,115200n8 serial' --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 ## Change the Network Interface
br0 gets addresses from the network router, but what if you want 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? your vm to have be on the virbr0 192.168.122.0/24 subnet?
@ -177,3 +225,4 @@ Delete snapshot
```bash ```bash
virsh snapshot-delete --domain dcing --snapshotname dcing-snap0 virsh snapshot-delete --domain dcing --snapshotname dcing-snap0
``` ```

View File

@ -261,5 +261,5 @@
<!-- <!--
MkDocs version : 0.17.2 MkDocs version : 0.17.2
Build Date UTC : 2018-02-11 16:32:53 Build Date UTC : 2018-02-13 12:50:47
--> -->

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
<url> <url>
<loc>/</loc> <loc>/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -12,7 +12,7 @@
<url> <url>
<loc>/apt_pinning_artful_aardvark_packages_in_xenial_xerus/</loc> <loc>/apt_pinning_artful_aardvark_packages_in_xenial_xerus/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -20,7 +20,7 @@
<url> <url>
<loc>/lxd_container_home_server_networking_for_dummies/</loc> <loc>/lxd_container_home_server_networking_for_dummies/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -28,7 +28,7 @@
<url> <url>
<loc>/lxd_container_foo/</loc> <loc>/lxd_container_foo/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -36,7 +36,7 @@
<url> <url>
<loc>/how_to_reassign_a_static_ip_address_with_dnsmasq/</loc> <loc>/how_to_reassign_a_static_ip_address_with_dnsmasq/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -44,7 +44,7 @@
<url> <url>
<loc>/serve_and_share_apps_from_your_phone_with_fdroid/</loc> <loc>/serve_and_share_apps_from_your_phone_with_fdroid/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -52,7 +52,7 @@
<url> <url>
<loc>/nspawn/</loc> <loc>/nspawn/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -60,7 +60,7 @@
<url> <url>
<loc>/gentoo_lxd_container/</loc> <loc>/gentoo_lxd_container/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -68,7 +68,7 @@
<url> <url>
<loc>/mastodon_on_arch/</loc> <loc>/mastodon_on_arch/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -76,7 +76,7 @@
<url> <url>
<loc>/debian_nspawn_container_on_arch_for_testing_apache_configurations/</loc> <loc>/debian_nspawn_container_on_arch_for_testing_apache_configurations/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -84,7 +84,7 @@
<url> <url>
<loc>/dynamic_cacheing_nginx_reverse_proxy_for_pacman/</loc> <loc>/dynamic_cacheing_nginx_reverse_proxy_for_pacman/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -92,7 +92,7 @@
<url> <url>
<loc>/freebsd_jails_on_freenas/</loc> <loc>/freebsd_jails_on_freenas/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -100,7 +100,7 @@
<url> <url>
<loc>/arch_redis_nspawn/</loc> <loc>/arch_redis_nspawn/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -108,7 +108,7 @@
<url> <url>
<loc>/arch_postgresql_nspawn/</loc> <loc>/arch_postgresql_nspawn/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -116,7 +116,7 @@
<url> <url>
<loc>/misc_tips_troubleshooting/</loc> <loc>/misc_tips_troubleshooting/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -124,7 +124,7 @@
<url> <url>
<loc>/self_signed_certs/</loc> <loc>/self_signed_certs/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -132,7 +132,7 @@
<url> <url>
<loc>/selfoss_on_centos7/</loc> <loc>/selfoss_on_centos7/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -140,7 +140,7 @@
<url> <url>
<loc>/stupid_package_manager_tricks/</loc> <loc>/stupid_package_manager_tricks/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -148,7 +148,7 @@
<url> <url>
<loc>/stupid_kvm_tricks/</loc> <loc>/stupid_kvm_tricks/</loc>
<lastmod>2018-02-11</lastmod> <lastmod>2018-02-13</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>

View File

@ -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-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="#change-the-network-interface">Change the Network Interface</a></li>
<li><a class="toctree-l3" href="#clone-the-vm">Clone the VM</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' --extra-args 'console=ttyS0,115200n8 serial'
</code></pre> </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">&gt; .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">&gt; .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> <h2 id="change-the-network-interface">Change the Network Interface</h2>
<p>br0 gets addresses from the network router, but what if you want <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> your vm to have be on the virbr0 192.168.122.0/24 subnet?</p>