sudo: no tty present and no askpass program specified setup の対処方法
動作環境
ホスト
- OS X El Capitan 10.11.6
ゲスト(Vagrant)
- vagrant 1.8.1
- Virtualbox 5.0.14
- CentOS 7.2
エラー内容と対処
$ vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Clearing any previously set forwarded ports... ==> default: Fixed port collision for 22 => 2222. Now on port 2200. ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat ==> default: Forwarding ports... default: 3000 => 3000 (adapter 1) default: 22 => 2200 (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:2200 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Connection timeout. Retrying... default: Warning: Connection timeout. Retrying... ==> default: Machine booted and ready! [default] GuestAdditions seems to be installed (5.0.26) correctly, but not running. sudo: no tty present and no askpass program specified sudo: no tty present and no askpass program specified ==> default: Checking for guest additions in VM... The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed! sudo: no tty present and no askpass program specified setup Stdout from the command: Stderr from the command: sudo: no tty present and no askpass program specified
なんかsudoが〜と言っているので、その設定を見直す。
[vagrant@localhost ~]$ sudo visudo
Defaults !visiblepw
をコメントアウトして、Defaults visiblepw
を追記。
一応 vagrant
ユーザにroot権限が与えられているかも確認する。
# Defaults !visiblepw Defaults visiblepw root ALL=(ALL:ALL) ALL vagrant ALL=(ALL) NOPASSWD:ALL
保存して、一度vagrantから抜ける。
$ vagrant reload ==> default: Attempting graceful shutdown of VM... ==> default: Clearing any previously set forwarded ports... ==> default: Fixed port collision for 22 => 2222. Now on port 2200. ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat ==> default: Forwarding ports... default: 3000 => 3000 (adapter 1) default: 22 => 2200 (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:2200 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Connection timeout. Retrying... default: Warning: Connection timeout. Retrying... ==> default: Machine booted and ready! [default] GuestAdditions 5.0.26 running --- OK. ==> default: Checking for guest additions in VM... ==> default: Mounting shared folders... default: /vagrant => /Users/hoge/ ==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision` ==> default: flag to force provisioning. Provisioners marked to run always will still run.
いけた!