<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/rss/pretty-feed-v3.xsl" type="text/xsl"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Wind_Mask&apos;s blog</title><description>Welcome to Wind_Mask&apos;s blog!</description><link>https://blog.wind-mask.com/</link><item><title>arch chaos</title><link>https://blog.wind-mask.com/blog/arch%E4%B9%8B%E4%B9%B1/en/</link><guid isPermaLink="true">https://blog.wind-mask.com/blog/arch%E4%B9%8B%E4%B9%B1/en/</guid><description>The crazy way of installing Arch some time ago</description><pubDate>Tue, 23 Jan 2024 00:00:00 GMT</pubDate><content:encoded>&lt;ul&gt;
&lt;li&gt;&lt;em&gt;本文由 LLM (DeepSeek) 自动翻译生成，仅供参考。
如有错误或不准确之处，请以原文为准。&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Translated by LLM (DeepSeek) automatically, for reference only.
Please refer to the original text for accuracy.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Origin&lt;/h2&gt;
&lt;p&gt;Anyway, installing a physical Linux system is always a rite of passage in the coding community... However, I am quite risk‑averse. I kept putting it off until my portable hard drive had no stable power source other than a computer (previously, plugging it into the router’s junk box always caused it to disconnect). So what else could I do with that hard drive? I just threw some random system onto it.&lt;/p&gt;
&lt;p&gt;This article is not a serious tutorial; it’s a record of my chaotic dance during the installation.
Proper tutorials will be listed in the references.&lt;/p&gt;
&lt;p&gt;Note the timeliness of this article – I was driven crazy by the timestamps of forum posts when I was installing.&lt;/p&gt;
&lt;h2&gt;Preparation&lt;/h2&gt;
&lt;p&gt;Source of everything: &lt;a href=&quot;https://archlinux.org/download/&quot;&gt;arch download&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The canon: &lt;a href=&quot;https://wiki.archlinux.org/&quot;&gt;arch wiki&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Magic: I can’t imagine how much effort a magical Ethernet cable saved me. There’s no guarantee that the wireless card would work out of the box, not to mention stability and speed. More importantly, how could various proxy setups compare to a default transparent proxy? Even if you know all kinds of mirrors and proxy software, you’d still need to set environment variable proxies and individual configurations for each app...&lt;/p&gt;
&lt;h2&gt;Getting Started&lt;/h2&gt;
&lt;p&gt;Now, let the chaos begin. First, I didn’t want to burn a USB boot device. I just couldn’t find my USB stick at the time – a portable hard drive would have worked, but since I was going to install the system on it anyway, I figured I might as well boot directly into it.
I couldn’t be bothered with VMware either, so I dug out Hyper‑V on Windows and gave it a try.
Just boot the Arch ISO with Hyper‑V, remember to pass through the target disk, and most other VMs should support this too.&lt;/p&gt;
&lt;p&gt;The advantage is that you don’t need a real USB boot drive. In fact, I even booted Arch inside the VM and could later boot it on bare metal (though with plenty of hardware issues – it was mainly for initial debugging) ...&lt;/p&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;I mainly followed the &lt;a href=&quot;https://arch.icekylin.online/&quot;&gt;archlinux concise guide&lt;/a&gt; – basically just tweaking miscellaneous settings, partitioning the disk, and mounting things properly. If you want encryption, you have to do it at this stage. Linux isn’t like Windows where you can casually enable BitLocker and still have decryption; I used btrfs and later realised there was no way to encrypt it at runtime, so I skipped it.
After that, I disabled Secure Boot, changed the boot entry in BIOS, and I was in Arch.&lt;/p&gt;
&lt;p&gt;But such a system is not enough. A GUI is optional, but with modern laptops having dual graphics and an external monitor – NVIDIA Optimus or whatever – it’s a mess. First off, I never relied on optimus‑manager. Fiddling around with it is annoying; fortunately, ASUS has a good &lt;a href=&quot;https://asus-linux.org/&quot;&gt;asus-linux&lt;/a&gt; that manages GPUs well. I also recommend &lt;a href=&quot;https://github.com/ventureoo/nvidia-tweaks&quot;&gt;nvidia-tweaks&lt;/a&gt; – it sets up everything for NVIDIA so you don’t have to worry. Then just use prime‑run for NVIDIA apps; the integrated GPU works fine for daily tasks (though I was eventually forced to bypass the dGPU for the external monitor).&lt;/p&gt;
&lt;p&gt;Secure Boot is mandatory on Windows 11 – Windows Hello and BitLocker need it, so I couldn’t avoid it. But setting up hooks and signing things manually, with updates to worry about, was too much of a hassle. So I tried &lt;a href=&quot;https://github.com/Foxboron/sbctl&quot;&gt;sbctl&lt;/a&gt;. It depends on BIOS implementation – it worked on my machine.&lt;/p&gt;
&lt;h2&gt;Troubleshooting&lt;/h2&gt;
&lt;p&gt;From the start, the dual‑GPU + external monitor setup caused all kinds of weird issues – nobody cares about this scenario anyway.&lt;/p&gt;
&lt;p&gt;Initially, connecting the external monitor via a USB‑C DisplayPort directly to the dGPU was fine. Switching the BIOS to integrated graphics would kill the external monitor – expected, because I knew that particular USB‑C port is directly wired to the dGPU. But in hybrid mode, a bug appeared: the external monitor dropped to 36 FPS – it seemed like the output had to go through the CPU or iGPU copy. After thinking it over, I just switched to dGPU‑only mode. Fine, since I’m plugged into power anyway.&lt;/p&gt;
&lt;p&gt;Then, a few days later, after an update to either the NVIDIA driver or the Linux kernel, the desktop in dGPU‑only mode failed to render completely – I was stuck in TTY. After hours of debugging, it dawned on me: the other USB‑C port is connected to the iGPU! So I plugged the external monitor into that port, and suddenly both iGPU‑only and hybrid modes worked (the external monitor was smooth again). I didn’t bother testing dGPU‑only.&lt;/p&gt;
&lt;p&gt;Hardware acceleration is still a pain – Intel’s works well enough.&lt;/p&gt;
&lt;h2&gt;Migration&lt;/h2&gt;
&lt;p&gt;It’s impossible to seriously use a system installed on a portable hard drive over USB – the speed is abysmal. My NVMe SSD can read at 3000 MB/s, but over USB it barely reaches 20‑30 MB/s. That’s not a viable system.&lt;/p&gt;
&lt;p&gt;So I transferred the root filesystem to the internal drive – there was plenty of free space anyway. This also prompted me to reorganise my internal disks and decrypt unnecessary BitLocker partitions (for file sharing between the two systems).&lt;/p&gt;
&lt;p&gt;I freed up 142 GB on one of the internal SSDs. Since Arch was installed on btrfs, I used the snapshot send feature to send the root subvolume to the new location, then updated the UUID in fstab.&lt;/p&gt;
&lt;p&gt;I also created a new ESP partition on the internal drive. Of course, with TPM + Secure Boot, changing the boot partition or EFI file would trigger BitLocker recovery.&lt;/p&gt;
&lt;h2&gt;Snapshots&lt;/h2&gt;
&lt;p&gt;Yes, I use Timeshift (though it has saved my bacon only a few times – installing often destroys /boot, which snapshots can’t fix).
A minor bug (at least until a few weeks ago): even after specifying the subvolume layout, snapshots wouldn’t work. The fix was to use UUID instead of device paths in fstab. I don’t know if that’s still the case.&lt;/p&gt;
&lt;h2&gt;Hibernate&lt;/h2&gt;
&lt;p&gt;I actually dreamed of being able to hibernate both Windows and Arch simultaneously. &lt;s&gt;I almost succeeded, but NVIDIA issues and some weirdness during Windows hibernation were beyond me.&lt;/s&gt;&lt;/p&gt;
&lt;p&gt;Now I’ve made it work – most of the time, at least! Both systems can hibernate independently, and the switching speed rivals a VM.&lt;/p&gt;
&lt;p&gt;&lt;s&gt;Currently, the conclusion is that it’s generally safe to hibernate Windows and boot Arch (which is already better than common wisdom). As for reading/writing an NTFS partition from Arch while Windows is hibernated… well, that happens to be my OneDrive folder – let it be.&lt;/s&gt;&lt;/p&gt;
&lt;h2&gt;Pacman &amp;amp; AUR Configuration&lt;/h2&gt;
&lt;p&gt;Everyone knows about mirrors, so I won’t elaborate – but speeding things up is still necessary.&lt;/p&gt;
&lt;p&gt;In &lt;code&gt;/etc/pacman.conf&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ParallelDownloads&lt;/code&gt;: enable parallel downloads.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In &lt;code&gt;/etc/makepkg.conf&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CFLAGS&lt;/code&gt;: change to &lt;code&gt;-march=native&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;MAKEFLAGS&lt;/code&gt;: change to &lt;code&gt;-j$(nproc)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Maintenance&lt;/h2&gt;
&lt;p&gt;I even wrote a pacman hook to update the package list after every installation.
&lt;s&gt;(yay is a pacman wrapper – you can use others.)&lt;/s&gt; Switched to paru – because Rust is the future.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;paru -Qqe &amp;gt; pkglist.txt  # list of all explicitly installed packages
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For a reinstall (which I will never allow!):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;paru -S --needed - &amp;lt; pkglist.txt
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;OCD commands:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;paru -c
yes | paru -Scc
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;dotfiles&lt;/h2&gt;
&lt;p&gt;I use &lt;a href=&quot;https://yadm.io/&quot;&gt;yadm&lt;/a&gt;, &lt;s&gt;with git-crypt encryption and a private repository – barely secure...&lt;/s&gt; Encryption is overkill – don’t bother.&lt;/p&gt;
&lt;p&gt;Fonts: Fonts expose everything. &lt;s&gt;Just steal &lt;code&gt;C:\Windows\Fonts&lt;/code&gt; from Windows.&lt;/s&gt; Get them from the AUR.&lt;/p&gt;
&lt;p&gt;Forcing Wayland: Even now, it still needs some configuration. &lt;s&gt;It’s far from “default works” – I have:&lt;/s&gt; It’s good enough now.&lt;/p&gt;
&lt;h2&gt;hyprland (legacy)&lt;/h2&gt;
&lt;p&gt;It’s a bit annoying but actually usable – it can coexist with KDE without problems. However, the official version doesn’t support NVIDIA – use it as long as you can.
The configuration is messy – if you like it, tinker; if not, grab a ready‑made config like &lt;a href=&quot;https://github.com/JaKooLit/Arch-Hyprland&quot;&gt;Arch-Hyprland&lt;/a&gt;, then pick up some dotfiles from GitHub.&lt;/p&gt;
&lt;h2&gt;Security&lt;/h2&gt;
&lt;p&gt;I can’t stand the feeling of insecurity – call it paranoia. So I decided to re‑create the root partition with full encryption.&lt;/p&gt;
&lt;p&gt;You can’t encrypt in‑place. I transferred the entire &lt;code&gt;/&lt;/code&gt; to an external drive for storage. Ideally, you’d boot an ISO as if reinstalling, but no – I simply changed the kernel parameters and operated elsewhere. (But then I realised how annoying GRUB is! It loves to decide my root location…)&lt;/p&gt;
&lt;p&gt;So I realised that having a bootloader that insists on choosing my kernel parameters is frustrating. Enter &lt;code&gt;Unified kernel image&lt;/code&gt;. But I haven’t fully escaped yet – that shows the strange nature of people: &lt;s&gt;if there were no &lt;code&gt;grub-mkconfig&lt;/code&gt;, and you had to write the bootloader config manually, you’d tolerate it. But with it, seeing it decide my boot entries and kernel parameters makes me uneasy (though if no good alternative exists, I’d still end up modifying grub‑mkconfig scripts)&lt;/s&gt;.&lt;/p&gt;
&lt;p&gt;Solution: &lt;a href=&quot;https://github.com/Limine-Bootloader/Limine&quot;&gt;Limine&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;b2sum verification of UKI&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Modified Limine source to embed public keys and verify its configuration with signatures (instead of just the built‑in enroll‑config)&lt;/p&gt;
&lt;p&gt;This avoids Secure Boot / TPM triggering after kernel updates.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Remaining&lt;/h3&gt;
&lt;p&gt;Security is a chain – here’s a brief summary:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Secure Boot&lt;/p&gt;
&lt;p&gt;Same as sbctl: sign the bootloader and UKI (the bootloader is extra attack surface anyway – UKI can boot directly, but I still want to choose Windows).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Full Disk Encryption&lt;/p&gt;
&lt;p&gt;Add TPM for TPM+PIN disk decryption (imitating BitLocker). The default PCR 7 measurement is fine. Also add a physical FIDO2 key + PIN for high security, plus a recovery key.&lt;/p&gt;
&lt;p&gt;Partition layout remains the same: a 100+ GB encrypted block containing a btrfs filesystem with &lt;code&gt;@&lt;/code&gt; and &lt;code&gt;@home&lt;/code&gt; subvolumes. Behind that, a swap block (previously a swap partition), now also LUKS‑encrypted, containing a swap partition – and I still need hibernation, otherwise a random key would suffice.&lt;/p&gt;
&lt;p&gt;After comparing, systemd’s initramfs is more powerful, so I replaced mkinitcpio hooks (see &lt;a href=&quot;https://wiki.archlinux.org/title/Dm-crypt/System_configuration#mkinitcpio&quot;&gt;dm-crypt/System configuration - ArchWiki&lt;/a&gt;). The root must be decrypted inside initramfs. According to the wiki, &lt;code&gt;crypttab.initramfs&lt;/code&gt; and &lt;code&gt;rd.luks&lt;/code&gt; both work, but I could only make it work with &lt;code&gt;rd.luks&lt;/code&gt; kernel parameters – not sure why.&lt;/p&gt;
&lt;p&gt;For swap – if you don’t need resume, you can decrypt it after boot. But for resume, it must be in initramfs. Solution: pass &lt;code&gt;rd.luks&lt;/code&gt; again, but I didn’t want to enter two passwords, nor use the same key. I chose chained unlocking: store the swap partition’s keyfile inside the root filesystem. This means decrypting sequentially in initramfs – surprisingly, it works: &lt;code&gt;rd.luks.key=SWAP-UUID=/@/keyfilepath:/dev/mapper/root&lt;/code&gt; – a horrible syntax.&lt;/p&gt;
&lt;p&gt;One discovery: &lt;code&gt;rd.luks&lt;/code&gt; added for root doesn’t need the &lt;code&gt;tpm&lt;/code&gt; option to use TPM – if a TPM key exists, it will try it. My option only had FIDO2 – without the token, it falls back to TPM automatically, even though the option didn’t specify TPM.&lt;/p&gt;
&lt;p&gt;Then I extracted all kernel parameters to pass to UKI generation. mkinitcpio generates the UKI, and I sign it with sbctl.&lt;/p&gt;
&lt;p&gt;This way, kernel images and microcode no longer reside in &lt;code&gt;/boot&lt;/code&gt;. I modified &lt;code&gt;linux.preset&lt;/code&gt; to move &lt;code&gt;ALL_kver&lt;/code&gt; and &lt;code&gt;ALL_microcode&lt;/code&gt; into encrypted directories.&lt;/p&gt;
&lt;p&gt;GRUB could no longer detect boot entries, so I manually added the UKI entry (chain‑loading) to &lt;code&gt;/etc/grub.d/40_custom&lt;/code&gt; (changing its priority to be low enough).&lt;/p&gt;
&lt;p&gt;Now Windows can’t directly access the Arch system (WinBtrfs used to work) – great, so secure! ... Not really. (But WSL can still unlock LUKS.)&lt;/p&gt;
&lt;p&gt;This makes the Linux boot chain reasonably reliable.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Beautification&lt;/h2&gt;
&lt;p&gt;I added Plymouth and set &lt;code&gt;loglevel&lt;/code&gt;, &lt;code&gt;quiet&lt;/code&gt; – no more staring at a black screen during boot.&lt;/p&gt;
&lt;h2&gt;Rescue&lt;/h2&gt;
&lt;p&gt;Well, today it broke.&lt;/p&gt;
&lt;p&gt;After a few days, when I booted, the system wouldn’t start. The kernel image had no decryption hooks? I was sure the hook configuration was correct last time I generated it. Anyway, it broke and I had to recover.&lt;/p&gt;
&lt;p&gt;As noted above, my root is encrypted – but I had a recovery key. I dug up my offline storage (took a while to find where I put it), decrypted multiple layers, and finally got the key. Burned an Arch ISO to a USB, disabled Secure Boot, booted, manually decrypted the root (btrfs requires mounting subvolumes separately), &lt;code&gt;arch‑chroot&lt;/code&gt;ed in, fixed the hook configuration, regenerated the image – done.&lt;/p&gt;
&lt;p&gt;This accident proved that my recovery design works and the security is acceptable. Strangely, re‑enabling Secure Boot (which should irrevocably change PCR values) didn’t trigger TPM (but I also have a PIN, so it’s not fatal) – weird.&lt;/p&gt;
&lt;h2&gt;New Thoughts&lt;/h2&gt;
&lt;p&gt;I’ve been tinkering recently. First, every WM’s compositor has its quirks. NVIDIA + Wayland is a disaster – maybe KWin is the real deal.&lt;/p&gt;
&lt;p&gt;For full‑disk encryption, I removed kernel parameters and moved everything into &lt;code&gt;/etc/crypttab.initramfs&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Swap is now a swapfile – one less encrypted partition.&lt;/p&gt;
&lt;p&gt;&lt;s&gt;&lt;code&gt;nwg-shell&lt;/code&gt; components are usable – use them for notifications and status bar, although for the bar &lt;code&gt;waybar&lt;/code&gt; is still fine.&lt;/s&gt;&lt;/p&gt;
&lt;p&gt;Switched to &lt;a href=&quot;https://danklinux.com/&quot;&gt;dms-shell&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Display manager: &lt;a href=&quot;https://github.com/fairyglade/ly&quot;&gt;ly&lt;/a&gt; – simple and lightweight, written in Zig.&lt;/p&gt;
&lt;p&gt;I also tried &lt;code&gt;niri&lt;/code&gt; for a while – &lt;s&gt;tiling logic is a bit confusing, not as mature as hyprland.&lt;/s&gt; I think I’ve figured it out.&lt;/p&gt;
&lt;p&gt;&lt;s&gt;Also strongly recommend the catppuccin theme – great for us code monkeys without design taste.&lt;/s&gt;&lt;/p&gt;
&lt;p&gt;Using &lt;a href=&quot;https://github.com/dylanaraps/matugen&quot;&gt;matugen&lt;/a&gt; to auto‑generate colour themes from wallpapers.&lt;/p&gt;
&lt;p&gt;Wallpapers: &lt;a href=&quot;https://codeberg.org/LGFae/awww&quot;&gt;awww&lt;/a&gt; plus custom scripts for rotation.&lt;/p&gt;
&lt;h2&gt;Virtual Machines&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;virt-manager&lt;/code&gt; runs Windows. This has allowed me to completely replace – well, not completely yet.&lt;/p&gt;
&lt;h2&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://arch.icekylin.online/&quot;&gt;archlinux concise guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://wiki.archlinux.org/&quot;&gt;arch wiki&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://asus-linux.org/&quot;&gt;asus-linux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://sspai.com/post/78916&quot;&gt;Modern Arch Linux Installation: Btrfs, Snapshots, Hibernation, and More&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://archlinuxstudio.github.io/ArchLinuxTutorial/#/&quot;&gt;Arch Linux Installation and Usage Tutorial - ArchTutorial - Arch Linux Studio&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content:encoded><category>Arch</category><category>Linux</category></item></channel></rss>