vagrant up with custom config.ssh.shell fails

133 views
Skip to first unread message

Ujwal Komarla

unread,
Mar 10, 2019, 12:30:28 AM3/10/19
to Vagrant
I have a Custom Network OS(EXOS) Vagrant Box with the following Vagrantfile built-in the box with bash.py.
The vagrant up fails with SSH command returning non-zero exit status - full log obtained with debug mode - I, see '/bin/sh' not found in log.
However, when I ssh into the switch as 'Vagrant' user, the following works fine -
  1. run script bash.py
  2. mkdir -p /usr/local/cfg/vagrant
What am I missing with the 'config.ssh.shell' configuration?

Brian Cain

unread,
Mar 11, 2019, 12:18:16 PM3/11/19
to vagra...@googlegroups.com
Hey there,

I don't see where you are seeing '/bin/sh' not found. It looks like your script is failing because the folder
you are trying to create probably already exists from your synced folder option.

config.vm.synced_folder ".", "/usr/local/cfg/vagrant", disabled: false
This will create that folder already on your guest, so I'm guessing running mkdir is failing because the folder already exists.

--
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/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/9e45f8aa-3776-465b-9ca6-a5aab2301214%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Brian Cain

Ujwal Komarla

unread,
Mar 12, 2019, 3:04:55 PM3/12/19
to Vagrant
I think, I read this log message wrong.

DEBUG ssh: stderr: 41e57d38-b4f7-4e46-9c38-13873d338b86-vagrant-ssh
DEBUG ssh: stderr: /bin/sh:
DEBUG ssh: stderr: id: not found
DEBUG ssh: stderr:
INFO ssh: Execute: id -u vagrant (sudo=false)


I'm certain the folder doesn't  exist. Also, I confirmed that 'mkdir -p' return 0 when the folder already exists.


Only the Vagrantfile packed into the vagrant box file has this line.

config.vm.synced_folder ".", "/usr/local/cfg/vagrant", disabled: false

The Vagrantfile I am using to bring the VMs up doesn't have any 'synced_folder' setting.

Brian Cain

unread,
Mar 12, 2019, 7:20:26 PM3/12/19
to vagra...@googlegroups.com
Are you using the Vagrant box "centos/7"? I noticed in the debug output it says that it doesn't have guest additions installed.

I get a different error about Vagrant failing to properly mount the share folder, but I am wondering if switching to a different box
that has proper guest additions installed will fix your issue. Perhaps try "bento/centos-7" instead?


For more options, visit https://groups.google.com/d/optout.


--
Brian Cain

Ujwal Komarla

unread,
Mar 12, 2019, 10:58:45 PM3/12/19
to Vagrant
No.

It is a Network OS from Extreme Networks, called EXOS, and limits what I can do with it.
So, it doesn't have guest additions installed. I think, it will be a work item for the future.

My main concern was that, I didn't have the config.ssh.shell properly configured, more than the synced folder issue.

Instead of testing for synced folder, I should try something simpler - like a shell provision.

Ujwal Komarla

unread,
Mar 12, 2019, 11:36:01 PM3/12/19
to Vagrant
Well! I just tried with the following
  config.vm.provision "shell", inline: "echo hello"
And it fails - log here.

The first error comes from a `chown -R /tmp/vagrant-shell'. It retries creating /tmp, uploads the inline script to VM and execute it - when it fails again.

I have two questions:
  • Is the folder that Vagrant uses to upload files i.e., '/tmp' configurable?
    EXOS 'jails' the user and exposes limited number of user directories to work with.
  • When the log says uploading as below, is it doing an scp?
         DEBUG ssh: Uploading: /var/folders/py/znngg9_x643gmt1thx5g08q4vvypnx/T/vagrant-shell20190312-8359-138g02q.ps1 to /tmp/vagrant-shell
    If so, we can skip over the guest additions missing issue.
    Also, scp is hacked to allow upload of files only in certain places!


Brian Cain

unread,
Mar 13, 2019, 12:27:32 PM3/13/19
to vagra...@googlegroups.com
Ahh ok, well this makes more sense as to why things are failing.

Vagrant expects that certain things will be usable in a Vagrant box, as well as the `vagrant` user having certain kinds of permissions:


If Vagrant can't scp files or make directories in certain places then you'll get the kinds of failures you shared earlier. If you can give the
vagrant user permission to do those things on the box then it should work. Otherwise there's not much we can do, especially if the OS
has a lot of restrictions like what you mentioned.


For more options, visit https://groups.google.com/d/optout.


--
Brian Cain

Ujwal Komarla

unread,
Mar 13, 2019, 1:05:47 PM3/13/19
to Vagrant
Brian,

Understood. Unfortunately, that is not something I can change.

I just tried the 'file' provisioner, that works alright :)

I think, a better solution would be to use the 'ansible' provisioner, which is in development.

Appreciate your help and time!

Ujwal
Reply all
Reply to author
Forward
0 new messages