質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

Q&A

0回答

1204閲覧

vagrantの環境構築:「default: SSH auth method: private key」で止まってしまいvagrant upが完了しない

masa1456

総合スコア0

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

0グッド

0クリップ

投稿2023/04/16 07:52

編集2023/04/16 08:57

・vagrantでcentOS 7の環境構築を行っているのですが、
sshエラーが原因でvagrant upが完了しないです。
vagrant up時に「default: SSH auth method: private key」の部分で止まってしまい、そのままtime outになります。
後続の処理の、ローカル環境のフォルダとの同期処理までいかないので困っております。
上記がなぜ進まないかの原因がわからず質問させていただきました。

vagrant up --debugで確認したところ、同じ処理を繰り返してtimeoutになってしまっているようです。
(ログ内容は以下に記載しております。)

■各種バージョン、設定
windows10
vagrant:ver.2.2.6
virtual box:ver.5.2.22

・vagrantの鍵情報
vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile C:/Users/【user名】/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL

イメージ説明

・以下virtual boxのネットワーク設定です。
イメージ説明
イメージ説明

・vagrantfile設定

# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "centos/7" config.vm.network "private_network", ip: "[接続先のIPアドレス]" config.vm.synced_folder ".", "/vagrant",type:"virtualbox" config.vm.provision "shell", inline: <<-SHELL echo start ins upd yum -y update yum -y install httpd yum -y remove php-* yum -y install epel-release yum -y install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm yum -y install --enablerepo=remi,remi-php73 php php-devel php-mbstring php-pdo php-gd php-xml php-mcrypt php-pgsql php-pecl-xdebug php-zip yum -y install yum-utils yum-config-manager --setopt=base.exclude=postgresql* --save yum-config-manager --setopt=updates.exclude=postgresql* --save yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm yum -y install postgresql10-server PGSETUP_INITDB_OPTIONS="--encoding=UTF-8 --no-locale" /usr/pgsql-10/bin/postgresql-10-setup initdb php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php composer-setup.php php -r "unlink('composer-setup.php');" mv composer.phar /usr/local/bin/composer yum -y install git yum -y install zip unzip yum -y install vim nkf curl -sL https://rpm.nodesource.com/setup_8.x | sudo bash - yum -y install nodejs gcc-c++ make libpng-devel mkdir /home/vagrant/node_modules chmod 777 /home/vagrant/node_modules SHELL config.vm.provision "shell", run:"always",inline: <<-SHELL systemctl start httpd systemctl start postgresql-10 mount --bind /home/vagrant/node_modules /vagrant/edi/node_modules setenforce 0 SHELL end

■対応したこと
調べて以下などを試しましたが、状況変わりませんでした。
・BIOSの仮想化設定はenebledなっている
・Hyper-V、仮想マシンプラットフォームは無効化
・timeout秒数を伸ばす
・virtual box>ネットワークの「ケーブル接続」はチェック入っている
・opensshのsshコマンドでもsshできない
・vagrantfileに記載すると解決したコードも一通り記載したが変わらず
・vagrant destroy、vagrant reload、vagrant up --provisionなども試しました。

■vagrant up実行時ログ
以下ログです。

vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'centos/7' version '2004.01' 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: 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
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

・vagrantのコンソール画面は以下です。
vagrant自体は起動されており、ログインはできます。
イメージ説明

・vagrant up --debug
のログは以下です。(文字数制限の関係で繰り返し処理の1つのブロックしか記載していないです)
ずっと繰り返し接続しようとして、同じ処理を繰り返しているようです。
ネットワークなどの問題でしょうか。。

groups="/" ostype="Red Hat (64-bit)" UUID="736e65b8-a675-4c0f-882b-c156a84af106" hardwareuuid="736e65b8-a675-4c0f-882b-c156a84af106" memory=512 pagefusion="off" vram=16 cpuexecutioncap=100 hpet="off" chipset="piix3" firmware="BIOS" cpus=1 pae="on" longmode="on" triplefaultreset="off" apic="on" x2apic="on" cpuid-portability-level=0 bootmenu="messageandmenu" boot1="floppy" boot2="dvd" boot3="disk" boot4="none" acpi="on" ioapic="on" biosapic="apic" biossystemtimeoffset=0 rtcuseutc="on" hwvirtex="on" nestedpaging="on" largepages="on" vtxvpid="on" vtxux="on" paravirtprovider="default" effparavirtprovider="kvm" VMState="running" VMStateChangeTime="2023-04-16T06:56:41.934000000" monitorcount=1 accelerate3d="off" accelerate2dvideo="off" teleporterenabled="off" teleporterport=0 teleporteraddress="" teleporterpassword="" tracing-enabled="off" tracing-allow-vm-access="off" tracing-config="" autostart-enabled="off" autostart-delay=0 defaultfrontend="" storagecontrollername0="IDE" storagecontrollertype0="PIIX4" storagecontrollerinstance0="0" storagecontrollermaxportcount0="2" storagecontrollerportcount0="2" storagecontrollerbootable0="on" "IDE-ImageUUID-0-0"="90c8ca88-4c98-4e5d-81d7-db69812d4add" "IDE-0-1"="none" "IDE-1-0"="none" "IDE-1-1"="none" natnet1="nat" macaddress1="5254004D77D3" cableconnected1="on" nic1="nat" nictype1="82540EM" nicspeed1="0" mtu="0" sockSnd="64" sockRcv="64" tcpWndSnd="64" tcpWndRcv="64" Forwarding(0)="ssh,tcp,127.0.0.1,2222,,22" hostonlyadapter2="VirtualBox Host-Only Ethernet Adapter #2" macaddress2="080027D3275B" cableconnected2="on" nic2="hostonly" nictype2="82540EM" nicspeed2="0" nic3="none" nic4="none" nic5="none" nic6="none" nic7="none" nic8="none" hidpointing="ps2mouse" hidkeyboard="ps2kbd" uart1="off" uart2="off" uart3="off" uart4="off" lpt1="off" lpt2="off" audio="dsound" audio_in="false" audio_out="false" clipboard="disabled" draganddrop="disabled" SessionName="headless" VideoMode="720,400,0"@0,0 1 vrde="off" usb="off" ehci="off" xhci="off" SharedFolderNameMachineMapping1="vagrant" VRDEActiveConnection="off" VRDEClients=0 videocap="off" videocap_audio="off" videocapscreens=0 videocapres=1024x768 videocaprate=512 videocapfps=25 videocapopts=ac_enabled=false GuestMemoryBalloon=0 GuestOSType="RedHat_64" GuestAdditionsRunLevel=0 DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000 DEBUG subprocess: Exit status: 0 INFO subprocess: Starting process: ["C:/Program Files/Oracle/VirtualBox/VBoxManage.exe", "showvminfo", "736e65b8-a675-4c0f-882b-c156a84af106", "--machinereadable"] INFO subprocess: Command not in installer, restoring original environment... DEBUG subprocess: Selecting on IO

ここまでご確認いただきありがとうございます。
原因等もしわかれば教えていただければ幸いです。
ほかに必要な情報があれば、記載しますので
よろしくお願いします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問