Repository navigation
Enabling SSH on engine OS 5.x
This documents the exact commands used to enable the built-in SSH server on the PRIME 4 firmware (build SNAPSHOT-20260703010257, version 5.0.3).
The PRIME 4 firmware already ships with OpenSSH:
- Binary:
/usr/sbin/sshd(907276 bytes) - Systemd units:
/usr/lib/systemd/system/sshd.serviceandsshdgenkeys.service - Config:
/etc/ssh/sshd_config(PermitRootLogin enabled, Port 22) - Host key:
/etc/ssh/ssh_host_ed25519_key(RSA key exists but is 0 bytes)
The only thing missing was a systemd symlink in multi-user.target.wants to actually start the service on boot.
cd go/
go build -o /tmp/az01-modify ./cmd/az01-modifycurl -s -L -o go/PRIME4-5.0.3-Update.img \
'https://public.inmusiccdn.com/Engine/5.0.3/RELEASE/9f45b416663af8a4/PRIME4-5.0.3-Update.img'/tmp/az01-modify parse go/PRIME4-5.0.3-Update.img
# Format: AZ01
# Size: 182187896 bytes (173.7 MB)
# Build ID: SNAPSHOT-20260703010257
# Description: Planck AZ01 Console upgrade Image
# Partitions (3):
# splash 4096000 none
# recoverysplash 4096000 none
# rootfs 173995472 xz
mkdir -p /tmp/fw-orig
/tmp/az01-modify extract --partition rootfs -o /tmp/fw-orig \
go/PRIME4-5.0.3-Update.img
# -> /tmp/fw-orig/rootfs.xz (515468288 bytes, decompressed)Note: The extension is
.xzbut the file is actually the decompressed ext2 image. The az01-modify tool decompresses during extraction.
The XZ-compressed block starts at offset 0x7D0194 in the original firmware image; that's where you'd splice the recompressed rootfs back in for a patch.
# Check sshd binary
debugfs -R "cat /usr/lib/systemd/system/sshd.service" /tmp/fw-orig/rootfs.xz 2>&1
# Check sshd_config (PermitRootLogin yes is already set)
debugfs -R "cat /etc/ssh/sshd_config" /tmp/fw-orig/rootfs.xz 2>&1
# PermitRootLogin yes
# Port 22
# Verify host key exists
debugfs -R "stat /etc/ssh/ssh_host_ed25519_key" /tmp/fw-orig/rootfs.xz 2>&1
# inode 1123, 513 bytes, type regular
# RSA key is empty (0 bytes) — only ed25519 is populated
debugfs -R "stat /etc/ssh/ssh_host_rsa_key.pub" /tmp/fw-orig/rootfs.xz 2>&1
# inode 1124, 577 bytes, type regularThe SSH server service exists but has no symlink in multi-user.target.wants, so sshd never starts on boot. We add one using debugfs -w.
Find the sshd.service inode:
debugfs -R "stat /usr/lib/systemd/system/sshd.service" /tmp/fw-orig/rootfs.xz 2>&1
# Inode: 2986 Type: regular Size: 356Verify it's NOT enabled (no sshd entry in the listing):
debugfs -R "ls /etc/systemd/system/multi-user.target.wants" /tmp/fw-orig/rootfs.xz 2>&1
# Contains: avahi-daemon, az01-script-runner, az01-usbsata-fixer, ...
# (no sshd.service)Create the symlink using debugfs ln -s command:
echo "ln -s /usr/lib/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service" \
| debugfs -w /tmp/fw-orig/rootfs.xz 2>&1
# Symlink created successfullyVerify the symlink:
debugfs -R "ls /etc/systemd/system/multi-user.target.wants" /tmp/fw-orig/rootfs.xz 2>&1
# (now includes sshd.service)
debugfs -R "stat /etc/systemd/system/multi-user.target.wants/sshd.service" /tmp/fw-orig/rootfs.xz 2>&1
# Type: symlink, Mode: 0777, Flags: 0x0, inode 7584# Recompress the modified rootfs with xz
cd /tmp
xz -9e /tmp/fw-orig/rootfs.xz
# -> /tmp/fw-orig/rootfs.xz.xz (168526712 bytes)
# Create manifest for repack
cat > /tmp/repack.json <<'EOF'
{
"header_path": "/home/icedream/Documents/Source/Git/github.com/icedream/denon-prime4/go/PRIME4-5.0.3-Update.img",
"partitions": [
{
"name": "splash",
"data_path": "/home/icedream/Documents/Source/Git/github.com/icedream/denon-prime4/go/splash.ext2",
"compression": "none",
"hash_algo": "sha1",
"flags": 1
},
{
"name": "recoverysplash",
"data_path": "/home/icedream/Documents/Source/Git/github.com/icedream/denon-prime4/go/recoverysplash.ext2",
"compression": "none",
"hash_algo": "sha1",
"flags": 1
},
{
"name": "rootfs",
"data_path": "/tmp/fw-orig/rootfs.xz.xz",
"compression": "xz",
"hash_algo": "sha1",
"flags": 1
}
]
}
EOF
# Rebuild (need splash and recoverysplash from the original firmware)
/tmp/az01-modify extract --partition splash -o go /home/icedream/Documents/Source/Git/github.com/icedream/denon-prime4/go/PRIME4-5.0.3-Update.img
/tmp/az01-modify extract --partition recoverysplash -o go /home/icedream/Documents/Source/Git/github.com/icedream/denon-prime4/go/PRIME4-5.0.3-Update.img
# Repack
cd go
go run build_image.go --original go/PRIME4-5.0.3-Update.img \
--rootfs /tmp/fw-orig/rootfs.xz.xz \
--output go/PRIME4-5.0.3-SSH-Update.img/tmp/az01-modify parse go/PRIME4-5.0.3-SSH-Update.img
# Format: AZ01
# Size: 176719132 bytes (168.5 MB)
# Build ID: SNAPSHOT-20260703010257
# Partitions (3):
# splash 4096000 none 151e36b2...
# recoverysplash 4096000 none a312316e...
# rootfs 168526712 xz e6d69412... ← different hash than originalThe splash/recoverysplash SHA1s match the original, confirming we preserved those partitions, while the rootfs hash changed — confirming the modification landed.
cd go
go build -o updater ./cmd/updater
./updater --libusb_debug 2
# The updater uses libusb to communicate with the PRIME 4 in fastboot mode| Action | Command |
|---|---|
| Parse firmware | az01-modify parse firmware.img |
| Extract rootfs | az01-modify extract --partition rootfs -o /tmp firmware.img |
| Check sshd service file | debugfs -R "cat /usr/lib/systemd/system/sshd.service" rootfs.xz |
| Enable SSH service | `echo "ln -s /usr/lib/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service" |
| Verify symlink | debugfs -R "ls /etc/systemd/system/multi-user.target.wants" rootfs.xz |
| Recompress rootfs | xz -9e rootfs.xz |
| Rebuild image |
go run build_image.go with manifest |
| Flash |
./updater (libusb, fastboot mode) |
For repeated use, wrap it into a shell script that:
- Fetches the latest firmware (from the OTA XML)
- Parses/extracts the rootfs
- Patches the symlink via debugfs
- Re-compresses and repacks
- Invokes the Go updater to flash
The core patch step is a single debugfs command and can be parameterized (different service file path, different symlink target) for other modifications.