ubuntu-janitor
Skill4 starsChanged 5 months agoMITView on GitHub
Remotely maintains and upgrades Ubuntu systems via SSH. Handles apt updates, upgrades, kernel patches, and safe reboots across multiple nodes. Use when you need to synchronize OS versions or apply security patches to a fleet of Ubuntu servers.
In this repository9 other files it gives its agents.
- agent-cprSkill
- anti-sycophancySkill
- cve-remediationSkill
- discord-coordinationSkill
- gui-test-leaseSkill
- infisical-proSkill
- microk8s-janitorSkill
- nats-coordinationSkill
- rasp-pi-janitorSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 2 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
Verification: Verify SSH connectivity and sudo privileges on all nodes.
- Very specific: line 24
Update Check: Run sudo apt-get update to refresh package lists.
- Very specific: line 26
Reboot Status: Check if a reboot is already pending (/var/run/reboot-required).
- Very specific: line 27
Disk Space: Verify sufficient disk space in / and /boot.
- Very specific: line 40
If /var/run/reboot-required exists or a kernel was updated, initiate sudo reboot.
- Distinctive: line 41
Wait for the node to become reachable again via SSH.
- Distinctive: line 42
Mandatory Health Check: Verify system health (uptime, essential services like microk8s/docker, and disk space).
- Very specific: line 50
When managing systemd services in a user scope (--user) over SSH, native credential loading via LoadCredentialEncrypted often fails with …
- Very specific: line 54
Manual Decrypt: Use ExecStartPre to decrypt the secret manually using systemd-creds decrypt.
- Very specific: line 55
Ephemeral Storage: Write the decrypted value to a temporary, RAM-backed environment file (e.g., in /run/user/UID/ or a dedicated runtime …
- Very specific: line 56
Environment Injection: Use EnvironmentFile= to load the variables from the temporary file.
- Very specific: line 68
Kernel Checks: Always check for reboot-required after a dist-upgrade.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Ubuntu Janitor
This skill automates the maintenance of Ubuntu servers, focusing on safe package updates and system reboots.
Prerequisites
- SSH access to the target nodes.
- Passwordless
sudoor SSH key-based authentication for the user. - Target systems must be running Ubuntu/Debian-based distributions.
Core Workflows
1. Host Discovery & Connectivity
- Input: Accept a list of hostnames, IPs, or a CIDR range.
- Verification: Verify SSH connectivity and
sudoprivileges on all nodes. - OS Check: Confirm the OS is Ubuntu/Debian.
2. Audit & Pre-flight
- Update Check: Run
sudo apt-get updateto refresh package lists. - Pending Updates: Identify packages that will be upgraded or installed.
- Reboot Status: Check if a reboot is already pending (
/var/run/reboot-required). - Disk Space: Verify sufficient disk space in
/and/boot.
3. Execution (The Maintenance Window)
For each node (or in parallel if requested):
- Package Upgrade:
sudo apt-get updatesudo apt-get upgrade -ysudo apt-get dist-upgrade -y(optional, for kernel/major updates)
- Cleanup:
sudo apt-get autoremove -ysudo apt-get clean
- Reboot Management:
- If
/var/run/reboot-requiredexists or a kernel was updated, initiatesudo reboot. - Wait for the node to become reachable again via SSH.
- Mandatory Health Check: Verify system health (uptime, essential services like microk8s/docker, and disk space).
- If
4. Verification
- Confirm all nodes are on the latest available versions.
- Report any nodes that failed to update or reboot.
User-Scope Systemd Secrets
When managing systemd services in a user scope (--user) over SSH, native credential loading via LoadCredentialEncrypted often fails with "State not recoverable" due to Polkit/session isolation.
The Decryption-Bridge Pattern
To reliably inject encrypted secrets into user services:
- Manual Decrypt: Use
ExecStartPreto decrypt the secret manually usingsystemd-creds decrypt. - Ephemeral Storage: Write the decrypted value to a temporary, RAM-backed environment file (e.g., in
/run/user/UID/or a dedicated runtime directory). - Environment Injection: Use
EnvironmentFile=to load the variables from the temporary file.
Example:
[Service]
ExecStartPre=/usr/bin/sh -c 'systemd-creds decrypt /path/to/secret.cred > /path/to/runtime/env'
EnvironmentFile=/path/to/runtime/env
ExecStart=/usr/bin/your-appBest Practices
- Sequential Updates: For clusters (like K8s), update nodes one at a time.
- Kernel Checks: Always check for
reboot-requiredafter adist-upgrade. - Locking: Be aware of
flockoraptlocks; wait or report if the frontend is locked.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

