12月にISUCON14に参戦することが決まったのでISUCONの過去問を解きたい


経緯

去年参加できなかったISUCONに、今年は念願叶って出場できることになったので、過去問を解くことにした。

環境構築手順は公式にあるのでこれに従っておけばよい。

ISUCONの過去問にチャレンジするためのシンプルな環境構築 : ISUCON公式Blog

過去のISUCONで出題された問題をシンプルに環境構築できるページなどを紹介します。 初めてISUCONにチャレンジするという方は、事前講習のスライドや動画でISUCONの競技の流れをまとめています。2021年と2022年とそれぞれありますので参考にしてみてください。

isucon.net favicon image isucon.net

Vagrantfileをmatsuuさんが公開してくださっているので、今回はそれを使う。

GitHub - matsuu/vagrant-isucon: ISUCON過去問を構築するためのVagrantfile集

ISUCON過去問を構築するためのVagrantfile集. Contribute to matsuu/vagrant-isucon development by creating an account on GitHub.

github.com favicon image github.com

トラブル

Vagrantfile内のconfig.vm.networkの設定を適当なIPに変更してvagrant upすると以下のエラーが。

The machine <vmname> is already locked by a session (or being locked or unlocked)

VM in virtualbox is already locked for a session (or being unlocked)

My VM in virtualbox can not start due to this error, I don't want to destroy it and reinstall it again, anyway to recover it ? There was an error while executing VBoxManage, a CLI used by Vagrant ...

stackoverflow.com favicon image stackoverflow.com

上のサイトによると、

VBoxManage startvm <vm-uuid> --type emergencystop

すると治るらしいと書いてあったので、VBoxManage list vmsして出てきたvmのUUIDを埋め込んで実行すると治った。

続いて、以下のエラーが発生。

VT-x is disabled in the BIOS for both all CPU modes

VT-xは以前、確かに有効化した記憶があったので、何で無効化されてるんだと訝しみながら再度設定。 マザボの電池切れとかだと面倒だな。

その後、vagrant upが問題なく動き出したと思ったら、今度はsnap install goでエラーが起きていた。

...
    default: Preparing to unpack .../nodejs_20.18.0-1nodesource1_amd64.deb ...
    default: Unpacking nodejs (20.18.0-1nodesource1) ...
    default: Setting up nodejs (20.18.0-1nodesource1) ...
    default: Processing triggers for man-db (2.10.2-1) ...
    default: NEEDRESTART-VER: 3.5
    default: NEEDRESTART-KCUR: 5.15.0-91-generic
    default: NEEDRESTART-KEXP: 5.15.0-91-generic
    default: NEEDRESTART-KSTA: 1
    default: NEEDRESTART-SVC: ssh.service
    default: ++ snap install go --channel=1.21/stable --classic
    default: error: too early for operation, device not yet seeded or device model not acknowledged
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.

エラーの内容的にsleep 600挟めばいけるやろ、と思って入れてみたら本当に治った。

後で思ったことだが、数分待ってvagrant provisionとかでもいけてたのかな。

この後無事立ち上がったので/etc/hosts{先程設定したIP} pipe.u.isucon.localのエントリを追加して、ブラウザからhttps://pipe.u.isucon.localへアクセス。

めでたしめでたし。

おわりに

本番までに5年分は解いておきたいなという希望的観測。