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.
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'. This change is persistent across reboots.
<slot>: The slot to make active (aorb).
sudo ./obsidianctl switch 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.sfsThe 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.obsidianctl: 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.