--- title: portablectl โ€” portable service management date: 2026-10-18 time: 12:00 model: admin category: programs author_type: human summary: Registers, applies, and removes systemd portable service images. Makes services movable like OCI images. tags: program, Service and process management, portablectl --- **๐Ÿ’ฌ "portablectl Command"** portablectl registers, applies, and removes systemd **Portable Service** images. It makes services portable like OCI images. It packages service binaries and dependencies into a single image. Services can be run without installation on the host. - **Concept**: Packages service binaries and dependencies into a single image. - **Key Features**: Services can be run without installation on the host. - **Advantages**: Supports AppImage, directory, and OCI container formats. - **Usage**: Separates the host and service systemd environments. ## Installation and Download portablectl is installed via a package manager or an official script. | Environment | Command | | --- | --- | | systemd built-in (239+) | portablectl --version | | Activation | sudo systemctl enable --now systemd-portabled | | Image Creation | Build with mkosi or ostree | | Verification | portablectl list | Verify the installation with `portablectl --version`. ## Common Options | Option | Description | | --- | --- | | portablectl attach | Register a portable service image | | portablectl detach | Remove an image | | portablectl list | List registered images | | portablectl inspect | Inspect the internal structure of an image | | portablectl remove | Delete the image file | ## 3 Essential Command Combinations - `portablectl attach myapp.raw` โ€” Register a service image - `systemctl enable --now myapp.service` โ€” Start the portable service - `portablectl detach myapp.raw` โ€” Complete removal **๐Ÿ’ฌ "Show me an example of using portablectl on a real server"** Here is a step-by-step guide for situations commonly encountered on real operational servers. ### Step 1 ยท Installation Check Check the status of systemd-portabled. ``` portablectl --version && systemctl status systemd-portabled ``` ### Step 2 ยท Image Inspection Inspect the internal structure of the image. ``` portablectl inspect /var/lib/portable/myapp.raw ``` ### Step 3 ยท Registration Register and start the image. ``` sudo portablectl attach /var/lib/portable/myapp.raw ``` ## Actual Execution Screen Result of registering a service image using portablectl. ![portablectl command execution result](https://games.aidebatehub.com/assets/portablectl-demo.png) Real operational server ## How It's Used in Practice ### 1. Registering a Service Image **Situation** โ€” Register a built image. ``` sudo portablectl attach /var/lib/portable/myapp.raw ``` **Result** โ€” The image is extracted to /var/lib/portables/. **Point** โ€” Does not modify host settings. ### 2. Starting the Service **Situation** โ€” Start the portable service. ``` systemctl enable --now myapp.service ``` **Result** โ€” A symlink is created in systemd. **Point** โ€” The portable service is also managed by the host systemd. ## Actual Execution Screen Result of starting and removing a portable service. ![portablectl command execution result 2](https://games.aidebatehub.com/assets/portablectl-demo2.png) Real operational server ## Points to Note - Portable services require systemd 239 or later. They do not function on older versions. - Images must be built with mkosi or ostree. Directories created simply with tar are not recognized. - Portable services also use the host kernel. Kernel module dependencies are not included in the image. --- Source (HTML): https://games.aidebatehub.com/programs/linux/services/portablectl.html This file is an auto-generated Markdown twin of the DevHub document.