Hi,
While baking for *GCP* image, in my config.json I have a script which 
checks if the current kernel version is not the same as latest kernel 
version.
if the kernel version is old then I do a reboot of my packer node. below is 
the code for the reboot.










*latest_version=`rpm -qa kernel | sort -V| tail -1`latest_version=`echo 
$latest_version | sed 's/\(kernel-*\)/''/g'`current_version=`uname -r`if [[ 
$latest_version != $current_version ]]; then  DO_REBOOT=1fiif [ "$DO_REBOOT" 
-eq 1 ]; then  /sbin/rebootfi*



*But the packer is failing with the below error, not able to figure out what is 
the issue here, Any idea what might be the issue here ?*



*1575604931,,ui,message,    gcp: Complete!
1575604932,,ui,say,==> gcp: Provisioning with shell script: 
../../commonscripts/check_reboot.sh
1575604932,,ui,error,==> gcp: + DO_REBOOT=0
1575604932,,ui,error,==> gcp: + yum -y erase /opt/nvidia/cuda/bin/nvcc
1575604932,,ui,message,    gcp: Loaded plugins: fastestmirror
1575604932,,ui,error,==> gcp: No Match for argument: /opt/nvidia/cuda/bin/nvcc
1575604932,,ui,message,    gcp: No Packages marked for removal
1575604932,,ui,error,==> gcp: + [[ '' == Standard_NC* ]]
1575604932,,ui,error,==> gcp: + [[ '' == g2.* ]]
1575604932,,ui,error,==> gcp: ++ rpm -qa kernel
1575604932,,ui,error,==> gcp: ++ sort -V
1575604932,,ui,error,==> gcp: ++ tail -1
1575604932,,ui,error,==> gcp: + latest_version=kernel-3.10.0-862.el7.x86_64
1575604932,,ui,error,==> gcp: ++ echo kernel-3.10.0-862.el7.x86_64
1575604932,,ui,error,==> gcp: ++ sed 's/\(kernel-*\)//g'
1575604932,,ui,error,==> gcp: + latest_version=3.10.0-862.el7.x86_64
1575604932,,ui,error,==> gcp: ++ uname -r
1575604932,,ui,error,==> gcp: + current_version=3.10.0-862.14.4.el7.x86_64
1575604932,,ui,error,==> gcp: + [[ 3.10.0-862.el7.x86_64 != 
3.10.0-862.14.4.el7.x86_64 ]]
1575604932,,ui,error,==> gcp: + DO_REBOOT=1
1575604932,,ui,error,==> gcp: + '[' 1 -eq 1 ']'
1575604932,,ui,error,==> gcp: + /sbin/reboot
1575604933,,ui,say,==> gcp: Provisioning step had errors: Running the cleanup 
provisioner%!(PACKER_COMMA) if present...
1575604933,,ui,say,==> gcp: Deleting instance...
1575605107,,ui,message,    gcp: Instance has been deleted!
1575605107,,ui,say,==> gcp: Deleting disk...
1575605110,,ui,message,    gcp: Disk has been deleted!
1575605110,,ui,error,Build 'gcp' errored: Script disconnected unexpectedly. If 
you expected your script to disconnect%!(PACKER_COMMA) i.e. from a 
restart%!(PACKER_COMMA) you can try adding `"expect_disconnect": true` or 
`"valid_exit_codes": [0%!(PACKER_COMMA) 2300218]` to the shell provisioner 
parameters.
1575605110,,error-count,1
1575605110,,ui,error,\n==> Some builds didn't complete successfully and had 
errors:
1575605110,gcp,error,Script disconnected unexpectedly. If you expected your 
script to disconnect%!(PACKER_COMMA) i.e. from a restart%!(PACKER_COMMA) you 
can try adding `"expect_disconnect": true` or `"valid_exit_codes": 
[0%!(PACKER_COMMA) 2300218]` to the shell provisioner parameters.
1575605110,,ui,error,--> gcp: Script disconnected unexpectedly. If you expected 
your script to disconnect%!(PACKER_COMMA) i.e. from a restart%!(PACKER_COMMA) 
you can try adding `"expect_disconnect": true` or `"valid_exit_codes": 
[0%!(PACKER_COMMA) 2300218]` to the shell provisioner parameters.
1575605110,,ui,say,\n==> Builds finished but no artifacts were created.*



-- 
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/mitchellh/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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/8b016b9b-4088-4bb2-a37c-7bd3650d9494%40googlegroups.com.

Reply via email to