ezup.dev

Source Code of Dash Eclipse's Personal Site (ezup.dev)
git clone git://ezup.dev/ezup.dev.git
Log | Files | Refs | README | LICENSE

commit aeee865d8bddacf6a4d5580798d2d89e27ddb670
parent 77672d0e3e07f295db5dcdee98bcd52650bfd5b3
Author: Dash Eclipse <dash@ezup.dev>
Date:   Fri, 10 Jul 2020 19:25:38 +0000

Blog Post: FAT32 Partitionless Void Linux Live USB

Diffstat:
A.web/blog/fat32-partitionless-voidlinux-liveusb.html | 344+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M.web/blog/index.html | 8++++++--
M.web/blog/pgp.html | 26+++++++++++++-------------
M.web/blog/rss.xml | 13+++++++++++--
M.web/styles/site.css | 6+++++-
Aposts/fat32-partitionless-voidlinux-liveusb.org | 211+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mposts/index.org | 2++
Mposts/pgp.org | 2+-
Mposts/rss.org | 8+++++++-
Mpublish.el | 2+-
Mstyles/site.css | 6+++++-
11 files changed, 606 insertions(+), 22 deletions(-)

diff --git a/.web/blog/fat32-partitionless-voidlinux-liveusb.html b/.web/blog/fat32-partitionless-voidlinux-liveusb.html @@ -0,0 +1,344 @@ +<!DOCTYPE html> +<html lang="en"> +<head> +<!-- 2020-07-10 --> +<meta charset="utf-8"> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<title>FAT32 Partitionless Void Linux Live USB</title> +<meta name="generator" content="Org mode"> +<meta name="author" content="Dash Eclipse"> +<meta name="description" content="Install Void Linux LiveOS on A FAT32 Partitionless USB Stick, Works for Both UEFI and Legacy BIOS" +> +<meta name="keywords" content="voidlinux, liveusb, liveos, refind, syslinux, uefi, legacy bios"> +<link rel='icon' type='image/x-icon' href='/favicon.svg'/> +<meta name='viewport' content='width=device-width, initial-scale=1'> +<link rel='stylesheet' href='/styles/topnav.css' type='text/css'/> +<link rel='stylesheet' href='/styles/site.css' type='text/css'/> +<link rel='stylesheet' href='/styles/syntax-coloring.css' type='text/css'/> +<link rel='alternate' type='application/rss+xml' title='RSS' href='/blog/rss.xml'> +</head> +<body> +<header id="top" class="status"> +<div> +<ul class='topnav'> +<li class='home'><a href='/#dash'>ezup.dev</a></li> +<li><a class='active' href='./'>Blog</a></li> +<li><a href='/#pgp'>PGP</a></li> +<li><a href='/git/' target='_blank'><u>Git</u></a></li> +<li class='right'><a href='/#about'>About</a></li> +</ul> +</div> +</header> +<main id="content"> +<header> +<h1 class="title">FAT32 Partitionless Void Linux Live USB</h1> +<p class="subtitle">Published on 2020-07-10 by Dash Eclipse.</p> +</header><nav id="table-of-contents"> +<h2>Table of Contents</h2> +<div id="text-table-of-contents"> +<ul> +<li><a href="#org54e6efb">1. What is this about and why do I create Live USB this way</a> +<ul> +<li><a href="#orga3ec0e0">1.1. Advantages</a></li> +<li><a href="#org7bc5c8d">1.2. How does this works and works for both UEFI and Legacy BIOS?</a></li> +</ul> +</li> +<li><a href="#org8e6c790">2. Layout and Bootloader configuration files</a></li> +<li><a href="#org4ebd9a7">3. Create FAT32 Partitionless Void Linux Live USB</a> +<ul> +<li><a href="#org29ebf06">3.1. Download void-live ISO and bootloaders</a></li> +<li><a href="#org857fb39">3.2. Create the FAT32 filesystem and label it</a></li> +<li><a href="#org9b4cf69">3.3. Grab files from void-live ISO</a></li> +<li><a href="#org8a31d2f">3.4. rEFInd for UEFI</a></li> +<li><a href="#org2ade283">3.5. syslinux for Legacy BIOS</a></li> +</ul> +</li> +</ul> +</div> +</nav> + +<section id="outline-container-org54e6efb" class="outline-2"> +<h2 id="org54e6efb"><span class="section-number-2">1</span> What is this about and why do I create Live USB this way</h2> +<div class="outline-text-2" id="text-1"> +<p> +I use void-live as my Live USB because it supports booting into RAM, so I can eject USB stick after boot into LiveOS. And Void Linux provides a set of scripts<sup><a id="fnr.1" class="footref" href="#fn.1">1</a></sup> to generate the iso, it's pretty easy to customize it and it just works. +</p> + +<p> +But I don't want to use <code>dd</code> to write iso to my USB stick each time I need to use Live USB, or use a dedicated USB stick for the LiveOS. I can't use the USB stick to store other files once I create Live USB this way. +</p> + +<p> +The solution is pretty simple, just create one FAT32 filesystem on the USB stick, install bootloaders and copy LiveOS to it, and then configure the bootloader to boot the LiveOS. +</p> +</div> + +<div id="outline-container-orga3ec0e0" class="outline-3"> +<h3 id="orga3ec0e0"><span class="section-number-3">1.1</span> Advantages</h3> +<div class="outline-text-3" id="text-1-1"> +<ul class="org-ul"> +<li>Works for both UEFI and Legacy BIOS</li> +<li>Maximally use the storage, everything in one filesystem</li> +<li>Could still use the USB stick for storing files as noraml</li> +<li>Easy to delete the LiveOS from the USB stick, just remove these files</li> +<li>Simple and just works, no dirty hacks, no need for loading iso files</li> +<li>No need to install boot code</li> +</ul> +</div> +</div> + +<div id="outline-container-org7bc5c8d" class="outline-3"> +<h3 id="org7bc5c8d"><span class="section-number-3">1.2</span> How does this works and works for both UEFI and Legacy BIOS?</h3> +<div class="outline-text-3" id="text-1-2"> +<p> +It's pretty simple, just install the bootloader, configure it to load <code>vmlinuz</code> the linux kernel and <code>initrd</code> the initramfs and it will load <code>LiveOS/squashfs.img</code> from the FAT32 filesystem which labeled as <code>VOID_​LIVE</code>. +</p> + +<p> +Just install bootloaders for UEFI and Legacy BIOS, I choose rEFInd for UEFI and syslinux for Legacy BIOS. +</p> + +<p> +For UEFI, a FAT32 filesystem is necessary for loading a boot manager or bootloader, the FAT32 filesystem does not necessarily to be inside a GPT or MBR partition table, it could on the whole device without any partition table (a.k.a. partitionless). +</p> + +<p> +For Legacy BIOS, when you have a partition table on the hard drive, you need to install the boot code to the device to be able to boot from it, and the partition which contains the bootloader should be marked as <b>active</b>. But you don't need to install boot code for a partitionless setup<sup><a id="fnr.2" class="footref" href="#fn.2">2</a></sup>, it just boots from the filesystem. +</p> +</div> +</div> +</section> + +<section id="outline-container-org8e6c790" class="outline-2"> +<h2 id="org8e6c790"><span class="section-number-2">2</span> Layout and Bootloader configuration files</h2> +<div class="outline-text-2" id="text-2"> +<p> +Layout +</p> +<pre style="line-height:1;"> +VOID_LIVE -> # mkfs.vfat, fatlabel +├── EFI +│ ├── BOOT +│ │ ├── BOOTX64.EFI -> ../refind/refind_x64.efi +│ │ └── refind.conf -> ../refind/refind.conf +│ └── refind +│ ├── icons -> [refind] +│ │ └── ... +│ ├── refind_x64.efi -> [refind] +│ ├── refind.conf +│ └── themes +│ └── refind-theme-regular -> [github] munlik/refind-theme-regular +│ └── ... +├── LiveOS +│ ├── initrd -> [iso] boot/initrd +│ ├── squashfs.img -> [iso] +│ └── vmlinuz -> [iso] boot/vmlinuz +└── syslinux + ├── chain.c32 -> [syslinux] + ├── ldlinux.c32 -> # syslinux + ├── ldlinux.sys -> # syslinux + ├── libcom32.c32 -> [syslinux] + ├── libutil.c32 -> [syslinux] + ├── splash.png -> [iso] boot/isolinux/splash.png + ├── syslinux.cfg -> [iso] boot/isolinux/isolinux.cfg* + └── vesamenu.c32 -> [syslinux] + +[iso] -> void-live-x86_64{,-musl}-*.iso +[refind] -> /usr/share/refind +[syslinux] -> /usr/lib/syslinux +</pre> +<p> +My <code>VOID_LIVE/refind/refind.conf</code> +</p> +<pre class="example"> +timeout 20 +#hideui hints +#dont_scan_volumes VOID_LIVE +resolution 1920 1080 + +## refind-theme-regular +#include /EFI/refind/themes/refind-theme-regular/theme.conf +icons_dir /EFI/refind/themes/refind-theme-regular/icons/128-48 +big_icon_size 128 +small_icon_size 48 +banner /EFI/refind/themes/refind-theme-regular/icons/128-48/bg.png +selection_big /EFI/refind/themes/refind-theme-regular/icons/128-48/selection-big.png +selection_small /EFI/refind/themes/refind-theme-regular/icons/128-48/selection-small.png +font /EFI/refind/themes/refind-theme-regular/fonts/source-code-pro-extralight-14.png + +menuentry "Void Linux (x86_64-musl)" { + icon /EFI/refind/icons/os_void.png + loader LiveOS/vmlinuz + initrd /LiveOS/initrd + options "root=live:CDLABEL=VOID_LIVE ro init=/sbin/init rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap vconsole.unicode=1 vconsole.keymap=dvorak-programmer locale.LANG=en_US.UTF-8 rd.live.overlay.overlayfs=1" + #disabled +} + +menuentry "Void Linux (x86_64-musl) (RAM)" { + icon /EFI/refind/icons/os_void.png + loader LiveOS/vmlinuz + initrd /LiveOS/initrd + options "root=live:CDLABEL=VOID_LIVE ro init=/sbin/init rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap vconsole.unicode=1 vconsole.keymap=dvorak-programmer locale.LANG=en_US.UTF-8 rd.live.overlay.overlayfs=1 rd.live.ram" + #disabled +} +</pre> +<p> +My <code>VOID_LIVE/syslinux/syslinux.cfg</code>, Check <code>boot/isolinux/isolinux.cfg</code> from ISO +</p> +<pre class="example"> +UI vesamenu.c32 +PROMPT 0 +TIMEOUT 100 +ONTIMEOUT linux + +MENU TABMSG Press ENTER to boot or TAB to edit a menu entry +MENU AUTOBOOT BIOS default device boot in # second{,s}... +MENU BACKGROUND splash.png +MENU WIDTH 78 +MENU MARGIN 1 +MENU ROWS 4 +MENU VSHIFT 2 +MENU TIMEOUTROW 8 +MENU TABMSGROW 2 +MENU CMDLINEROW 11 +MENU HELPMSGROW 16 +MENU HELPMSGENDROW 29 + +MENU COLOR title * #FF5255FF * +MENU COLOR border * #00000000 #00000000 none +MENU COLOR sel * #ffffffff #FF5255FF * + +LABEL linux +MENU LABEL Void Linux 5.3.9_1 x86_64-musl +KERNEL /LiveOS/vmlinuz +APPEND initrd=/LiveOS/initrd root=live:CDLABEL=VOID_LIVE init=/sbin/init ro rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 vconsole.unicode=1 vconsole.keymap=dvorak-programmer locale.LANG=en_US.UTF-8 rd.live.overlay.overlayfs=1 +LABEL linuxram +MENU LABEL Void Linux 5.3.9_1 x86_64-musl (RAM) +KERNEL /LiveOS/vmlinuz +APPEND initrd=/LiveOS/initrd root=live:CDLABEL=VOID_LIVE init=/sbin/init ro rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 vconsole.unicode=1 vconsole.keymap=dvorak-programmer locale.LANG=en_US.UTF-8 rd.live.overlay.overlayfs=1 rd.live.ram +LABEL c +MENU LABEL Boot first HD found by BIOS +COM32 chain.c32 +APPEND hd0 +</pre> +<p> +Minimal <code>VOID_LIVE/syslinux/syslinux.cfg</code> +</p> +<pre class="example"> +PROMPT 1 +TIMEOUT 50 +DEFAULT voidram + +LABEL void + LINUX ../LiveOS/vmlinuz + APPEND initrd=/LiveOS/initrd root=live:CDLABEL=VOID_LIVE init=/sbin/init ro rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 vconsole.unicode=1 vconsole.keymap=dvorak-programmer locale.LANG=en_US.UTF-8 rd.live.overlay.overlayfs=1 + INITRD ../LiveOS/initrd + +LABEL voidram + LINUX ../LiveOS/vmlinuz + APPEND initrd=/LiveOS/initrd root=live:CDLABEL=VOID_LIVE init=/sbin/init ro rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 vconsole.unicode=1 vconsole.keymap=dvorak-programmer locale.LANG=en_US.UTF-8 rd.live.overlay.overlayfs=1 rd.live.ram + INITRD ../LiveOS/initrd +</pre> +</div> +</section> + +<section id="outline-container-org4ebd9a7" class="outline-2"> +<h2 id="org4ebd9a7"><span class="section-number-2">3</span> Create FAT32 Partitionless Void Linux Live USB</h2> +<div class="outline-text-2" id="text-3"> +</div> +<div id="outline-container-org29ebf06" class="outline-3"> +<h3 id="org29ebf06"><span class="section-number-3">3.1</span> Download void-live ISO and bootloaders</h3> +<div class="outline-text-3" id="text-3-1"> +<ul class="org-ul"> +<li><a href="https://voidlinux.org/download/">void-live</a>, I use <code>void-live-x86_64-musl-20191109.iso</code></li> +<li><a href="https://www.rodsbooks.com/refind/">rEFInd</a>, I use <code>refind</code> the void package</li> +<li><a href="https://wiki.syslinux.org/wiki/index.php?title=Download">syslinux</a>, I use <code>syslinux</code> the void package</li> +</ul> +</div> +</div> + +<div id="outline-container-org857fb39" class="outline-3"> +<h3 id="org857fb39"><span class="section-number-3">3.2</span> Create the FAT32 filesystem and label it</h3> +<div class="outline-text-3" id="text-3-2"> +<p> +Assume the USB Stick we are going to create LiveOS is <code>/dev/sdc</code> +</p> +<div class="org-src-container"> +<pre class="src src-sh">sudo mkfs.vfat -I -F32 /dev/sdc +sudo fatlabel /dev/sdc VOID_LIVE +mkdir VOID_LIVE +sudo mount /dev/sdc VOID_LIVE +</pre> +</div> +</div> +</div> + +<div id="outline-container-org9b4cf69" class="outline-3"> +<h3 id="org9b4cf69"><span class="section-number-3">3.3</span> Grab files from void-live ISO</h3> +<div class="outline-text-3" id="text-3-3"> +<p> +Assume we are using <code>void-live-x86_64-musl-20191109.iso</code> +</p> +<div class="org-src-container"> +<pre class="src src-sh">mkdir void-live-x86_64-musl-20191109 +sudo mount void-live-x86_64-musl-20191109.iso void-live-x86_64-musl-20191109 +sudo mkdir VOID_LIVE/LiveOS +sudo cp void-live-x86_64-musl-20191109/boot/{initrd,vmlinuz} VOID_LIVE/LiveOS +<span class="org-comment-delimiter">## </span><span class="org-comment">Optionally grab splash.png</span> +sudo mkdir VOID_LIVE/syslinux +sudo cp void-live-x86_64-musl-20191109/boot/isolinux/splash.png VOID_LIVE/syslinux +</pre> +</div> +</div> +</div> + +<div id="outline-container-org8a31d2f" class="outline-3"> +<h3 id="org8a31d2f"><span class="section-number-3">3.4</span> rEFInd for UEFI</h3> +<div class="outline-text-3" id="text-3-4"> +<div class="org-src-container"> +<pre class="src src-sh">sudo xbps-install -S refind +sudo mkdir VOID_LIVE/EFI/refind +sudo cp -r /usr/share/refind/icons VOID_LIVE/EFI/refind/ +sudo cp /usr/share/refind/refind_x64.efi VOID_LIVE/EFI/refind/ +sudo cp VOID_LIVE/EFI/{refind/refind_x64.efi,BOOT/BOOTX64.efi} +<span class="org-comment-delimiter">## </span><span class="org-comment">Optionall get https://github.com/munlik/refind-theme-regular</span> +<span class="org-comment-delimiter">## </span><span class="org-comment">And put it under VOID_LIVE/EFI/refind/themes/</span> +sudo vim VOID_LIVE/refind/refind.conf +sudo cp VOID_LIVE/{refind,BOOT}/refind.conf +</pre> +</div> +</div> +</div> + +<div id="outline-container-org2ade283" class="outline-3"> +<h3 id="org2ade283"><span class="section-number-3">3.5</span> syslinux for Legacy BIOS</h3> +<div class="outline-text-3" id="text-3-5"> +<div class="org-src-container"> +<pre class="src src-sh">sudo xbps-install -S syslinux +sudo mkdir VOID_LIVE/syslinux +sudo cp /usr/lib/syslinux/{chain,libcom32,libutil,vesamenu}.c32 VOID_LIVE/syslinux +sudo vim VOID_LIVE/syslinux/syslinux.cfg +sudo umount VOID_LIVE +sudo syslinux --directory syslinux --install /dev/sdc +</pre> +</div> +</div> +</div> +</section> +<div id="footnotes"> +<h2 class="footnotes">Footnotes: </h2> +<div id="text-footnotes"> + +<div class="footdef"><sup><a id="fn.1" class="footnum" href="#fnr.1">1</a></sup> <div class="footpara"><p class="footpara"> +<a href="https://github.com/void-linux/void-mklive">void-mklive</a> +</p></div></div> + +<div class="footdef"><sup><a id="fn.2" class="footnum" href="#fnr.2">2</a></sup> <div class="footpara"><p class="footpara"> +<a href="https://unix.stackexchange.com/a/103568">For Legacy BIOS, Using a filesystem without a partition table thus not only saves space, but also a step in the boot process.</a> +</p></div></div> + + +</div> +</div></main> +</body> +</html> diff --git a/.web/blog/index.html b/.web/blog/index.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <html lang="en"> <head> -<!-- 2020-07-09 --> +<!-- 2020-07-10 --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Blog Index</title> @@ -31,9 +31,13 @@ <main id="content"> <header> <h1 class="title">Blog Index</h1> -<p class="subtitle">Published on 2020-07-09 by Dash Eclipse.</p> +<p class="subtitle">Published on 2020-07-10 by Dash Eclipse.</p> </header><ul class="org-ul"> <li><p> +<a href="fat32-partitionless-voidlinux-liveusb.html">FAT32 Partitionless Void Linux Live USB</a> +</p> +<p class='pubdate'>by Dash Eclipse on Jul 10, 2020.</p></li> +<li><p> <a href="pgp.html">OpenPGP Key Generation and Usage</a> </p> <p class='pubdate'>by Dash Eclipse on Jun 30, 2020.</p></li> diff --git a/.web/blog/pgp.html b/.web/blog/pgp.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <html lang="en"> <head> -<!-- 2020-07-09 --> +<!-- 2020-07-10 --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>OpenPGP Key Generation and Usage</title> @@ -37,8 +37,8 @@ In this article I'm gonna explain how do I generate and use OpenPGP keys. </p> -<section id="outline-container-orga1118e9" class="outline-2"> -<h2 id="orga1118e9"><span class="section-number-2">1</span> Install GnuPG</h2> +<section id="outline-container-org4acb822" class="outline-2"> +<h2 id="org4acb822"><span class="section-number-2">1</span> Install GnuPG</h2> <div class="outline-text-2" id="text-1"> <p> On macOS you can use brew to install GnuPG <code>brew install gnupg</code>, you will also need <code>pinentry-mac</code> package if you are going to use it with GUI programs such like Thunderbird with Eng @@ -46,8 +46,8 @@ On macOS you can use brew to install GnuPG <code>brew install gnupg</code>, you </div> </section> -<section id="outline-container-orgbfa969a" class="outline-2"> -<h2 id="orgbfa969a"><span class="section-number-2">2</span> OpenPGP key generation</h2> +<section id="outline-container-org61d0fec" class="outline-2"> +<h2 id="org61d0fec"><span class="section-number-2">2</span> OpenPGP key generation</h2> <div class="outline-text-2" id="text-2"> <p> Beside <code>gpg --full-generate-key</code>, you can also create a key with gpg in batch mode<sup><a id="fnr.1" class="footref" href="#fn.1">1</a></sup>. @@ -84,8 +84,8 @@ gpg --batch --generate-key first-last.txt </div> </section> -<section id="outline-container-org1935465" class="outline-2"> -<h2 id="org1935465"><span class="section-number-2">3</span> Use subkeys</h2> +<section id="outline-container-org849ea4c" class="outline-2"> +<h2 id="org849ea4c"><span class="section-number-2">3</span> Use subkeys</h2> <div class="outline-text-2" id="text-3"> <p> I use encryption and signing subkeys instead of just use one key for everything, because it's safer when you keep your master key elsewhere and use different keys for different purposes. Debian also recommend to use subkeys.<sup><a id="fnr.2" class="footref" href="#fn.2">2</a></sup> @@ -104,8 +104,8 @@ gpg --edit-key &lt;key-id&gt; passwd </pre> </div> </div> -<div id="outline-container-org682cd74" class="outline-3"> -<h3 id="org682cd74"><span class="section-number-3">3.1</span> Thunderbird and Enigmail</h3> +<div id="outline-container-orgf9434b8" class="outline-3"> +<h3 id="orgf9434b8"><span class="section-number-3">3.1</span> Thunderbird and Enigmail</h3> <div class="outline-text-3" id="text-3-1"> <p> I use Thunderbird with Enigmail to send and receive PGP encrypted emails, you can follow <a href="https://ssd.eff.org/en/module/how-use-pgp-mac-os-x">the guide by EFF SSD</a> to set it up. Note you need to install <code>pinentry-mac</code> the package to use GPG with such GUI programs. @@ -117,8 +117,8 @@ I use Thunderbird with Enigmail to send and receive PGP encrypted emails, you ca </div> </div> </div> -<div id="outline-container-org5fae8b7" class="outline-3"> -<h3 id="org5fae8b7"><span class="section-number-3">3.2</span> Git</h3> +<div id="outline-container-org0a01a82" class="outline-3"> +<h3 id="org0a01a82"><span class="section-number-3">3.2</span> Git</h3> <div class="outline-text-3" id="text-3-2"> <div class="org-src-container"> <pre class="src src-sh">git config --global gpg.program $(<span class="org-builtin">which</span> gpg) @@ -133,8 +133,8 @@ In case you don't want to sign commits for specific repo, just run <code>git con </p> </div> </div> -<div id="outline-container-org18a6119" class="outline-3"> -<h3 id="org18a6119"><span class="section-number-3">3.3</span> pass (the standard unix password manager)</h3> +<div id="outline-container-org3d98527" class="outline-3"> +<h3 id="org3d98527"><span class="section-number-3">3.3</span> pass (the standard unix password manager)</h3> <div class="outline-text-3" id="text-3-3"> <p> I use <a href="https://www.passwordstore.org/">pass</a> to manage my passwords, with a different key. pass store passwords in a git repo, you can also store the <code>$GNUPGHOME</code> in a git repo or just in the same repo. diff --git a/.web/blog/rss.xml b/.web/blog/rss.xml @@ -14,8 +14,8 @@ <link>https://ezup.dev/blog/</link> <description><![CDATA[]]></description> <language>en</language> - <pubDate>Thu, 09 Jul 2020 16:20:31 +0000</pubDate> - <lastBuildDate>Thu, 09 Jul 2020 16:20:31 +0000</lastBuildDate> + <pubDate>Fri, 10 Jul 2020 19:25:15 +0000</pubDate> + <lastBuildDate>Fri, 10 Jul 2020 19:25:15 +0000</lastBuildDate> <generator>Emacs 26.3 Org-mode 9.3.7</generator> <webMaster>dash@ezup.dev (Dash Eclipse)</webMaster> <image> @@ -26,6 +26,15 @@ <item> + <title>FAT32 Partitionless Void Linux Live USB</title> + <link>https://ezup.dev/blog/fat32-partitionless-voidlinux-liveusb.html</link> + <author>dash@ezup.dev (Dash Eclipse)</author> + <guid isPermaLink="false">https://ezup.dev/blog/fat32-partitionless-voidlinux-liveusb.html</guid> + <pubDate>Fri, 10 Jul 2020 00:00:00 +0000</pubDate> + + <description><![CDATA[]]></description> + </item> + <item> <title>OpenPGP Key Generation and Usage</title> <link>https://ezup.dev/blog/pgp.html</link> <author>dash@ezup.dev (Dash Eclipse)</author> diff --git a/.web/styles/site.css b/.web/styles/site.css @@ -45,6 +45,9 @@ body { font-size: 18px; } } +div#text-table-of-contents ul li ul { + margin-top: 0.5em; +} p.subtitle { font-size: 17px; margin-top: 1em; @@ -126,7 +129,8 @@ body code { font-size: .9em; } body li { - margin-bottom: 1em; + margin-bottom: 0.6em; + line-height: 1; } body img { border: 1px solid #ccc; diff --git a/posts/fat32-partitionless-voidlinux-liveusb.org b/posts/fat32-partitionless-voidlinux-liveusb.org @@ -0,0 +1,211 @@ +#+STARTUP: content +#+TITLE: FAT32 Partitionless Void Linux Live USB +#+AUTHOR: Dash Eclipse +#+DATE: [2020-07-10 Fri] +#+KEYWORDS: voidlinux, liveusb, liveos, refind, syslinux, uefi, legacy bios +#+DESCRIPTION: Install Void Linux LiveOS on A FAT32 Partitionless USB Stick, Works for Both UEFI and Legacy BIOS +#+OPTIONS: toc:t + +* What is this about and why do I create Live USB this way + I use void-live as my Live USB because it supports booting into RAM, so I can eject USB stick after boot into LiveOS. And Void Linux provides a set of scripts[fn:1] to generate the iso, it's pretty easy to customize it and it just works. + + But I don't want to use ~dd~ to write iso to my USB stick each time I need to use Live USB, or use a dedicated USB stick for the LiveOS. I can't use the USB stick to store other files once I create Live USB this way. + + The solution is pretty simple, just create one FAT32 filesystem on the USB stick, install bootloaders and copy LiveOS to it, and then configure the bootloader to boot the LiveOS. + +** Advantages + - Works for both UEFI and Legacy BIOS + - Maximally use the storage, everything in one filesystem + - Could still use the USB stick for storing files as noraml + - Easy to delete the LiveOS from the USB stick, just remove these files + - Simple and just works, no dirty hacks, no need for loading iso files + - No need to install boot code + +** How does this works and works for both UEFI and Legacy BIOS? + It's pretty simple, just install the bootloader, configure it to load ~vmlinuz~ the linux kernel and ~initrd~ the initramfs and it will load ~LiveOS/squashfs.img~ from the FAT32 filesystem which labeled as ~VOID_​LIVE~. + + Just install bootloaders for UEFI and Legacy BIOS, I choose rEFInd for UEFI and syslinux for Legacy BIOS. + + For UEFI, a FAT32 filesystem is necessary for loading a boot manager or bootloader, the FAT32 filesystem does not necessarily to be inside a GPT or MBR partition table, it could on the whole device without any partition table (a.k.a. partitionless). + + For Legacy BIOS, when you have a partition table on the hard drive, you need to install the boot code to the device to be able to boot from it, and the partition which contains the bootloader should be marked as *active*. But you don't need to install boot code for a partitionless setup[fn:2], it just boots from the filesystem. + +* Layout and Bootloader configuration files + Layout + #+BEGIN_EXPORT html + <pre style="line-height:1;"> + VOID_LIVE -> # mkfs.vfat, fatlabel + ├── EFI + │ ├── BOOT + │ │ ├── BOOTX64.EFI -> ../refind/refind_x64.efi + │ │ └── refind.conf -> ../refind/refind.conf + │ └── refind + │ ├── icons -> [refind] + │ │ └── ... + │ ├── refind_x64.efi -> [refind] + │ ├── refind.conf + │ └── themes + │ └── refind-theme-regular -> [github] munlik/refind-theme-regular + │ └── ... + ├── LiveOS + │ ├── initrd -> [iso] boot/initrd + │ ├── squashfs.img -> [iso] + │ └── vmlinuz -> [iso] boot/vmlinuz + └── syslinux + ├── chain.c32 -> [syslinux] + ├── ldlinux.c32 -> # syslinux + ├── ldlinux.sys -> # syslinux + ├── libcom32.c32 -> [syslinux] + ├── libutil.c32 -> [syslinux] + ├── splash.png -> [iso] boot/isolinux/splash.png + ├── syslinux.cfg -> [iso] boot/isolinux/isolinux.cfg* + └── vesamenu.c32 -> [syslinux] + + [iso] -> void-live-x86_64{,-musl}-*.iso + [refind] -> /usr/share/refind + [syslinux] -> /usr/lib/syslinux + </pre> + #+END_EXPORT + My ~VOID_LIVE/refind/refind.conf~ + #+BEGIN_EXAMPLE + timeout 20 + #hideui hints + #dont_scan_volumes VOID_LIVE + resolution 1920 1080 + + ## refind-theme-regular + #include /EFI/refind/themes/refind-theme-regular/theme.conf + icons_dir /EFI/refind/themes/refind-theme-regular/icons/128-48 + big_icon_size 128 + small_icon_size 48 + banner /EFI/refind/themes/refind-theme-regular/icons/128-48/bg.png + selection_big /EFI/refind/themes/refind-theme-regular/icons/128-48/selection-big.png + selection_small /EFI/refind/themes/refind-theme-regular/icons/128-48/selection-small.png + font /EFI/refind/themes/refind-theme-regular/fonts/source-code-pro-extralight-14.png + + menuentry "Void Linux (x86_64-musl)" { + icon /EFI/refind/icons/os_void.png + loader LiveOS/vmlinuz + initrd /LiveOS/initrd + options "root=live:CDLABEL=VOID_LIVE ro init=/sbin/init rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap vconsole.unicode=1 vconsole.keymap=dvorak-programmer locale.LANG=en_US.UTF-8 rd.live.overlay.overlayfs=1" + #disabled + } + + menuentry "Void Linux (x86_64-musl) (RAM)" { + icon /EFI/refind/icons/os_void.png + loader LiveOS/vmlinuz + initrd /LiveOS/initrd + options "root=live:CDLABEL=VOID_LIVE ro init=/sbin/init rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap vconsole.unicode=1 vconsole.keymap=dvorak-programmer locale.LANG=en_US.UTF-8 rd.live.overlay.overlayfs=1 rd.live.ram" + #disabled + } + #+END_EXAMPLE + My ~VOID_LIVE/syslinux/syslinux.cfg~, Check ~boot/isolinux/isolinux.cfg~ from ISO + #+BEGIN_EXAMPLE + UI vesamenu.c32 + PROMPT 0 + TIMEOUT 100 + ONTIMEOUT linux + + MENU TABMSG Press ENTER to boot or TAB to edit a menu entry + MENU AUTOBOOT BIOS default device boot in # second{,s}... + MENU BACKGROUND splash.png + MENU WIDTH 78 + MENU MARGIN 1 + MENU ROWS 4 + MENU VSHIFT 2 + MENU TIMEOUTROW 8 + MENU TABMSGROW 2 + MENU CMDLINEROW 11 + MENU HELPMSGROW 16 + MENU HELPMSGENDROW 29 + + MENU COLOR title * #FF5255FF * + MENU COLOR border * #00000000 #00000000 none + MENU COLOR sel * #ffffffff #FF5255FF * + + LABEL linux + MENU LABEL Void Linux 5.3.9_1 x86_64-musl + KERNEL /LiveOS/vmlinuz + APPEND initrd=/LiveOS/initrd root=live:CDLABEL=VOID_LIVE init=/sbin/init ro rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 vconsole.unicode=1 vconsole.keymap=dvorak-programmer locale.LANG=en_US.UTF-8 rd.live.overlay.overlayfs=1 + LABEL linuxram + MENU LABEL Void Linux 5.3.9_1 x86_64-musl (RAM) + KERNEL /LiveOS/vmlinuz + APPEND initrd=/LiveOS/initrd root=live:CDLABEL=VOID_LIVE init=/sbin/init ro rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 vconsole.unicode=1 vconsole.keymap=dvorak-programmer locale.LANG=en_US.UTF-8 rd.live.overlay.overlayfs=1 rd.live.ram + LABEL c + MENU LABEL Boot first HD found by BIOS + COM32 chain.c32 + APPEND hd0 + #+END_EXAMPLE + Minimal ~VOID_LIVE/syslinux/syslinux.cfg~ + #+BEGIN_EXAMPLE + PROMPT 1 + TIMEOUT 50 + DEFAULT voidram + + LABEL void + LINUX ../LiveOS/vmlinuz + APPEND initrd=/LiveOS/initrd root=live:CDLABEL=VOID_LIVE init=/sbin/init ro rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 vconsole.unicode=1 vconsole.keymap=dvorak-programmer locale.LANG=en_US.UTF-8 rd.live.overlay.overlayfs=1 + INITRD ../LiveOS/initrd + + LABEL voidram + LINUX ../LiveOS/vmlinuz + APPEND initrd=/LiveOS/initrd root=live:CDLABEL=VOID_LIVE init=/sbin/init ro rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 vconsole.unicode=1 vconsole.keymap=dvorak-programmer locale.LANG=en_US.UTF-8 rd.live.overlay.overlayfs=1 rd.live.ram + INITRD ../LiveOS/initrd + #+END_EXAMPLE + +* Create FAT32 Partitionless Void Linux Live USB + +** Download void-live ISO and bootloaders + - [[https://voidlinux.org/download/][void-live]], I use ~void-live-x86_64-musl-20191109.iso~ + - [[https://www.rodsbooks.com/refind/][rEFInd]], I use ~refind~ the void package + - [[https://wiki.syslinux.org/wiki/index.php?title=Download][syslinux]], I use ~syslinux~ the void package + +** Create the FAT32 filesystem and label it + Assume the USB Stick we are going to create LiveOS is ~/dev/sdc~ + #+BEGIN_SRC sh + sudo mkfs.vfat -I -F32 /dev/sdc + sudo fatlabel /dev/sdc VOID_LIVE + mkdir VOID_LIVE + sudo mount /dev/sdc VOID_LIVE + #+END_SRC + +** Grab files from void-live ISO + Assume we are using ~void-live-x86_64-musl-20191109.iso~ + #+BEGIN_SRC sh + mkdir void-live-x86_64-musl-20191109 + sudo mount void-live-x86_64-musl-20191109.iso void-live-x86_64-musl-20191109 + sudo mkdir VOID_LIVE/LiveOS + sudo cp void-live-x86_64-musl-20191109/boot/{initrd,vmlinuz} VOID_LIVE/LiveOS + ## Optionally grab splash.png + sudo mkdir VOID_LIVE/syslinux + sudo cp void-live-x86_64-musl-20191109/boot/isolinux/splash.png VOID_LIVE/syslinux + #+END_SRC + +** rEFInd for UEFI + #+BEGIN_SRC sh + sudo xbps-install -S refind + sudo mkdir VOID_LIVE/EFI/refind + sudo cp -r /usr/share/refind/icons VOID_LIVE/EFI/refind/ + sudo cp /usr/share/refind/refind_x64.efi VOID_LIVE/EFI/refind/ + sudo cp VOID_LIVE/EFI/{refind/refind_x64.efi,BOOT/BOOTX64.efi} + ## Optionall get https://github.com/munlik/refind-theme-regular + ## And put it under VOID_LIVE/EFI/refind/themes/ + sudo vim VOID_LIVE/refind/refind.conf + sudo cp VOID_LIVE/{refind,BOOT}/refind.conf + #+END_SRC + +** syslinux for Legacy BIOS + #+BEGIN_SRC sh + sudo xbps-install -S syslinux + sudo mkdir VOID_LIVE/syslinux + sudo cp /usr/lib/syslinux/{chain,libcom32,libutil,vesamenu}.c32 VOID_LIVE/syslinux + sudo vim VOID_LIVE/syslinux/syslinux.cfg + sudo umount VOID_LIVE + sudo syslinux --directory syslinux --install /dev/sdc + #+END_SRC + +* Footnotes + +[fn:1] [[https://github.com/void-linux/void-mklive][void-mklive]] + +[fn:2] [[https://unix.stackexchange.com/a/103568][For Legacy BIOS, Using a filesystem without a partition table thus not only saves space, but also a step in the boot process.]] diff --git a/posts/index.org b/posts/index.org @@ -1,5 +1,7 @@ #+TITLE: Blog Index #+META_TYPE: website #+DESCRIPTION: Dash Eclipse's Personal Blog +- [[file:fat32-partitionless-voidlinux-liveusb.org][FAT32 Partitionless Void Linux Live USB]] + #+html: <p class='pubdate'>by Dash Eclipse on Jul 10, 2020.</p> - [[file:pgp.org][OpenPGP Key Generation and Usage]] #+html: <p class='pubdate'>by Dash Eclipse on Jun 30, 2020.</p> \ No newline at end of file diff --git a/posts/pgp.org b/posts/pgp.org @@ -1,9 +1,9 @@ #+TITLE: OpenPGP Key Generation and Usage #+AUTHOR: Dash Eclipse #+DATE: [2020-06-30 Tue] -#+email: dash@ezup.dev #+KEYWORDS: openpgp, pgp, gnupg, gpg, subkey #+DESCRIPTION: How do I generate OpenPGP keys and use it +#+OPTIONS: toc:nil In this article I'm gonna explain how do I generate and use OpenPGP keys. diff --git a/posts/rss.org b/posts/rss.org @@ -1,8 +1,14 @@ #+TITLE: Dash Eclipse's Blog | ezup.dev +* FAT32 Partitionless Void Linux Live USB +:PROPERTIES: +:RSS_PERMALINK: fat32-partitionless-voidlinux-liveusb.html +:PUBDATE: 2020-07-10 +:ID: B63039DB-9E4B-45DD-81D4-05F1E27E0AC1 +:END: * OpenPGP Key Generation and Usage :PROPERTIES: :RSS_PERMALINK: pgp.html :PUBDATE: 2020-06-30 -:ID: D1E13727-186F-460A-908C-1537350AE54B +:ID: B48C23A2-CD30-40C6-95DD-36B66FFDAACB :END: diff --git a/publish.el b/publish.el @@ -145,7 +145,7 @@ PROJECT is the current project." :base-directory "posts" :recursive t ;;:section-numbers nil - :with-toc nil + ;;:with-toc nil :base-extension "org" :exclude "rss.org\\|index.org" ;:exclude ,(regexp-opt '("rss.org" "index.org")) diff --git a/styles/site.css b/styles/site.css @@ -45,6 +45,9 @@ body { font-size: 18px; } } +div#text-table-of-contents ul li ul { + margin-top: 0.5em; +} p.subtitle { font-size: 17px; margin-top: 1em; @@ -126,7 +129,8 @@ body code { font-size: .9em; } body li { - margin-bottom: 1em; + margin-bottom: 0.6em; + line-height: 1; } body img { border: 1px solid #ccc;