无法在 Linux 客户机中挂载文件夹 - 消息:ttyname 失败:设备的 ioctl 不合适 [英] Failed to mount folders in Linux guest - mesg: ttyname failed: Inappropriate ioctl for device

查看:62
本文介绍了无法在 Linux 客户机中挂载文件夹 - 消息:ttyname 失败:设备的 ioctl 不合适的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Vagrant 不会挂载文件夹.尝试了很多解决方案,没有任何效果.

Vagrant won't mount folders. Tried so many solutions, nothing worked.

版本:Vagrant 1.8.1/Ubuntu 15.10/Virtualbox 5.0.16

Versions: Vagrant 1.8.1 / Ubuntu 15.10 / Virtualbox 5.0.16

vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/wily64' 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: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
GuestAdditions 5.0.16 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => C:/Users/User/www/magento-box
    default: /vagrant-magento-box-folder => C:/Users/User/www/magento-box-folder
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group www-data | cut -d: -f3`,dmode=775, fmode=664 vagrant-magento-box-folder /vagrant-magento-box-folder
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g www-data`,dmode=775, fmode=664 vagrant-magento-box-folder /vagrant-magento-box-folder

The error output from the last command was:

mesg: ttyname failed: Inappropriate ioctl for device

在 Vagrantfile.config.yml 同步文件夹中:

In Vagrantfile.config.yml synced folders:

synced_folder:
  host_path: "/Users/User/www/magento-box-folder"
  guest_path: "/vagrant-magento-box-folder/"

流浪档案

require 'yaml'
vagrantConfig = YAML.load_file 'Vagrantfile.config.yml'
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"

config.vm.network "private_network", 
ip: vagrantConfig['ip']

    config.vm.synced_folder "#{vagrantConfig['synced_folder']['host_path']}", 
    "#{vagrantConfig['synced_folder']['guest_path']}", 
    owner: "vagrant", 
    group: "www-data", 
    mount_options:["dmode=775, fmode=664"]

# VirtualBox specific settings
    config.vm.provider "virtualbox" do |vb|
    vb.gui = false
    vb.memory = "2048"
    vb.cpus = 2
end

在 vagrant ssh 中我做了

In vagrant ssh I did

sudo ln -s /opt/VBoxGuestAdditions-5.0.16/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions 

我在 tmp 中替换了 VBoxGuestAdditions.iso

I replaced VBoxGuestAdditions.iso in tmp

Copy iso fileC:\Program Files/Oracle/VirtualBox/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso

已安装 vbguest.不知道怎么解决..

Installed vbguest. Have no idea how to solve it..

推荐答案

这是发生错误的重要原因之一vagrant up

Here is one important reason why error occurred vagrant up

如果你使用 Virtual Box 到 Vagrant 的提供者,你必须在每次创建虚拟机内核时重新安装Guest Additions".

If you use Virtual Box to Vagrant's provider, you have to reinstall 'Guest Additions' that everytime you create virtual machine's kernel.

vbguest 插件是解决这个问题的好方法.

vbguest plugin is a good solution for solving this issue.

(关于 vbguest 插件 - https://github.com/dotless-de/vagrant-vbguest )

首先,您必须安装 vbguest 插件.

first, you have to install vbguest plugin.

$ vagrant plugin install vagrant-vbguest

并运行 Vagrant

and run Vagrant

$ vagrant stop

$ vagrant up

或者也用

vagrant reload

这篇关于无法在 Linux 客户机中挂载文件夹 - 消息:ttyname 失败:设备的 ioctl 不合适的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆