Open markdryan opened 6 years ago
I'm having the same issue, this is the output of my /var/lib/cloud/aws-user-data
file:
#cloud-config
package_upgrade: false
packages:
- wget
runcmd:
- [ wget, "https://raw.githubusercontent.com/electrocucaracha/dlrs/master/postinstall.sh", -O, "/tmp/postinstall.sh" ]
- [ sudo, chmod, "+x", "/tmp/postinstall.sh" ]
- [ DLRS_TYPE=pytorch-oss, bash, "/tmp/postinstall.sh" ]
And the output in the journalctl is:
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: Successfully installed 1 bundle
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: [12.205854] Executing handler for block "runcmd"
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: [12.205859] runcmd: runcmd handler running...
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: [12.205869] lib: Executing: /bin/sh -c "DLRS_TYPE=pytorch-oss bash /tmp/postinstall.sh "
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: [12.208210] lib: Command failed
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: [12.208222] lib: STD Error: bash: /tmp/postinstall.sh: No such file or directory
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: [12.208225] lib: STD output:
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: [12.208228] runcmd: Execute command failed
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: [12.208238] lib: Executing: /bin/sh -c "sudo chmod +x /tmp/postinstall.sh "
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c sudo[806]: pam_unix(sudo:account): expired password for user root (root enforced)
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c sudo[806]: root : Account or password is expired, reset your password and try again ; TTY=unknown ; PWD=/ ; USER=root ; COMMAND=
/usr/bin/chmod +x /tmp/postinstall.sh
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c sudo[806]: pam_warn(sudo:chauthtok): function=[pam_sm_chauthtok] flags=0x4020 service=[sudo] terminal=[] user=[root] ruser=[root] rh
ost=[<unknown>]
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c sudo[806]: root : unable to change expired password: Authentication token manipulation error ; TTY=unknown ; PWD=/ ; USER=root ;
COMMAND=/usr/bin/chmod +x /tmp/postinstall.sh
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: [12.290418] lib: Command failed
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: [12.290432] lib: STD Error: sudo: Account or password is expired, reset your password and try again
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: sudo: unable to change expired password: Authentication token manipulation error
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: [12.290436] lib: STD output:
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: [12.290439] runcmd: Execute command failed
Jul 17 18:50:56 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: [12.290451] lib: Executing: /bin/sh -c "wget https://raw.githubusercontent.com/electrocucaracha/dlrs/master/postinstall.sh -O /tmp/postinstall
.sh "
Jul 17 18:50:57 clr-ec28044a3ae4cbd130a11a5fdd66cb3c ucd-aws[477]: [12.366846] lib: STD output:
Jul 17 18:50:57 clr-ec28044a3ae4cbd130a11a5fdd66cb3c systemd[1]: Started micro-config-drive job for AWS.
Maybe the runcmd_item function is inverting the order.
The issue is due to the cloud_config_simplify
function we run on the gnode
tree after it is complete.
This can be seen with the tests/runcmd.yaml file which contains the following contents.
Now look at the ouput of ucd. I also see this behaviour when ucd is running as part of the boot process.
Actually, it's not quite reverse order as it seems that the command not in flow form is executed first