Page MenuHomePhabricator

Provisioning MediaWiki-Vagrant fails with "Could not set 'file' on ensure: Is a directory - /etc/hhvm/php.ini"
Closed, ResolvedPublic

Description

Got this error while trying to update an old VM. I know that continuously updating a box over a long time is not the recommended usage for MW-Vagrant so I don't expect support for this, just sharing in case someone already ran into it and has a workaround. (I guess just deleting /etc/hhvm/php.ini would work?)

==> default: Error: /Stage[main]/Hhvm/File[/etc/hhvm/php.ini]/ensure: change from directory to file failed: Could not set 'file' on ensure: Is a directory - (/etc/hhvm/php.ini20150123-3988-1vknbbk, /etc/hhvm/php.ini) at 72:/tmp/vagrant-puppet-5/modules-0/hhvm/manifests/init.pp

Event Timeline

Tgr raised the priority of this task from to Lowest.
Tgr updated the task description. (Show Details)
Tgr added a project: MediaWiki-Vagrant.
Tgr subscribed.
Tgr claimed this task.

I guess just deleting /etc/hhvm/php.ini would work?

It does.

Reopening, happens with brand new VMs as well.

Tgr raised the priority of this task from Lowest to Needs Triage.Jan 24 2015, 2:50 AM

It seems that the package changed and the vagrant puppet module is now out of sync:

vagrant@mediawiki-vagrant:~$ dpkg-query -L hhvm | grep /etc/hhvm/php.ini
/etc/hhvm/php.ini
/etc/hhvm/php.ini/php.ini
Tgr triaged this task as High priority.Jan 24 2015, 3:07 AM

I am getting a similar error, but the error message is slightly different. After vagrant destroy, vagrant up yields:

==> default: Error: Could not set 'file' on ensure: Is a directory - (/etc/hhvm/php.ini20150124-5826-xnindb, /etc/hhvm/php.ini) at 65:/tmp/vagrant-puppet-5/modules-0/hhvm/manifests/init.pp
==> default: Error: Could not set 'file' on ensure: Is a directory - (/etc/hhvm/php.ini20150124-5826-xnindb, /etc/hhvm/php.ini) at 65:/tmp/vagrant-puppet-5/modules-0/hhvm/manifests/init.pp
==> default: Wrapped exception:
==> default: Is a directory - (/etc/hhvm/php.ini20150124-5826-xnindb, /etc/hhvm/php.ini)
==> default: Error: /Stage[main]/Hhvm/File[/etc/hhvm/php.ini]/ensure: change from directory to file failed: Could not set 'file' on ensure: Is a directory - (/etc/hhvm/php.ini20150124-5826-xnindb, /etc/hhvm/php.ini) at 65:/tmp/vagrant-puppet-5/modules-0/hhvm/manifests/init.pp

This appears to be causing errors with Wikimetrics as well:

==> default: Info: /Stage[main]/Wikimetrics::Web::Daemon/File[/etc/init/wikimetrics-web.conf]: Scheduling refresh of Service[wikimetrics-web]
==> default: Error: Could not start Service[wikimetrics-web]: Execution of '/sbin/start wikimetrics-web' returned 1: 
==> default: 
==> default: Error: /Stage[main]/Wikimetrics::Web::Daemon/Service[wikimetrics-web]/ensure: change from stopped to running failed: Could not start Service[wikimetrics-web]: Execution of '/sbin/start wikimetrics-web' returned 1:

I tried working on running some tests involving https://phabricator.wikimedia.org/T74747 in case the error was not relevant, but I got ImportError: No module named celery.signals.

installed hhvm version: 3.5.0-trusty in an unpuppetized vagrant instance and it installs php.ini in /etc/hhvm/php.ini. it seems that the issue is with the pkg version 3.3.1+dfsg1-1+wm3, which installs php.ini in /etc/hhvm/php.ini/php.ini. i don’t know how or where this needs to be fixed or reported.

apt-cache show hhvm
Package: hhvm
Provides: hhvm-fastcgi
Replaces: hhvm-fastcgi
Conflicts: hhvm-fastcgi
Version: 3.5.0~trusty
Architecture: amd64
Essential: no
Depends: binutils, libasn1-8-heimdal, libboost-filesystem1.54.0, libboost-program-options1.54.0, libboost-system1.54.0, libboost-system1.54.0, libboost-regex1.54.0, libbz2-1.0, libc6, libcap2, libc-client2007e, libcomerr2, libelf1, libexpat1, libfontconfig1, libfreetype6, libgcc1, libgcrypt11, libgd3, libgnutls26, libgpg-error0, libgssapi3-heimdal, libgssapi-krb5-2, libhcrypto4-heimdal, libheimbase1-heimdal, libheimntlm0-heimdal, libhx509-5-heimdal, libicu52, libidn11, libjpeg-turbo8, libk5crypto3, libkeyutils1, libkrb5-26-heimdal, libkrb5-3, libkrb5support0, libldap-2.4-2, libmcrypt4, libmemcached10, libmysqlclient18, libonig2, libp11-kit0, libpam0g, libpcre3, libpng12-0, libroken18-heimdal, librtmp0, libsasl2-2, libsqlite3-0, libssl1.0.0, libstdc++6, libtasn1-6, libtbb2, libtinfo5, libwind0-heimdal, libx11-6, libxau6, libxcb1, libxdmcp6, libxml2, libxpm4, zlib1g, libedit2, libjemalloc1 (>= 3.0.0), libgoogle-glog0 (>= 0.3.1), libcurl3 (>= 7.28.0), libboost-thread1.54.0, libmagickwand5, libxslt1.1, libevent-2.0-5, libgmp10
Maintainer: Paul Tarjan <pt@fb.com>
Priority: optional
Section: web
Filename: pool/main/h/hhvm/hhvm_3.5.0~trusty_amd64.deb
Size: 13285628
SHA256: 57fac598b5e72259d7fdf863ff47d4f4153646879275ee64249b017e902c4ac6
SHA1: 9ed3ce214cdc3ebfc721efdc3d51745b4350c021
MD5sum: 78c896fa7ba7fc29e2091ad8b1ae7c9c
Description: HHVM virtual machine, runtime, and JIT for the PHP language
Description-md5: 98571cd7333493baf95470adfb419c6f
apt-cache show hhvm
Package: hhvm
Version: 3.3.1+dfsg1-1+wm3
Architecture: amd64
Maintainer: Debian HHVM packaging team <pkg-hhvm-team@lists.alioth.debian.org>
Installed-Size: 37295
Depends: libboost-filesystem1.54.0, libboost-program-options1.54.0, libboost-system1.54.0, libboost-thread1.54.0, libbz2-1.0, libc-client2007e, libc6 (>= 2.16), libcap2 (>= 2.10), libcurl3 (>= 7.28.0), libdouble-conversion1, libedit2 (>= 2.11-20080614), libelf1 (>= 0.142), libevent-2.0-5 (>= 2.0.10-stable), libexpat1 (>= 2.0.1), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libgoogle-glog0, libicu48 (>= 4.8-1), libjemalloc1 (>= 3.5.0), libjpeg8 (>= 8c), libjson-c2 (>= 0.11), libldap-2.4-2 (>= 2.4.7), liblz4-1 (>= 0.0~r114), libmagickcore5 (>= 8:6.7.7.10), libmagickwand5 (>= 8:6.7.7.10), libmcrypt4, libmemcached10, libmysqlclient18 (>= 5.5.24+dfsg-1), libonig2 (>= 5.2.0), libpcre3, libpng12-0 (>= 1.2.13-4), libsqlite3-0 (>= 3.6.0), libssl1.0.0 (>= 1.0.0), libstdc++6 (>= 4.8.1), libtbb2, libvpx1 (>= 1.0.0), libxml2 (>= 2.9.0), libxslt1.1 (>= 1.1.25), libyaml-0-2, libzip2 (>= 0.11.2), zlib1g (>= 1:1.2.0), sysv-rc (>= 2.88dsf-24) | file-rc (>= 0.8.16)
Provides: hhvm-api-20140829
Homepage: http://hhvm.com/
Priority: optional
Section: php
Filename: pool/main/h/hhvm/hhvm_3.3.1+dfsg1-1+wm3_amd64.deb
Size: 8470284
SHA256: e407ce4786d5ed36c98c23a314ee8202fe61af6e600b139058424137ed47a7ac
SHA1: 8ebb5ebd7ee26e55566c7067b33f232f95f7d998
MD5sum: c5154291efe15143b533573a1f630445
Description: HipHop Virtual Machine, a JIT replacement for PHP - main runtime
 HHVM is an open-source virtual machine designed for executing programs
 written in Hack and PHP. HHVM uses a just-in-time (JIT) compilation
 approach to achieve superior performance while maintaining the development
 flexibility that PHP provides.
 .
 For the majority of your programs HHVM should be a drop-in replacement for
 the usual PHP interpreter/engine.
Description-md5: 38342325e9845e740d731bdce4db0f98
gerritbot subscribed.

Change 186917 had a related patch set uploaded (by Dan-nl):
Force creation of /etc/hhvm/php.ini

https://gerrit.wikimedia.org/r/186917

Patch-For-Review

Adding ops, as I think they are in charge of packaging HHVM; if the package uses the wrong path, that should be fixed. If the path is correct, vagrant should use that, instead of forcefully changing it, IMO.

In T87478#995772, @Tgr wrote:

Adding ops, as I think they are in charge of packaging HHVM; if the package uses the wrong path, that should be fixed. If the path is correct, vagrant should use that, instead of forcefully changing it, IMO.

I talked to @Joe about this on irc earlier. He has the fix for it but it hasn't been updated in the package yet.

Workaround until we get the package fixed:

$ vagrant ssh
$ sudo rm -rf /etc/hhvm/php.ini
$ exit
$ vagrant provision

I confirm that this currently happens for brand new VMs.

FWIW something like this happened to me this morning on flow-tests.wmflabs.org running (labs) /vagrant from October 30 (commit 0a810cc674). After the ensure failure both /etc/hhvm/php.ini and /etc/hhvm/fcgi/php.ini were directories, not files, each containing an (old) ini file. I moved them out of the way

sudo mv -i /etc/hhvm/php.ini{,_BAD}
sudo mv -i /etc/hhvm/fcgi/php.ini{,_BAD}

and then sudo labs-vagrant provision completed OK.

@bd808, @Tgr,

i agree, that ideally this would be fixed in the hhvm package, but it seems that this issue has existed for some time. i checked out a commit hash from 25 september 2014, 7447c9804b947b4b7eba9af1d0dc93828d59bed9, and still saw this issue when creating a new vm.

  • is there a dependency on a 3rd party to merge joe’s fix?
  • would it make sense to add a blocking task and merge this patch for now?

Vagrant fetches the current version of packages via apt; what version of MW-Vagrant you use does not affect this bug. I think it started happening a week ago, some days before this bug report I was still able to spawn VMs.

@Tgr,

i see. thanks, but how is MW-Vagrant determining where to get the apt-get package for hhvm?

  1. i created the vm without provisioning, vagrant up --no-provision.
  2. then installed the hhvm package with these instructions.
  3. after following those instructions, the hhvm package created the php.ini file in the “correct” directory /etc/hhvm/php.ini.

it looks like the MW-Vagrant install is using a special version of the apt-get package for hhvm, 3.3.1+dfsg1-1+wm3. is that necessary? also, i’m assuming that this is the package @Joe can revise, but just hasn't had time to verify everything he wants before committing the change - correct?

Change 186917 merged by jenkins-bot:
Force creation of /etc/hhvm/php.ini

https://gerrit.wikimedia.org/r/186917

I merged @dan-nl's patch for our puppet config and created T88014: HHVM 3.3.1+dfsg1-1+wm3 incorrectly provisions /etc/hhvm contents to track the packaging problem.