💾 Archived View for aaoth.xyz › rss.xml captured on 2023-07-10 at 13:13:19.
⬅️ Previous capture (2023-03-20)
-=-=-=-=-=-=-
<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <atom:link href="/rss.xml" rel="self" type="application/rss+xml" /> <title>aaoth.xyz - feed</title> <description>various notes about things.</description> <link>/rss.xml/</link> <lastBuildDate>Tue, 20 Jun 2023 00:00:00 +0200</lastBuildDate> <item> <guid>/2021-11-03-dualboot-linux-and-openbsd-with-grub.html</guid> <link>/2021-11-03-dualboot-linux-and-openbsd-with-grub.html</link> <pubDate>Wed, 03 Nov 2021 00:00:00 +0100</pubDate> <title>dualboot linux and openbsd with grub</title> <description><![CDATA[ <h1 id="dualboot-linux-and-openbsd-with-grub">dualboot linux and openbsd with grub</h1> <pre><code class="language-data"> date: 2021-11-03 author: la-ninpre tags: openbsd, linux, grub, tutorial </code></pre> <p>i’ve been trying to dualboot openbsd with linux using grub on both bios and uefi machines and here’s a solution that i’ve come up with.</p> <p>there are some guides about this on the internet, but there’s no single guide that covers both bios and uefi. @rootbsd has a video where he shows how to do this, but his solution has one little disadvantage. he’s specifying drives in a grub config using relative drive and partition numbers, such as <code>(hd0,gpt2)</code>. since these numbers could be different if one inserts a new drive to the computer, or changes drive order, the boot option could fail (which happened).</p> <p>all partitions and drives have their unique identifier – uuid. there’s no direct way to specify uuid in grub configuration, but there is a workaround. grub manual describes the <code>search</code> command which has an option to set the root device if it is found. so we can use it for our purposes.</p> <h2 id="dualbooting-in-bioslegacy-mode">dualbooting in bios/legacy mode</h2> <p>this guide assumes that you have two drives, one of which has linux system installed and another has openbsd installed.</p> <p>on linux system, use commands like <code>blkid</code> or <code>lsblk -f</code> to get a list of drives with their uuids. there should be a partition with type ‘ufs2’ on a drive with openbsd installed. write down or copy uuid of that partition.</p> <p>depending on your linux distribution, you may have different options to edit the grub config file. many distributions provide <code>/etc/grub.d</code> directory, which has separate files that then get combined into <code>/boot/grub/grub.cfg</code>. if you have it, then you can edit the <code>/etc/grub.d/40_custom</code> file, which is a good place for custom boot options and such. if it is not your case, you can edit <code>grub.cfg</code> directly, but note that it may be overwritten on a system update.</p> <p>add this to your grub config (<code>40_custom</code> or <code>grub.cfg</code>, see above):</p> <pre><code class="language-grub.cfg"> menuentry 'OpenBSD' { search -sun <UUID> chainloader +1 } </code></pre> <p>where <UUID> is the uuid of your openbsd partition (with type ‘ufs2’).</p> <p>you can review options for a <code>search</code> command in grub’s info page, but basically they are needed to use uuid instead of drive number, to set the root variable and to avoid searching floppies (which is not required, but added just in case).</p> <p>if you edited the <code>40_custom</code> file, don’t forget to run <code>grub-mkconfig</code> or <code>update-grub</code> (check your distribution’s manual on updating the grub configuration).</p> <p>after rebooting, you should see openbsd boot option in grub menu.</p> <h2 id="dualbooting-in-uefigpt-mode">dualbooting in uefi/gpt mode</h2> <p>openbsd creates few partitions if you choose gpt partitioning scheme during installation. one of these partitions has fat12 file system and is of our interest. on linux side you need to get its uuid.</p> <p>as with bios/legacy boot described earlier, you need to add a boot option to grub, but this time it’s a bit different:</p> <pre><code class="language-grub.cfg"> menuentry 'OpenBSD' { search -sun <UUID> chainloader /efi/boot/bootx64.efi } </code></pre> <p>where <UUID> is the uuid of openbsd’s fat12 partition.</p> <p>don’t forget to update grub configuration if you edited <code>40_custom</code> file.</p> <p>this also works even if you used full-disk encryption on openbsd.</p> ]]></description> </item> </channel></rss>