inline reboots with packer and linux redhat based

776 views
Skip to first unread message

trey perrone

unread,
May 19, 2020, 9:33:29 PM5/19/20
to Packer
Attempting to add an inline reboot command based on this https://discuss.hashicorp.com/t/best-practice-for-applying-updates-and-kernel-patches/3300/2 but playing around today to build new AWS AMIs, I seem to get errors. This is also sort of documented on packer.io https://www.packer.io/docs/provisioners/shell/#handling-reboots. I was trying to do inline to keep it simply

I am mainly trying to add the reboot as trying to get kernel and associated packages up to date prior to installing this awful Symantec Endpoint agent that was thrust upon me from above. It compiles some autoprotect feature based on the kernel, so want to update my kernel and associated pacakges first, inline reboot, then proceed with ansible playbooks that include the Symantec agent and thus at least i can ensure the base AMI kernel is functioning ok at build/install.

  • packer 1.5.5 is what I am currently using
  • I was testing redhat7 and centos7 today


{
     "type": "shell",
     "inline": "sudo reboot",
     "expect_disconnect": true,
     "pause_before": "30s",
     "timeout": "5m"
   },



Ive tried variations of commands
  • putting my inline in [ ] for array
  • sudo shutdown -now 
  • sudo /usr/sbin/reboot (or shutdown)
  • sudo systemctl reboot 
but packer always throws an error similar to 

amazon-ebs: /tmp/script_5489.sh: line 16: REBOOT: command not found
amazon
-ebs: /tmp/script_5489.sh: line 16: REBOOT: command not found

What am I overlooking in the docs here? 
 


Rickard von Essen

unread,
May 20, 2020, 5:02:45 AM5/20/20
to packe...@googlegroups.com
Looks like the word reboot got uppercased? 

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/41d9f7b5-d18c-4e76-9ae4-10beefe5001a%40googlegroups.com.

trey perrone

unread,
May 20, 2020, 9:35:06 AM5/20/20
to Packer
my commands are all lowercase as my samples show. when i saw the REBOOT error i tried other options with `shutdown` or even systemctl commands thinking it was something with the bash inline shell or even the example for direct path to /usr/sbin/{reboot..shutdown}

will have to play with amazon linux 2 (also rhel based) and also ubuntu 16 and see if its same issue.


On Wednesday, May 20, 2020 at 5:02:45 AM UTC-4, Rickard von Essen wrote:
Looks like the word reboot got uppercased? 

To unsubscribe from this group and stop receiving emails from it, send an email to packe...@googlegroups.com.

trey perrone

unread,
May 20, 2020, 4:03:43 PM5/20/20
to Packer
Whooopsie.

I had some echo shell inline commands in prior task for verbosity that got interpreted as an actual command.

self-sabotage achieved again.

thanks all.
Reply all
Reply to author
Forward
0 new messages