obsidianctl is a command-line utility designed to manage A/B boot slots and shared partitions on ObsidianOS systems. It provides functionalities for system installation, status monitoring, active slot switching, and updating system images.
status: Display current active A/B slot and detailed system information in a neofetch-like format.install: Partition a target device and install a SquashFS system image onto both A and B slots, setting up shared/etc,/var, and/homepartitions, and configuring UEFI boot entries.switch: Change the active boot slot (A or B) for the next boot, persistently.update: Update a specific A/B slot with a new SquashFS system image.sync: Clone the current slot's root and ESP partitions to the other slot usingdd.backup-slot: Create a compressed backup of a specific slot with metadata.rollback-slot: Restore a slot from a previous backup.health-check: Comprehensive health assessment of both A/B slots.verify-integrity: Verify filesystem integrity and check for corrupted files.
obsidianctl is in the AUR as obsidianctl and obsidianctl-git. You can install it as follows:
yay -S obsidianctlyay -S obsidianctl-gitOr with your favorite AUR helper.
obsidianctl requires root privileges to operate. It relies on several standard Linux utilities. Ensure the following commands are available on your system:
efibootmgrsfdiskpartprobeudevadmmkfs.fatmkfs.ext4unsquashfs(fromsquashfs-tools)rsyncdde2labelblkidarch-chroot(if you choose to chroot during installation)lsblkhostnamectllscpufree
The obsidianctl tool source code is modularized into several Python files and can be built into a single executable script using make.
- Clone the repository and
cdinto it. - Run the
makecommand to build the merged executable:This will create a single executable file namedmake
obsidianctlin the current directory. - (Optional) Run the
make installcommand as root to install the merged executable. It will install to/usr/local/sbin.
You can run the obsidianctl script directly. Remember to run it with sudo as all commands other than obsidianctl status require root privileges.
sudo ./obsidianctl [command] [options]Displays the currently active A/B slot and various system details. This command does not require root.
./obsidianctl statusPartitions the specified device and installs the SquashFS system image. WARNING: This will erase all data on the target device.
<device>: The target block device (e.g.,/dev/sda).<system_sfs>: Path to the SquashFS system image file (e.g.,/path/to/obsidianos.sfs). Defaults to/etc/system.sfs
sudo ./obsidianctl install /dev/sda /path/to/your_system.sfsSwitches the active boot slot to either 'a' or 'b' for the next boot, persistently.
<slot>: The slot to make active (aorb).
sudo ./obsidianctl switch aSwitches the active boot slot to either 'a' or 'b' once only.
<slot>: The slot to make active for once (aorb).
sudo ./obsidianctl switch-once aUpdates a specific A/B slot with a new SquashFS system image. WARNING: This will erase all data on the specified slot.
<slot>: The slot to update (aorb).<system_sfs>: Path to the new SquashFS system image file.
sudo ./obsidianctl update b /path/to/new_system_image.sfsClones the currently running slot to the specified slot. This is a block-level copy using dd. It copies both the root and ESP partitions. WARNING: This will erase all data on the specified slot.
<slot>: The slot to sync to (aorb).
sudo ./obsidianctl sync bEnters into a slot without rebooting. Uses arch-chroot.
<slot>: The slot to chroot into (aorb).--enable-networking: Enables networking features.--mount-essentials: Mounts /proc, /sys and /dev.--mount-home: Mounts /home.--mount-root: Mounts /root.
sudo ./obsidianctl enter-slot b --enable-networking --mount-homeCreates a compressed backup of a specific slot with metadata.
<slot>: The slot to backup (aorb).--backup-dir: Directory to store backups (default:/var/backups/obsidianctl/slot_X).--device: Drive (not partition) to backup (default: current drive).--full-backup: Backup your ENTIRE SYSTEM. (EXPERIMENTAL. USE AT YOUR OWN RISK.)
sudo ./obsidianctl backup-slot a --backup-dir /mnt/external/backupsRestores a slot from a previous backup.
<slot>: The slot to restore (aorb).<backup_path>: Path to the backup file (.sfs).--device: Drive (not partition) to rollback (default: current drive).
sudo ./obsidianctl rollback-slot a /var/backups/obsidianctl/slot_a/slot_a_backup_20250823_143022.sfsPerforms a comprehensive health assessment of both A/B slots.
sudo ./obsidianctl health-checkVerifies filesystem integrity and checks for corrupted files in a specific slot.
<slot>: The slot to verify (aorb).
sudo ./obsidianctl verify-integrity aSwitches the default kernel that systemd-boot will use. This affects both slots unless a specific slot is provided.
<kernel_name>: The name of the kernel to switch to (e.g.,aorb).--device <device>: The target block device (e.g.,/dev/sda). If not specified, the primary disk will be used.--slot <slot>: The slot to modify (aorb). If not specified, both slots will be modified.
sudo ./obsidianctl switch-kernel a
sudo ./obsidianctl switch-kernel b --slot bManages ObsidianOS extensions. Extensions are SquashFS images that can be mounted as overlays.
Adds an ObsidianOS extension.
<path>: Path to the.obsiextfile.
sudo ./obsidianctl ext add /path/to/my_extension.obsiextRemoves an ObsidianOS extension.
<name>: Name of the extension to remove.
sudo ./obsidianctl ext rm my_extensionLists installed ObsidianOS extensions.
sudo ./obsidianctl ext listEnables ObsidianOS Overlays on boot. (Not implemented yet)
sudo ./obsidianctl ext enableDisables ObsidianOS Overlays on boot. (Not implemented yet)
sudo ./obsidianctl ext disableThe obsidianctl project is organized into a modules directory and a main obsidianctl file.
modules/utils.py: Contains common utility functions likerun_command,get_current_slot, and_get_part_path. It also holds all necessaryimportstatements for the entire script.modules/status.py: Implements thehandle_statuscommand logic.modules/install.py: Implements thehandle_installcommand logic.modules/switch.py: Implements thehandle_switchcommand logic.modules/update.py: Implements thehandle_updatecommand logic.modules/sync.py: Implements thehandle_synccommand logic.modules/dualboot.py: Handles dualbooting logic.modules/enter.py: Implements entering slots.modules/backup.py: Handles slot backup and rollback operations.modules/health.py: Implements health checks and integrity verification.main: Contains the main argument parsing logic and calls the appropriate handler functions.Makefile: Orchestrates the concatenation of these files into a single executable script, ensuring proper shebang and import placement.