Stack of 10
| 1/10 | To-upstream: Symlink in /etc/mkosi-manifest+1 | |
| 2/10 | Enable greeters, starting after first-boot-complete.target+4 -2 | |
| 3/10 | To-upstream: fixes for KDE profile+12 | |
| 4/10 | To-upstream: general fixes and improvements+36 | |
| 5/10 | To-upstream: fixes for Fedora+12 | |
| 6/10 | To-upstream: fixes for desktop profile+1 | |
| 7/10 | Enable SELinux (WIP)+65 | |
| 8/10 | Miscellaneous tweaks that I don't plan to upstream+15 | |
| 9/10 | Custom readme for my personal fork+53 -158 | |
| 10/10 | My customized ParticleOS configuration+339 -3 |
patchstack/customized main
My customized ParticleOS configuration
Patch does not have a description.
8 files changed+339 -3
.gitignore | 1 | |
README.md | 209 | |
mkosi.conf.d/fedora/mkosi.conf | 2 | |
mkosi.profiles/custom/mkosi.conf | 3 | |
- mkosi.profiles/custom/mkosi.postinst.d/wireshark.chroot | 4 | |
+ mkosi.profiles/selinux/mkosi.extra/etc/selinux/config | 2 | |
+ mkosi.profiles/selinux/mkosi.extra/etc/selinux/semanage.conf | 60 | |
+ mkosi.profiles/selinux/mkosi.extra/usr/lib/tmpfiles.d/selinux.conf | 3 |
.gitignore-1
@@ -8,6 +8,5 @@ 8 8mkosi.version 9 9.mkosi-private 10 10mkosi.packages/ 11 keys/ 12 11mkosi.profiles/custom/mkosi.extra/usr/local/bin/ 13 12versions/1
README.md+51 -158
@@ -1,160 +1,53 @@ 1 1# ParticleOS 2 2 3 ParticleOS is a fully customizable immutable distribution implementing the 4 concepts described in 5 [Fitting Everything Together](https://0pointer.net/blog/fitting-everything-together.html). 6 7 Note that ParticleOS is still in development, and we don't provide any backwards 8 compatibility guarantees at all. 9 10 The crucial difference that makes ParticleOS unique compared to other immutable 11 distributions is that users build the ParticleOS image themselves and sign it 12 with their own keys instead of installing vendor signed images. This allows 13 configuring the image to your liking by having full control over which 14 distribution is used as the base and which packages are installed into the 15 image. 16 17 The ParticleOS image is built using [mkosi](https://github.com/systemd/mkosi). 18 You will need to install the current main branch of mkosi to build current 19 ParticleOS images. 20 21 First, configure the variant you'd like to build in `mkosi.local.conf`. For a 22 desktop system, you'll want the `desktop` profile and either the `gnome` or the 23 `kde` profile. 24 25 ```conf 26 [Distribution] 27 Distribution=arch 28 29 [Config] 30 Profiles=desktop,kde 31 ``` 32 33 To build the image, run `mkosi -B -f` from the ParticleOS repository. Currently 34 `arch`, `fedora` and `debian` are supported distributions. Implementing support for a 35 new distribution (that's already supported in mkosi) is as simple as writing the 36 necessary config files to install the required packages for that distribution. 37 38 To update the system after installation, you clone the ParticleOS repository 39 or your fork of it, make sure `mkosi.local.conf` is configured to your liking and 40 run `mkosi -B -ff sysupdate -- update --reboot` which will update the system using 41 `systemd-sysupdate` and then reboot. 42 43 ## Using the OBS profile to fetch a newer systemd 44 45 Sometimes ParticleOS adopts systemd features as soon as they get merged into 46 systemd without waiting for an official release. That's why we recommend 47 enabling the `obs` profile to enable the systemd repositories on OBS 48 (https://software.opensuse.org//download.html?project=system%3Asystemd&package=systemd) 49 containing systemd packages which are built every day from systemd's git main 50 branch. 51 52 To enable the `obs` profile, add the following to `mkosi.local.conf`: 53 54 ```conf 55 [Config] 56 Profiles=obs 57 ``` 58 59 ## Building systemd from source 60 61 As an alternative to using the `obs` profile, you can build systemd from source: 62 63 ```sh 64 git clone https://github.com/systemd/systemd 65 cd systemd 66 mkosi -f sandbox -- meson setup build 67 mkosi -f sandbox -- meson compile -C build 68 mkosi -t none -f 69 ``` 70 71 Then write the following to `mkosi.local.conf` in the ParticleOS repository to 72 use the artifacts from the systemd repository built by mkosi in ParticleOS: 73 74 ```conf 75 [Content] 76 VolatilePackageDirectories=../systemd/build/mkosi.builddir/<distribution>~<release>~<arch> 77 78 [Build] 79 ExtraSearchPaths=../systemd/build 80 ``` 81 82 Make sure the distribution and release in `mkosi.local.conf` are identical in the 83 systemd checkout and the particleos checkout. 84 85 To build a newer systemd, run `git pull` in the systemd repository followed by 86 `mkosi -f sandbox -- meson compile -C build` and `mkosi -t none`. 87 88 ## Signing keys 89 90 ParticleOS images are signed for Secure Boot with the user's keys. To generate a new key, 91 run `mkosi genkey`. The key must be stored safely, it will be required to sign updates. 92 93 The key can be stored in a smartcard. Then you have to set the key in `mkosi.local.conf`: 94 95 ``` 96 [Validation] 97 SecureBootKey=pkcs11:object=Private key 1;type=private 98 SecureBootKeySource=provider:pkcs11 99 SignExpectedPcrKey=pkcs11:object=Private key 1;type=private 100 SignExpectedPcrKeySource=provider:pkcs11 101 VerityKey=pkcs11:object=Private key 1;type=private 102 VerityKeySource=provider:pkcs11 103 ``` 104 105 ## Installation 106 107 Before installing ParticleOS, make sure that Secure Boot is in setup mode on the 108 target system. The Secure Boot mode can be configured in the UEFI firmware 109 interface of the target system. If there's an existing Linux installation on the 110 target system already, run `systemctl reboot --firmware-setup` to reboot into 111 the UEFI firmware interface. At the same time, make sure the UEFI firmware 112 interface is password protected so an attacker cannot just disable Secure Boot 113 again. 114 115 To install ParticleOS with a USB drive, first build the image on an existing 116 Linux system as described above. Then, burn it to the USB drive with 117 `mkosi burn /dev/<usb>`. Once burned to the USB drive, plug the USB drive into 118 the system onto which you'd like to install ParticleOS and boot into the USB 119 drive via the firmware. Then, boot into the "Installer" UKI profile. When you 120 end up in the root shell, run 121 `systemd-repart --dry-run=no --empty=force --defer-partitions=swap,root,home /dev/<drive>` 122 to install ParticleOS to the system's drive. Finally, reboot into the target 123 drive (not the USB) and the regular profile (not the installer one) to complete 124 the installation. 125 126 ## LUKS recovery key 127 128 systemd doesn't support adding a recovery key to a partition enrolled with a token 129 only (tpm/fido2). It is possible to use cryptenroll to add a recovery password 130 to the root partition: `cryptsetup luksAddKey --token-type systemd-tpm2 /dev/<id>` 131 132 ## Firmwares 133 134 Only firmwares that are dependencies of a kernel module are included, but some 135 modules don't declare their dependencies properly. Dependencies of a module can be 136 found with `modinfo`. If you experience missing firmwares, you should report 137 this to the module maintainer. `FirmwareInclude=` can be added in `mkosi.local.conf` 138 to include the firmware regardless of whether a module depends on it. 139 140 ## Configuring systemd-homed after installation 141 142 After installing ParticleOS and logging into your systemd-homed managed user, 143 run the following to configure systemd-homed for the best experience: 144 145 ```sh 146 homectl update \ 147 --auto-resize-mode=off \ 148 --disk-size=max \ 149 --luks-discard=on" 150 ``` 151 152 Disabling the auto resize mode avoids slow system boot and shutdown. Enabling 153 LUKS discard makes sure the home directory doesn't become inaccessible because 154 systemd-homed is unable to resize the home directory. 155 156 ## Default root password and user when booting in a virtual machine 157 158 If you boot ParticleOS in a virtual machine using `mkosi vm`, the root password 159 is automatically set to `particleos` and a default user `particleos` with password 160 `particleos` is created as well. 3[ParticleOS](https://github.com/systemd/particleos) is an extremely cool 4meta-distribution from the systemd project. It's my favorite thing in software 5since I discovered IPv6. Concretely, it's a configuration for systemd's 6[`mkosi` tool](https://mkosi.systemd.io/) that you use to build your own 7ParticleOS images. As described in the readme: 8 9> ParticleOS is a fully customizable immutable distribution implementing the 10concepts described in [Fitting Everything 11Together](https://0pointer.net/blog/fitting-everything-together.html). 12 13Among other things, it has the following characteristics: 14 15- OS versions are delivered as immutable `/usr` partitions 16 - A/B partitions for worry-free upgrades and rollbacks 17 - Block-level integrity provided by 18 [dm-verity](https://wiki.archlinux.org/title/Dm-verity) 19 - Authenticity provided by a signature on the dm-verity data, done with 20 your own keys 21- Is easily hacked on, just like traditional mutable OSes 22 - Essentially *is* a traditional OS (one of Arch, Debian, or Fedora), built 23 fully from regular distro packages 24 - Hacking on `/usr` is done at image build-time, rather than during OS 25 runtime 26- Is signed with your own SecureBoot keys 27- LUKS-encrypted root partition with TPM-stored key for automatic unlocking 28- LUKS-encrypted home directory managed by 29 [`systemd-homed`](https://systemd.io/HOME_DIRECTORY/) 30 31This here is my own customized version/soft fork of ParticleOS. It's the Fedora 32variant. 33 34## Notable files/directories 35 36- [makefile](makefile)—contains most important commands. `build` and 37 `sysupdate` targets are the main ones. is also responsible for downloading 38 miscellaneous unpackaged binaries. 39- [mkosi.local.conf](mkosi.local.conf)—the linchpin that holds the custom 40 configuration together. 41- [mkosi.profiles/custom](mkosi.profiles/custom)—the custom `mkosi` profile 42 where most of my customizations live. 43 - [mkosi.conf](mkosi.profiles/custom/mkosi.conf)—contains the 44 packages I want installed. 45 - [mkosi.extra](mkosi.profiles/custom/mkosi.extra)—additional files that 46 get included in the built images. 47 48## Other changes 49 50In addition to the above customizations, there are a number of other small 51tweaks I've made, mostly to get Fedora+KDE Plasma working together. Some of them 52should probably be upstreamed to the ParticleOS project. The overall patchset 53can be seen [here on Gitpatch](https://gitpatch.com/jcgl/particleos/patch/5).1
mkosi.conf.d/fedora/mkosi.conf+2
@@ -10,6 +10,8 @@ 10 10Packages= 11 11 bash-color-prompt 12 12 bpftool 13 # cryptsetup luksAddKey --token-type systemd-tpm2 /dev/<device> fails 14 # for me otherwise 13 15 cracklib-dicts 14 16 cryptsetup 15 17 distribution-gpg-keys1
mkosi.profiles/custom/mkosi.conf+2 -1
@@ -93,7 +93,7 @@ 93 93 opentofu 94 94 osc 95 95 # needed for bell fish function 96 oxygen-sounds 96 ocean-sound-theme 97 97 pre-commit 98 98 python3-neovim 99 99 nmap @@ -140,6 +140,7 @@ 140 140 wl-clipboard 141 141 wireshark 142 142 yubikey-manager 143 gnupg2-scdaemon 143 144 kernel 144 145 # repository directory comes from mkosi.packages 145 146 repository/opensnitch_ui.rpm1
mkosi.profiles/custom/mkosi.postinst.d/wireshark.chroot-4
@@ -1,4 +0,0 @@ 1 #!/usr/bin/sh 2 3 chmod 755 /usr/bin/dumpcap 4 setcap -r /usr/bin/dumpcap1
mkosi.profiles/selinux/mkosi.extra/etc/selinux/config+2
@@ -0,0 +1,2 @@ 1SELINUX=permissive 2SELINUXTYPE=targeted1
mkosi.profiles/selinux/mkosi.extra/etc/selinux/semanage.conf+60
@@ -0,0 +1,60 @@ 1# Authors: Jason Tang <jtang@tresys.com> 2# 3# Copyright (C) 2004-2005 Tresys Technology, LLC 4# 5# This library is free software; you can redistribute it and/or 6# modify it under the terms of the GNU Lesser General Public 7# License as published by the Free Software Foundation; either 8# version 2.1 of the License, or (at your option) any later version. 9# 10# This library is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13# Lesser General Public License for more details. 14# 15# You should have received a copy of the GNU Lesser General Public 16# License along with this library; if not, write to the Free Software 17# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18# 19# Specify how libsemanage will interact with a SELinux policy manager. 20# The four options are: 21# 22# "source" - libsemanage manipulates a source SELinux policy 23# "direct" - libsemanage will write directly to a module store. 24# /foo/bar - Write by way of a policy management server, whose 25# named socket is at /foo/bar. The path must begin 26# with a '/'. 27# foo.com:4242 - Establish a TCP connection to a remote policy 28# management server at foo.com. If there is a colon 29# then the remainder is interpreted as a port number; 30# otherwise default to port 4242. 31module-store = direct 32 33# When generating the final linked and expanded policy, by default 34# semanage will set the policy version to POLICYDB_VERSION_MAX, as 35# given in <sepol/policydb.h>. Change this setting if a different 36# version is necessary. 37#policy-version = 19 38 39# expand-check check neverallow rules when executing all semanage 40# commands. There might be a penalty in execution time if this 41# option is enabled. 42expand-check=0 43 44# usepasswd check tells semanage to scan all pass word records for home directories 45# and setup the labeling correctly. If this is turned off, SELinux will label only /home 46# and home directories of users with SELinux login mappings defined, see 47# semanage login -l for the list of such users. 48# If you want to use a different home directory, you will need to use semanage fcontext command. 49# For example, if you had home dirs in /althome directory you would have to execute 50# semanage fcontext -a -e /home /althome 51usepasswd=False 52bzip-small=true 53bzip-blocksize=5 54ignoredirs=/root;/bin;/boot;/dev;/etc;/lib;/lib64;/proc;/run;/sbin;/sys;/tmp;/usr;/var 55optimize-policy=true 56 57[sefcontext_compile] 58path = /usr/sbin/sefcontext_compile 59args = -r $@ 60[end]1
mkosi.profiles/selinux/mkosi.extra/usr/lib/tmpfiles.d/selinux.conf+3
@@ -0,0 +1,3 @@ 1L? /etc/selinux/targeted 2C /etc/selinux/config - - - - /usr/share/factory/etc/selinux/config 3C /etc/selinux/semanage.conf - - - - /usr/share/factory/etc/selinux/semanage.conf1
| jcgl updated patch to version 26 | ||
| jcgl updated patch to version 25 | ||
| jcgl updated patch to version 24 | ||
| jcgl updated patch to version 23 | ||
| jcgl updated patch to version 22 | ||
| jcgl updated patch to version 21 | ||
| jcgl updated patch to version 20 | ||
| jcgl updated patch to version 19 | ||
| jcgl updated patch to version 18 | ||
| jcgl updated patch to version 17 | ||
| jcgl updated patch to version 16 | ||
| jcgl updated patch to version 15 | ||
| jcgl updated patch to version 14 | ||
| jcgl updated patch to version 13 | ||
| jcgl updated patch to version 12 | ||
| jcgl updated patch to version 11 | ||
| jcgl updated patch to version 10 | ||
| jcgl updated patch to version 9 | ||
| jcgl updated patch to version 8 | ||
| jcgl updated patch to version 7 | ||
| jcgl updated patch to version 6 | ||
| jcgl updated patch to version 5 | ||
| jcgl updated patch to version 4 | ||
| jcgl updated patch to version 3 | ||
| jcgl updated patch to version 2 | ||
| jcgl created patch version 1 |