portablectl — portable service management
💬 "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 <image> | Register a portable service image |
| portablectl detach <image> | Remove an image |
| portablectl list | List registered images |
| portablectl inspect <image> | Inspect the internal structure of an image |
| portablectl remove <image> | Delete the image file |
3 Essential Command Combinations
portablectl attach myapp.raw— Register a service imagesystemctl enable --now myapp.service— Start the portable serviceportablectl 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
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
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.
AI Knowledge Hub
Visitor Comments