Prevents "host identification changed" SSH warnings across A/B partition switches.
This package uses bind mounts to make persistent copies of identity files appear in their expected system locations.
On first boot, the service:
- Generates SSH host keys if they don't exist
- Copies these files to
/home/.persistent-identity/ - Bind mounts the persistent copies over the system locations
- On subsequent boots or partition switches, restores from persistent storage
If installed after first boot, existing identity files are saved to persistent storage.
Important: Persistent storage always takes precedence. If identity files exist in both locations, the persistent version overwrites the local version to maintain consistency across partitions.
This ensures SSH host keys remain constant across A/B partition switches, while allowing each partition's other configurations to differ.
This package persists only system identity - five specific files and nothing else.
The package persists these files to /home/.persistent-identity/:
/etc/ssh/ssh_host_ecdsa_keyand.pub/etc/ssh/ssh_host_ed25519_keyand.pub
Note: RSA keys are not managed by this utility as they are deprecated in modern SSH.
A bind mount makes a file or directory from one location appear at another location.
Example: bind mount persistent SSH key over system location
mount --bind /home/.persistent-identity/etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_keyNow /etc/ssh/ssh_host_rsa_key shows the contents of /home/.persistent-identity/etc/ssh/ssh_host_rsa_key. Any changes to either path affect the same underlying file.
For WLAN Pi's A/B partition system, bind mounts provide:
- Simplicity: Direct file replacement with no layering complexity.
- Explicit behavior: What you see is exactly what's in persistent storage.
- Independence: Each partition's configs remain separate, only identity files are shared by this package.
- Performance and low overhead: Bind mounts have lower overhead than overlays because they're a simple VFS redirection rather than a union filesystem with merge logic and copy-on-write operations.
- Standard practice: Bind mounts are commonly used for individual file persistence in A/B partition systems.
The service runs very early in the boot process:
- After
local-fs.targetto ensure /home is mounted - After
expand-home-partition.serviceto ensure /home is expanded and mounted - Before
shutdown.targetto ensure clean shutdown handling - In
sysinit.targetwithDefaultDependencies=nofor early boot execution
Service status:
systemctl status wlanpi-persistent-identity.serviceBind mounts:
mount | grep /etcCheck persistent storage:
ls -la /home/.persistent-identity/etc/ssh/View logs:
# System journal
journalctl -u wlanpi-persistent-identity.service
# Persistent log file
cat /var/log/wlanpi-persistent-identity.logIs /home mounted?
mountpoint /homeProbably means bind mounts didn't work.
# Are bind mounts active?
mount | grep /etc/ssh
# Does persistent storage exist?
ls -la /home/.persistent-identity/etc/ssh/
# Service status and logs
systemctl status wlanpi-persistent-identity.service
journalctl -u wlanpi-persistent-identity.service -bMaybe the persistent storage has different keys than expected.
# Compare fingerprints
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
ssh-keygen -lf /home/.persistent-identity/etc/ssh/ssh_host_ed25519_key.pubfindmnt --list | grep /etc