Drewsif / PiShrink

Make your pi images smaller!
MIT License
3.51k stars 645 forks source link

Fixed ssh host keys not regenerating #244

Closed shatteredsword closed 2 years ago

shatteredsword commented 2 years ago

When using the -p option, the ssh host keys would be deleted, but not regenerated, rendering ssh unusable. fixes #168

gromain commented 2 years ago

Thanks for fixing the issue! @Drewsif can you please merge this?

slowrunner commented 2 years ago

Trying to use this pull request version of PiShrink for a custom distribution of "ROS2 Humble Hawksbill on Ubuntu 22.04 Server LTS (64-bit) for the GoPiGo3 robot", but get error regenerate_ssh_host_key.service not found.

I see that service in raspberrypi-sys-mods on git, but do not know how to install it to my (headless) Ubuntu 22.04 system before the shrink.

@shatteredsword Any tips?

P.S. Weird - using Raspberry Pi Imager on Mac OS (with the image created with pull request #244 version) using the Imager Settings option "+allow ssh, +password auth" checked created a microSD card that allowed ssh connection! So perhaps I do not need the regenerate_ssh_host_key.service.

shatteredsword commented 2 years ago

Trying to use this pull request version of PiShrink for a custom distribution of "ROS2 Humble Hawksbill on Ubuntu 22.04 Server LTS (64-bit) for the GoPiGo3 robot", but get error regenerate_ssh_host_key.service not found.

I see that service in raspberrypi-sys-mods on git, but do not know how to install it to my (headless) Ubuntu 22.04 system before the shrink.

@shatteredsword Any tips?

P.S. Weird - using Raspberry Pi Imager on Mac OS (with the image created with pull request #244 version) using the Imager Settings option "+allow ssh, +password auth" checked created a microSD card that allowed ssh connection! So perhaps I do not need the regenerate_ssh_host_key.service.

I might have to re-do this pull request to accommodate other distros. That service just calls this script which actually disables the service that called it as the last line