I have their weird issue with Packer. I need to reboot a linux instance after a OS update so I can boot into latest kernel and then after remove the old kernels. Packer seems to be getting hung-up on the reboot part. It issues the reboot and I get kicked from the instance but it never actually fully shuts down. Then after my pause it starts the next section but fails because it cant login due to it being in this shutdown state. Below is a section of my code.
{
“type”: “shell”,
“expect_disconnect”: true,
“skip_clean”: true,
“inline”: [
“echo ‘Rebooting Instance’”,
“sudo shutdown -r now”
]
},
{
“type”: “shell”,
“start_retry_timeout”: “5m”,
“pause_before”: “5m”,
“inline”: [
“echo ‘Removing Old Kernels’”,
“sudo /usr/bin/package-cleanup -y --oldkernels --count=1”
]
},
Ive played around with timings and even tried forceful reboot but no matter what I do I cant get it to reboot. If I login without packer connected it reboots fine. Any ideas?