Adjust SSH management.
Let's *disable* ssh.service to make sure it doesn't start too soon, and modify the rpi-generate-ssh-host-keys.service unit (that triggers the generation during the first boot) to enable+start ssh.service when everything is ready. See: https://salsa.debian.org/raspi-team/image-specs/-/issues/72
This commit is contained in:
parent
a9332126bb
commit
f14ea9817c
@ -12,13 +12,15 @@ toast_me() {
|
|||||||
chroot $MNT adduser pi sudo
|
chroot $MNT adduser pi sudo
|
||||||
chroot $MNT adduser pi plugdev
|
chroot $MNT adduser pi plugdev
|
||||||
echo "pi:raspberry" | chroot $MNT chpasswd
|
echo "pi:raspberry" | chroot $MNT chpasswd
|
||||||
# Force generate SSH host keys if they exist
|
# Let's make sure we don't ship any SSH host keys. Also work around upstream
|
||||||
|
# bug leading ssh.service to try and start before SSH host keys have been
|
||||||
|
# generated (https://salsa.debian.org/raspi-team/image-specs/-/issues/72):
|
||||||
|
# disable ssh.service here, and let the rpi-generate-ssh-host-keys.service
|
||||||
|
# enable+start it when everything is ready.
|
||||||
rm -f $MNT/etc/ssh/ssh_host_*
|
rm -f $MNT/etc/ssh/ssh_host_*
|
||||||
# Work around longstanding bug (ssh fails to start until host keys
|
chroot $MNT systemctl disable ssh.service
|
||||||
# have been generated on the target), until it's fixed upstream:
|
sed '/^ExecStart=/a ExecStart=/usr/bin/systemctl enable --now ssh.service' \
|
||||||
if ! grep -qs ^Before= $MNT/etc/systemd/system/rpi-generate-ssh-host-keys.service; then
|
-i $MNT/etc/systemd/system/rpi-generate-ssh-host-keys.service
|
||||||
sed '/^Description=/a Before=sshd.service' -i $MNT/etc/systemd/system/rpi-generate-ssh-host-keys.service
|
|
||||||
fi
|
|
||||||
# Change the hostname
|
# Change the hostname
|
||||||
echo "127.0.1.1 pirogue.local pirogue" >> $MNT/etc/hosts
|
echo "127.0.1.1 pirogue.local pirogue" >> $MNT/etc/hosts
|
||||||
echo "::1 pirogue.local pirogue" >> $MNT/etc/hosts
|
echo "::1 pirogue.local pirogue" >> $MNT/etc/hosts
|
||||||
|
Loading…
Reference in New Issue
Block a user