A postmarketOS project, which develops a Linux distribution for mobile devices, has announced the creation of an atomically updatable version of the distribution. The new edition, called Duranium, is notable for delivering the system as a single entity, without splitting it into separate packages. It is noted that the new version adheres to the idea that the device should simply work, without the user needing to know about the existence of a terminal or decipher the intricacies of the system.
The system environment in the /usr section is mounted in read-only mode using the EROFS file system and is verified at each boot by a digital signature. The /usr partition has a size of 5GB. Data integrity in the /usr section is monitored using dm-verity, and if any modification of the contents is detected, the boot is blocked. A verification hash is embedded in the unified UKI (Unified Kernel Image), which combines the handler for loading the kernel from UEFI (UEFI boot stub), the Linux kernel image, and the initrd system environment loaded into memory, used for initial initialization before mounting the root file system. The UKI image is formatted as a single executable file in PE format and is called by the UEFI bootloader.
All other directories, except for /usr, are part of the root partition, which is writable and retains data between reboots and updates. The contents of the root partition must be encrypted using LUKS2, which raises hardware requirements. The encrypted root file system is created during the first boot or after a factory reset. By default, an empty key is created that allows for the automatic unlocking of the encrypted partition. In the initial setup wizard and in the configurator, the user is prompted to set a password for decryption.
Default settings are stored within the system image in the /usr/share/factory/etc directory. During the first boot, symbolic links to all files in /usr/share/factory/etc are created in the /etc directory, except for the files passwd, group, shadow, fstab, machine-id, and hostname. If there is a need to modify settings during operation, the symbolic link is replaced with a copy of the file.
A frissítések az egész rendszerkép cseréjével kerülnek telepítésre. A tárolón két azonos gyökérpartíció jön létre - aktív és passzív. Az új frissítés a passzív partícióba települ, anélkül, hogy befolyásolná az aktív működését. Miután a telepített frissítés helyességét ellenőrizték és a rendszer sikeresen újraindult, a partíciók felcserélődnek - a frissítéssel rendelkező partíció aktívvá válik, míg a korábbi aktív partíció passzív módba kerül, várva a következő frissítés telepítésére. Ha frissítés után problémák merülnek fel a betöltéssel, automatikus visszaállás történik a korábbi rendszerverzióra.
Ez a megközelítés jelentősen megkönnyíti a hibák hibakeresését és diagnosztizálását, mivel a fejlesztők pontosan reprodukálhatják azt az állapotot, amikor a hiba bekövetkezett, anélkül, hogy a felhasználói rendszer összetevőit külön csomagok szintjén kellene újraalkotniuk, figyelembe véve a csomagok verzióinak kombinációit. A hátránya a magasabb hardverigény, ami megakadályozza a Duranium használatát az összes postmarketOS által támogatott eszközön.
A Duranium rendszerkép tartalma a postmarketOS egységes csomagbázisából képződik, amely az Alpine Linux-ra alapozva, a Musl szabványos C könyvtárat és a BusyBox utilitásokat tartalmazza. A postmarketOS és a Duranium kiadások szinte azonos összetételűek, de eltérnek a rendszer szállításának módjában. A rendszerképek kialakításához, telepítéséhez és frissítéséhez a systemd-sysupdate, systemd-repart és systemd-verity-setup összetevőket használják.
További alkalmazások Flatpak formátumban vagy a Coldbrew csomagkezelő használatával telepíthetők. A Coldbrew lehetővé teszi a csomagok telepítését az Alpine Linux tárolóiból a felhasználó otthoni könyvtárába. Futatáskor az ilyen csomagok a bubblewrap eszközkészletével elkülönítve futnak.
Forrás: opennet.ru
