"vagrant halt" not working

432 views
Skip to first unread message

Stever

unread,
Oct 10, 2010, 1:21:38 PM10/10/10
to Vagrant
I created my own vm (CentOS 5.5). Whenever I try to do a "vagrant
halt" within this vm, I get the following error:
> steve@steve-laptop:~/vagrant$ vagrant halt
> [default] Attempting graceful shutdown of linux...
> =====================================================================
> Vagrant experienced an error!
>
> The following SSH command responded with a non-zero exit status.
> Vagrant assumes that this means the command failed!
>
> sudo halt
> =====================================================================

The command "vagrant ssh" works fine.

I traced through the code a bit. Seems the problem is occurring in the
vagrant/ssh.rb file. Specifically, with the line:
channel.exec(command) do |ch, success|
- which translates to -
channel.exec("sudo halt") do |ch, success|

The variable "success" reports "true". However, the exit status of the
ssh command is "1", not "0". When I checked the extended_data in:
channel.on_extended_data do |ch2, type, data|
block.call(ch2, :stderr, data)
end

the value for the "data" variable is simply "sudo". So when the ssh
command 'sudo halt' is executed the standard error message is just
"sudo"? Am I missing something?

Is there any areas where I can check what's going wrong?

Mitchell Hashimoto

unread,
Oct 10, 2010, 2:23:37 PM10/10/10
to vagra...@googlegroups.com
Hello,

Hm... so Vagrant assumes a command failed if the exit status is
non-zero, which is a fairly standard practice. I don't have enough
experience with CentOS to know whats going on, but I'll look into it.
Worse case scenario I may have to just add an option for Vagrantfiles
such as "config.vm.ignore_command_failures" or something :( Silly
CentOS.

Mitchell

Blake

unread,
Oct 10, 2010, 5:26:59 PM10/10/10
to vagra...@googlegroups.com
I don't have this issue with 5.4...

On Sunday, October 10, 2010, Mitchell Hashimoto

Stever

unread,
Oct 11, 2010, 2:29:43 PM10/11/10
to vagra...@googlegroups.com
> Hello,
>
> Hm... so Vagrant assumes a command failed if the exit status is
> non-zero, which is a fairly standard practice. I don't have enough
> experience with CentOS to know whats going on, but I'll look into it.
> Worse case scenario I may have to just add an option for Vagrantfiles
> such as "config.vm.ignore_command_failures" or something :( Silly
> CentOS.

No, it still doesn't halt. I went through the code to try to see the
specific error that was happening beyond the exit status being "1". I
tried to look at the :stderr message on the channel, but all it says is
"sudo". Weird.

Anyway, the error still might be due to me. I'll try CentOS 5.4 and also
ubuntu and see if it exhibits the same behavior. Let me do as much as I
can to minimize your work, as I know you probably have a ton more stuff to
do than my petty concerns.

Mitchell Hashimoto

unread,
Oct 11, 2010, 2:33:27 PM10/11/10
to vagra...@googlegroups.com
While I won't deny I've been busy, I don't mind at all helping you in
any way I can. Let me know if you have any trouble and I'll also try
to look into this from my end as well.

Mitchell

Reply all
Reply to author
Forward
0 new messages