如何修复 vagrant provision 错误:内联脚本、ttyname 失败、inapp

如何修复 vagrant provision 错误:内联脚本、ttyname 失败、inapp

语境:尝试在全新安装的 Ubuntu 17.04 上设置 VM Ethereum 开发环境,并安装最新版本的 Vagrant 和 VirtualBox。更多详细信息请参见这里,但最近的尝试vagrant up失败了,其中最重要的错误似乎是:

There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "b5460c8c-142b-4dc8-a942-176aee800148", "--type", "headless"]

Stderr: VBoxManage: error: Could not open the medium'/home/james/VirtualBox VMs/james_default_1504917176677_87192/ubuntu-zesty-17.04-cloudimg.vmdk'.
VBoxManage: error: VMDK: inconsistency between grain table and backup grain table in '/home/james/VirtualBoxV Ms/james_default_1504917176677_87192/ubuntu-zesty-17.04-cloudimg.vmdk' (VERR_VD_VMDK_INVALID_HEADER).
VBoxManage: error: VD: error VERR_VD_VMDK_INVALID_HEADER opening image file '/home/james/VirtualBox VMs/james_default_1504917176677_87192/ubuntu-zesty-17.04-cloudimg.vmdk' (VERR_VD_VMDK_INVALID_HEADER)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MediumWrap, interface IMedium

或者更简洁地说,其中一个磁盘文件无法访问(这个:/home/james/VirtualBox VMs/james_default_1504917176677_87192/ubuntu-zesty-17.04-cloudimg.vmdk)。

更多详细信息/故障排除

$ vagrant -v
Vagrant 1.9.1

Vagrant up 失败,我无法再次运行它,它建议运行vagrant provision

james@james-Streacom:~$ vagrant provision
==> default: Running provisioner: shell...
default: Running: inline script
==> default: mesg: 
==> default: ttyname failed
==> default: : 
==> default: Inappropriate ioctl for device
==> default: WARNING: 
==> default: apt
==> default:  
==> default: does not have a stable CLI interface. 
==> default: Use with caution in scripts.
==> default: Get:1 http://security.ubuntu.com/ubuntu zesty-security InRelease [89.2 kB]
==> default: Hit:2 http://archive.ubuntu.com/ubuntu zesty InRelease
==> default: Get:3 http://archive.ubuntu.com/ubuntu zesty-updates InRelease [89.2 kB]
==> default: Get:4 http://archive.ubuntu.com/ubuntu zesty-backports InRelease [89.2 kB]
==> default: Fetched 268 kB in 16s (16.2 kB/s)
==> default: Reading package lists...
==> default: Building dependency tree...
==> default: Reading state information...
==> default: 5 packages can be upgraded. Run 'apt list --upgradable' to see them.
==> default: WARNING: 
==> default: apt
==> default:  
==> default: does not have a stable CLI interface. 
==> default: Use with caution in scripts.
==> default: Reading package lists...
==> default: Building dependency tree...
==> default: Reading state information...
==> default: g++ is already the newest version (4:6.3.0-2ubuntu1).
==> default: make is already the newest version (4.1-9.1).
==> default: python-minimal is already the newest version (2.7.13-2).
==> default: silversearcher-ag is already the newest version (1.0.2-2).
==> default: git is already the newest version (1:2.11.0-2ubuntu0.2).
==> default: 0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
==> default: --2017-09-09 02:53:39--  https://nodejs.org/dist/v8.3.0/node-v8.3.0-linux-x64.tar.xz
==> default: Resolving nodejs.org (nodejs.org)... 
==> default: 104.20.23.46
==> default: , 
==> default: 104.20.22.46
==> default: Connecting to nodejs.org (nodejs.org)|104.20.23.46|:443... 
==> default: connected.
==> default: HTTP request sent, awaiting response... 
==> default: 200 OK
==> default: Length: 
==> default: 11527336
==> default:  (11M)
==> default:  [application/x-xz]
==> default: Saving to: ‘node-v8.3.0-linux-x64.tar.xz.2’
==> default: 
==> default:      0K

接下来是许多表示加载状态的红线,然后是更多行文件和子文件夹:

  • 节点-v8.3.0-linux-x64/
  • 节点-v8.3.0-linux-x64/lib/
  • node-v8.3.0-linux-x64/lib/node_modules/
  • node-v8.3.0-linux-x64/lib/node_modules/npm/
  • 节点-v8.3.0-linux-x64/bin/
  • node-v8.3.0-linux-x64/CHANGELOG.md
  • node-v8.3.0-linux-x64/包含/
  • node-v8.3.0-linux-x64/包含/节点/
  • node-v8.3.0-linux-x64/包含/节点/libplatform/
  • node-v8.3.0-linux-x64/包含/节点/openssl/
  • node-v8.3.0-linux-x64/共享/

最后输出结果如下:

==> default: mv: 
==> default: cannot move 'node-v8.3.0-linux-x64/lib/node_modules' to '/usr/lib/node_modules'
==> default: : Directory not empty
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.

我考虑过删除/usr/lib/node_modules并再次运行vagrant provision,但我还没有这么做。相反,我尝试了vagrant reload

james@james-Streacom:~$ vagrant reload
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'ubuntu/zesty64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "b5460c8c-142b-4dc8-a942-176aee800148", "--type", "headless"]

Stderr: VBoxManage: error: Could not open the medium'/home/james/VirtualBox VMs/james_default_1504917176677_87192/ubuntu-zesty-17.04-cloudimg.vmdk'.
VBoxManage: error: VMDK: inconsistency between grain table and backup grain table in '/home/james/VirtualBoxV Ms/james_default_1504917176677_87192/ubuntu-zesty-17.04-cloudimg.vmdk' (VERR_VD_VMDK_INVALID_HEADER).
VBoxManage: error: VD: error VERR_VD_VMDK_INVALID_HEADER opening image file '/home/james/VirtualBox VMs/james_default_1504917176677_87192/ubuntu-zesty-17.04-cloudimg.vmdk' (VERR_VD_VMDK_INVALID_HEADER)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MediumWrap, interface IMedium

当我打开 Virtual Box 时收到错误消息:

一个或多个磁盘映像文件当前无法访问。因此,您将无法操作使用这些文件的虚拟机,直到它们稍后可以访问为止。按“检查”打开虚拟媒体管理器窗口并查看哪些文件无法访问,或按“忽略”忽略此消息。

有关的https://serverfault.com/questions/324271/virtualbox-grain-table-inconsistency#575058

我手动删除了文件应用程序中的文件夹:VirtualBox VM、.vagrant 和 .vagrantd,以及vagrantfile。然后,我运行vagrant init,将 编辑vagrantfile成这样这里,只不过是兴致勃勃而不是信任,然后跑了vagrant up

当前面提到的文件加载时(绿色),输出结束(红色):

==> default: cp: 
==> default: cannot stat '/vagrant/.tmux.conf'
==> default: : No such file or directory
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.

在此发帖:

https://groups.google.com/forum/#!topic/vagrant-up/6YCXpBJmhsM

答案1

我必须在这里克隆目录:https://github.com/jwasinger/ethereum-dev-env,然后使用 vagrantfile 在终端中导航到该目录中的文件夹,然后运行vagrant up。我的路由器的网关没有启用 SSH,所以我需要这样做。

相关内容