vagrant icon indicating copy to clipboard operation
vagrant copied to clipboard

Problem with inline script command - difference with ":shell, :inline" and "vagrant ssh"

Open Wolvverine opened this issue 1 year ago • 0 comments
trafficstars

in vagrantfile:

SMBPASSWORD = "test"
test1.vm.provision :shell, :inline => "printf 'vagrant\n#{SMBPASSWORD}\n#{SMBPASSWORD}\n'"
test1.vm.provision :shell, :inline => "printf '%s\n' vagrant #{SMBPASSWORD} #{SMBPASSWORD}'"
test1.vm.provision :shell, :inline => "printf '%s\n' vagrant #{SMBPASSWORD} #{SMBPASSWORD} | passwd vagrant"
test1.vm.provision :shell, :inline => "printf \"vagrant\n#{SMBPASSWORD}\n#{SMBPASSWORD}\n\" | passwd vagrant"

when using "vagrant ssh" works without any problem, the test also shows that it correctly substitutes the variable.

Expected behavior

Correct command execution on linux.

Actual behavior

==> test1: Running provisioner: shell...
    test1: Running: inline script
    test1: New password: Retype new password: Sorry, passwords do not match.
    test1: passwd: Authentication token manipulation error
    test1: passwd: password unchanged
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Reproduction information

Vagrant version

Host operating system

Windows 10 with hyper-v

Guest operating system

ubuntu linux, mint linux,debian

Steps to reproduce

Above stated

Wolvverine avatar Jul 10 '24 20:07 Wolvverine