Installing Wine 1.9.11 on Ubuntu 16.04

wine-software-that-can-lead-a-man-to-drinkIt should not have been this difficult.

But alas, it has been.

I must have spent 4 or more hours now trying to install Wine 1.9 (though any version would have been just fine after the first few hours), on Ubuntu 16.04 / Xenial.

The reason for all this Wine-ing? SQLYog. It’s by far and away the best MySQL GUI I have ever used, and nothing on Linux comes close. Wine allows me to run Windows software (almost) as though it were a native Linux app. Pretty awesome.

Now, I’ve never had any trouble installing Wine before. I’m almost positive (though it’s always worth doubting my own memory) that I’ve had Wine installed on previous Linux / Ubuntu boxes simply by using the Ubuntu Software Center. Sure, it’s an ancient version, but it does the job.

Things got so desperate that I was in the middle of installing Windows 7 into a VirtualBox VM just so I could run this one single app. And of course, whilst that was installing in the background, I managed to stumble upon a fix.

Anyway, enough background / blather, I’m sure you are only interested in how I fixed this problem.

My Solution

I followed the instruction guide from the Wine docs:

sudo dpkg --add-architecture i386 
sudo add-apt-repository ppa:wine/wine-builds
sudo apt-get update
sudo apt-get install --install-recommends winehq-devel

However this constantly threw up errors like:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 winehq-devel : Depends: wine-devel (= 1.9.11~ubuntu16.04.1)

I knew there was something around the whole x64 / i386 thing going on, and along the way I learned that adding in :i386 after a package name installs the 32 bit version of the software, should you be on a 64 bit OS.

This led me to trying all manner of variations.

Then I stumbled upon this, which gave a much clearer indication of the missing dependency:

➜  ~ sudo apt-get install --install-recommends wine-devel-i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 wine-devel-i386:i386 : Depends: libgphoto2-6:i386 (>= 2.5.9) but it is not going to be installed
                        Recommends: libgnutls-deb0-28:i386 but it is not installable or
                                    libgnutls26:i386 but it is not installable
                        Recommends: libsane:i386 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

That led me to this StackOverflow thread which got me much further, but not 100% of the way there.

The first command worked a treat:

sudo apt-get install gcc-multilib libasound2-dev:i386 libgsm1-dev:i386 libjpeg8-dev:i386 liblcms2-dev:i386 libldap2-dev:i386 libmpg123-dev:i386 libopenal-dev:i386 libv4l-dev:i386 libx11-dev:i386 libxinerama-dev:i386 libxml2-dev:i386 zlib1g-dev:i386

But the second one needed a little modification:

sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgphoto2-6:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386 libgd3:i386

Fortunately, again, the output was very helpful in pointing me towards the right dependency.

With both of those installing all the bits and pieces, finally Wine installed properly:

sudo apt-get install --install-recommends winehq-devel wine-devel

Most of the frustration came from me not understanding the output clearly enough to figure out what dependency I was missing.

Some raw output which may help you debug this problem:

sudo dpkg --add-architecture i386 
sudo add-apt-repository ppa:wine/wine-builds
sudo apt-get update
sudo apt-get install --install-recommends winehq-devel
apt-mark showhold 
sudo apt-get remove wine
sudo apt-get install wine1.7
sudo apt-get install wine1.7-amd64 wine1.7-i386
sudo apt-get install --install-recommends wine-devel
sudo apt-get install --install-recommends wine-devel-i386
sudo apt-get install --install-recommends wine-devel-i386:i386
sudo apt-get install ia32-libs
sudo apt-get install wine-devel-i386
sudo apt-get install --install-recommends winehq-devel wine-devel
sudo apt-get install --install-recommends winehq-devel libasound2-plugins:i386
sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgnutls26:i386 libgphoto2-2:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386
sudo apt-get install gcc-multilib libasound2-dev:i386 libgsm1-dev:i386 libjpeg8-dev:i386 liblcms2-dev:i386 libldap2-dev:i386 libmpg123-dev:i386 libopenal-dev:i386 libv4l-dev:i386 libx11-dev:i386 libxinerama-dev:i386 libxml2-dev:i386 zlib1g-dev:i386 
apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgnutls26:i386 libgphoto2-2:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386
sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgnutls26:i386 libgphoto2-2:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386
sudo apt-get install --install-recommends winehq-devel wine-devel
sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgphoto2-2:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386
sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386  libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386
sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgphoto2-6:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386
sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgphoto2-6:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386 libgd3:1386
sudo apt-get install libcapi20-dev:i386 libcups2:i386 libdbus-1-3:i386 libfontconfig:i386 libfreetype6:i386 libglu1-mesa:i386 libgphoto2-6:i386 libncurses5:i386 libosmesa6:i386 libsane:i386 libxcomposite1:i386 libxcursor1:i386 libxi6:i386 libxrandr2:i386 libxslt1.1:i386 ocl-icd-libopencl1:i386 libgd3:i386
sudo apt-get install --install-recommends winehq-devel wine-devel

wine is not an emulator

But it may make you need a drink.

Installing Scrapy 1.1 On Ubuntu 15.10

I don’t do a huge amount of Python, but when I do, it usually involves Scrapy.

As a result of not doing a lot of Python, it usually means I don’t have all the relevant gubbins (yes, that is the correct technical description) installed to make things ‘just work ™’.

On the contrary, things usually go quite wrong indeed:

Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-I6du0W/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-hwGRh6-record/install-record.txt --single-version-externally-managed --compile --user failed with error code 1 in /tmp/pip-build-I6du0W/lxml

or

Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-dLB7U_/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-KNAq8K-record/install-record.txt --single-version-externally-managed --compile --user failed with error code 1 in /tmp/pip-build-dLB7U_/lxml
Storing debug log for failure in /home/chris/.pip/pip.log

and so on.

Now, also, I am not the world’s foremost expert on Linux, and / or the package dependencies required to get Python to play nicely.

This is a polite way of saying I blindly follow the top answers on StackOverflow until whatever it is I am trying to install (e.g. Scrapy) installs without some horrendous error message. Hey, a little brutal honesty never hurt anybody.

So, to save my future sanity, here are all the things I ran today to get Scrapy 1.1 installed on Ubuntu 15.10:

➜  ~ python --version
Python 2.7.10

➜  ~ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 15.10
Release:	15.10
Codename:	wily

You will need pip installed. (sudo apt-get install python-pip worked for me.)

Then this – I am aware there are duplicates, this is a concat of about 6 different attempts. Feel free to de-dupe if you want, it makes no difference (afaik):

sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev libxml2-dev libxslt1-dev python-dev libxml2-dev libxslt1-dev python-dev libxml2-dev libxslt-dev python-dev lib32z1-dev build-essential libssl-dev libffi-dev python-dev

And then Scrapy installed ‘first time’ using:

pip install Scrapy

Marvellous.

If you’d like to learn more Python, I’m not the best person to speak to. I would highly recommend you check out one or more of the courses listed at CourseDuck.

How I Fixed: PHPStorm 2016.1.1 Weird Graphical Glitch

Picture the scene: it’s Friday night, it’s half ten, what else would you rather be doing than upgrading some software?

Well, tonight I updated to Ubuntu to 16.04 LTS:

ubuntu-16-04-lts

I’ve been thinking about switching to CentOS as of late, but haven’t yet had the time. So when the little pop-up prompted me to update, I figured… heck, why not?

Well, why not – because usually Ubuntu updates cause all kinds of chaos for me. And tonight was no different. Though for once, it was graphic card related.

But it was graphics related.

I also took the opportunity to bump PHPStorm to 2016.1.1, after all this recent hoo-hah about security.

Being somewhat of a chimp, I copied over the newly downloaded files over the top of my existing PhpStorm-10.0.4 directory. Naughty.

Then, when I opened up PHPStorm, it all looked a bit… wrong:

broken-intellij phpstorm-broken-2 phpstorm-totally-broken

Oh yeah, good times.

Figuring I had messed up good and proper, I deleted the entire directory and tried again. Same deal. Oops.

Strangely though, WebStorm carried on working just fine.

I figured maybe it was somehow related to my desktop icon, but alas no, running from the command line also threw a total benny:

OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=350m; support was removed in 8.0
[   4183]  ERROR - napi.project.CacheUpdateRunner - Error while indexing /home/chris/Development/symfony-githut/app/Resources/views/githut/repo.html.twig
To reindex this file IDEA has to be restarted 
java.lang.NoClassDefFoundError: Could not initialize class com.intellij.psi.xml.XmlChildRole
	at com.intellij.psi.impl.source.xml.XmlTagImpl.getName(XmlTagImpl.java:572)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer$1.visitXmlAttribute(CssTemplateSelectorsIndex.java:133)
	at com.intellij.psi.impl.source.xml.XmlAttributeImpl.accept(XmlAttributeImpl.java:153)
	at com.intellij.psi.PsiWalkingState.visit(PsiWalkingState.java:64)
	at com.intellij.psi.PsiWalkingState.visit(PsiWalkingState.java:26)
	at com.intellij.util.WalkingState.walkChildren(WalkingState.java:65)
	at com.intellij.util.WalkingState.elementStarted(WalkingState.java:52)
	at com.intellij.psi.PsiWalkingState.elementStarted(PsiWalkingState.java:73)
	at com.intellij.psi.XmlRecursiveElementWalkingVisitor.visitElement(XmlRecursiveElementWalkingVisitor.java:38)
	at com.intellij.psi.PsiElementVisitor.visitFile(PsiElementVisitor.java:34)
	at com.intellij.psi.XmlRecursiveElementWalkingVisitor.visitFile(XmlRecursiveElementWalkingVisitor.java:56)
	at com.intellij.psi.XmlElementVisitor.visitXmlFile(XmlElementVisitor.java:26)
	at com.intellij.psi.impl.source.xml.XmlFileImpl.accept(XmlFileImpl.java:71)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer.map(CssTemplateSelectorsIndex.java:129)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer.map(CssTemplateSelectorsIndex.java:116)
	at com.intellij.util.indexing.MapReduceIndex.update(MapReduceIndex.java:398)
	at com.intellij.util.indexing.FileBasedIndexImpl.updateSingleIndex(FileBasedIndexImpl.java:1831)
	at com.intellij.util.indexing.FileBasedIndexImpl$23.run(FileBasedIndexImpl.java:1760)
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.freezeFileTypeTemporarilyIn(FileTypeManagerImpl.java:510)
	at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1718)
	at com.intellij.util.indexing.FileBasedIndexImpl.indexFileContent(FileBasedIndexImpl.java:1703)
	at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:108)
	at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:105)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$1.run(CacheUpdateRunner.java:226)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1178)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$2.run(CacheUpdateRunner.java:246)
	at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:446)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:443)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.run(CacheUpdateRunner.java:240)
	at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
[   4184]  ERROR - napi.project.CacheUpdateRunner - PhpStorm 2016.1.1  Build #PS-145.970.40 
[   4184]  ERROR - napi.project.CacheUpdateRunner - JDK: 1.8.0_76-release 
[   4184]  ERROR - napi.project.CacheUpdateRunner - VM: OpenJDK 64-Bit Server VM 
[   4184]  ERROR - napi.project.CacheUpdateRunner - Vendor: JetBrains s.r.o 
[   4184]  ERROR - napi.project.CacheUpdateRunner - OS: Linux 
[   4184]  ERROR - napi.project.CacheUpdateRunner - Last Action:  
[   4188]  ERROR - napi.project.CacheUpdateRunner - Error while indexing /home/chris/Development/symfony-githut/app/Resources/views/githut/repos.html.twig
To reindex this file IDEA has to be restarted 
java.lang.NoClassDefFoundError: Could not initialize class com.intellij.psi.xml.XmlChildRole
	at com.intellij.psi.impl.source.xml.XmlTagImpl.getName(XmlTagImpl.java:572)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer$1.visitXmlAttribute(CssTemplateSelectorsIndex.java:133)
	at com.intellij.psi.impl.source.xml.XmlAttributeImpl.accept(XmlAttributeImpl.java:153)
	at com.intellij.psi.PsiWalkingState.visit(PsiWalkingState.java:64)
	at com.intellij.psi.PsiWalkingState.visit(PsiWalkingState.java:26)
	at com.intellij.util.WalkingState.walkChildren(WalkingState.java:65)
	at com.intellij.util.WalkingState.elementStarted(WalkingState.java:52)
	at com.intellij.psi.PsiWalkingState.elementStarted(PsiWalkingState.java:73)
	at com.intellij.psi.XmlRecursiveElementWalkingVisitor.visitElement(XmlRecursiveElementWalkingVisitor.java:38)
	at com.intellij.psi.PsiElementVisitor.visitFile(PsiElementVisitor.java:34)
	at com.intellij.psi.XmlRecursiveElementWalkingVisitor.visitFile(XmlRecursiveElementWalkingVisitor.java:56)
	at com.intellij.psi.XmlElementVisitor.visitXmlFile(XmlElementVisitor.java:26)
	at com.intellij.psi.impl.source.xml.XmlFileImpl.accept(XmlFileImpl.java:71)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer.map(CssTemplateSelectorsIndex.java:129)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer.map(CssTemplateSelectorsIndex.java:116)
	at com.intellij.util.indexing.MapReduceIndex.update(MapReduceIndex.java:398)
	at com.intellij.util.indexing.FileBasedIndexImpl.updateSingleIndex(FileBasedIndexImpl.java:1831)
	at com.intellij.util.indexing.FileBasedIndexImpl$23.run(FileBasedIndexImpl.java:1760)
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.freezeFileTypeTemporarilyIn(FileTypeManagerImpl.java:510)
	at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1718)
	at com.intellij.util.indexing.FileBasedIndexImpl.indexFileContent(FileBasedIndexImpl.java:1703)
	at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:108)
	at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:105)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$1.run(CacheUpdateRunner.java:226)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1178)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$2.run(CacheUpdateRunner.java:246)
	at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:446)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:443)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.run(CacheUpdateRunner.java:240)
	at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
[   4189]  ERROR - napi.project.CacheUpdateRunner - PhpStorm 2016.1.1  Build #PS-145.970.40 
[   4189]  ERROR - napi.project.CacheUpdateRunner - JDK: 1.8.0_76-release 
[   4189]  ERROR - napi.project.CacheUpdateRunner - VM: OpenJDK 64-Bit Server VM 
[   4189]  ERROR - napi.project.CacheUpdateRunner - Vendor: JetBrains s.r.o 
[   4189]  ERROR - napi.project.CacheUpdateRunner - OS: Linux 
[   4189]  ERROR - napi.project.CacheUpdateRunner - Last Action:  
[   4184]  ERROR - napi.project.CacheUpdateRunner - Error while indexing /home/chris/Development/symfony-githut/app/Resources/views/githut/index.html.twig
To reindex this file IDEA has to be restarted 
java.lang.NoClassDefFoundError: com/intellij/psi/jsp/JspTokenType
	at com.intellij.psi.impl.source.jsp.JspStartTagEndProvider.getTypes(JspStartTagEndProvider.java:12)
	at com.intellij.psi.xml.XmlChildRole$4.<init>(XmlChildRole.java:65)
	at com.intellij.psi.xml.XmlChildRole.<clinit>(XmlChildRole.java:61)
	at com.intellij.psi.impl.source.xml.XmlTagImpl.getName(XmlTagImpl.java:572)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer$1.visitXmlAttribute(CssTemplateSelectorsIndex.java:133)
	at com.intellij.psi.impl.source.xml.XmlAttributeImpl.accept(XmlAttributeImpl.java:153)
	at com.intellij.psi.PsiWalkingState.visit(PsiWalkingState.java:64)
	at com.intellij.psi.PsiWalkingState.visit(PsiWalkingState.java:26)
	at com.intellij.util.WalkingState.walkChildren(WalkingState.java:65)
	at com.intellij.util.WalkingState.elementStarted(WalkingState.java:52)
	at com.intellij.psi.PsiWalkingState.elementStarted(PsiWalkingState.java:73)
	at com.intellij.psi.XmlRecursiveElementWalkingVisitor.visitElement(XmlRecursiveElementWalkingVisitor.java:38)
	at com.intellij.psi.PsiElementVisitor.visitFile(PsiElementVisitor.java:34)
	at com.intellij.psi.XmlRecursiveElementWalkingVisitor.visitFile(XmlRecursiveElementWalkingVisitor.java:56)
	at com.intellij.psi.XmlElementVisitor.visitXmlFile(XmlElementVisitor.java:26)
	at com.intellij.psi.impl.source.xml.XmlFileImpl.accept(XmlFileImpl.java:71)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer.map(CssTemplateSelectorsIndex.java:129)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer.map(CssTemplateSelectorsIndex.java:116)
	at com.intellij.util.indexing.MapReduceIndex.update(MapReduceIndex.java:398)
	at com.intellij.util.indexing.FileBasedIndexImpl.updateSingleIndex(FileBasedIndexImpl.java:1831)
	at com.intellij.util.indexing.FileBasedIndexImpl$23.run(FileBasedIndexImpl.java:1760)
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.freezeFileTypeTemporarilyIn(FileTypeManagerImpl.java:510)
	at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1718)
	at com.intellij.util.indexing.FileBasedIndexImpl.indexFileContent(FileBasedIndexImpl.java:1703)
	at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:108)
	at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:105)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$1.run(CacheUpdateRunner.java:226)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1178)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$2.run(CacheUpdateRunner.java:246)
	at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:446)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:443)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.run(CacheUpdateRunner.java:240)
	at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.intellij.psi.jsp.JspTokenType PluginClassLoader[com.intellij.jsp, 1.0]
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:64)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 42 more
[   4205]  ERROR - napi.project.CacheUpdateRunner - PhpStorm 2016.1.1  Build #PS-145.970.40 
[   4205]  ERROR - napi.project.CacheUpdateRunner - JDK: 1.8.0_76-release 
[   4205]  ERROR - napi.project.CacheUpdateRunner - VM: OpenJDK 64-Bit Server VM 
[   4205]  ERROR - napi.project.CacheUpdateRunner - Vendor: JetBrains s.r.o 
[   4205]  ERROR - napi.project.CacheUpdateRunner - OS: Linux 
[   4205]  ERROR - napi.project.CacheUpdateRunner - Last Action:  
[   4213]  ERROR - napi.project.CacheUpdateRunner - Error while indexing /home/chris/Development/symfony-githut/app/Resources/views/base.html.twig
To reindex this file IDEA has to be restarted 
java.lang.NoClassDefFoundError: Could not initialize class com.intellij.psi.xml.XmlChildRole
	at com.intellij.psi.impl.source.xml.XmlTagImpl.getName(XmlTagImpl.java:572)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer$1.visitXmlAttribute(CssTemplateSelectorsIndex.java:133)
	at com.intellij.psi.impl.source.xml.XmlAttributeImpl.accept(XmlAttributeImpl.java:153)
	at com.intellij.psi.PsiWalkingState.visit(PsiWalkingState.java:64)
	at com.intellij.psi.PsiWalkingState.visit(PsiWalkingState.java:26)
	at com.intellij.util.WalkingState.walkChildren(WalkingState.java:65)
	at com.intellij.util.WalkingState.elementStarted(WalkingState.java:52)
	at com.intellij.psi.PsiWalkingState.elementStarted(PsiWalkingState.java:73)
	at com.intellij.psi.XmlRecursiveElementWalkingVisitor.visitElement(XmlRecursiveElementWalkingVisitor.java:38)
	at com.intellij.psi.PsiElementVisitor.visitFile(PsiElementVisitor.java:34)
	at com.intellij.psi.XmlRecursiveElementWalkingVisitor.visitFile(XmlRecursiveElementWalkingVisitor.java:56)
	at com.intellij.psi.XmlElementVisitor.visitXmlFile(XmlElementVisitor.java:26)
	at com.intellij.psi.impl.source.xml.XmlFileImpl.accept(XmlFileImpl.java:71)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer.map(CssTemplateSelectorsIndex.java:129)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer.map(CssTemplateSelectorsIndex.java:116)
	at com.intellij.util.indexing.MapReduceIndex.update(MapReduceIndex.java:398)
	at com.intellij.util.indexing.FileBasedIndexImpl.updateSingleIndex(FileBasedIndexImpl.java:1831)
	at com.intellij.util.indexing.FileBasedIndexImpl$23.run(FileBasedIndexImpl.java:1760)
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.freezeFileTypeTemporarilyIn(FileTypeManagerImpl.java:510)
	at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1718)
	at com.intellij.util.indexing.FileBasedIndexImpl.indexFileContent(FileBasedIndexImpl.java:1703)
	at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:108)
	at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:105)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$1.run(CacheUpdateRunner.java:226)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1178)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$2.run(CacheUpdateRunner.java:246)
	at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:446)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:443)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.run(CacheUpdateRunner.java:240)
	at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
[   4213]  ERROR - napi.project.CacheUpdateRunner - PhpStorm 2016.1.1  Build #PS-145.970.40 
[   4213]  ERROR - napi.project.CacheUpdateRunner - JDK: 1.8.0_76-release 
[   4213]  ERROR - napi.project.CacheUpdateRunner - VM: OpenJDK 64-Bit Server VM 
[   4213]  ERROR - napi.project.CacheUpdateRunner - Vendor: JetBrains s.r.o 
[   4213]  ERROR - napi.project.CacheUpdateRunner - OS: Linux 
[   4213]  ERROR - napi.project.CacheUpdateRunner - Last Action:  
[   4224]  ERROR - napi.project.CacheUpdateRunner - Error while indexing /home/chris/Development/symfony-githut/app/Resources/views/githut/profile.html.twig
To reindex this file IDEA has to be restarted 
java.lang.NoClassDefFoundError: Could not initialize class com.intellij.psi.xml.XmlChildRole
	at com.intellij.psi.impl.source.xml.XmlTagImpl.getName(XmlTagImpl.java:572)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer$1.visitXmlAttribute(CssTemplateSelectorsIndex.java:133)
	at com.intellij.psi.impl.source.xml.XmlAttributeImpl.accept(XmlAttributeImpl.java:153)
	at com.intellij.psi.PsiWalkingState.visit(PsiWalkingState.java:64)
	at com.intellij.psi.PsiWalkingState.visit(PsiWalkingState.java:26)
	at com.intellij.util.WalkingState.walkChildren(WalkingState.java:65)
	at com.intellij.util.WalkingState.elementStarted(WalkingState.java:52)
	at com.intellij.psi.PsiWalkingState.elementStarted(PsiWalkingState.java:73)
	at com.intellij.psi.XmlRecursiveElementWalkingVisitor.visitElement(XmlRecursiveElementWalkingVisitor.java:38)
	at com.intellij.psi.PsiElementVisitor.visitFile(PsiElementVisitor.java:34)
	at com.intellij.psi.XmlRecursiveElementWalkingVisitor.visitFile(XmlRecursiveElementWalkingVisitor.java:56)
	at com.intellij.psi.XmlElementVisitor.visitXmlFile(XmlElementVisitor.java:26)
	at com.intellij.psi.impl.source.xml.XmlFileImpl.accept(XmlFileImpl.java:71)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer.map(CssTemplateSelectorsIndex.java:129)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer.map(CssTemplateSelectorsIndex.java:116)
	at com.intellij.util.indexing.MapReduceIndex.update(MapReduceIndex.java:398)
	at com.intellij.util.indexing.FileBasedIndexImpl.updateSingleIndex(FileBasedIndexImpl.java:1831)
	at com.intellij.util.indexing.FileBasedIndexImpl$23.run(FileBasedIndexImpl.java:1760)
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.freezeFileTypeTemporarilyIn(FileTypeManagerImpl.java:510)
	at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1718)
	at com.intellij.util.indexing.FileBasedIndexImpl.indexFileContent(FileBasedIndexImpl.java:1703)
	at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:108)
	at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:105)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$1.run(CacheUpdateRunner.java:226)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1178)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$2.run(CacheUpdateRunner.java:246)
	at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:446)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:443)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.run(CacheUpdateRunner.java:240)
	at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
[   4224]  ERROR - napi.project.CacheUpdateRunner - PhpStorm 2016.1.1  Build #PS-145.970.40 
[   4224]  ERROR - napi.project.CacheUpdateRunner - JDK: 1.8.0_76-release 
[   4224]  ERROR - napi.project.CacheUpdateRunner - VM: OpenJDK 64-Bit Server VM 
[   4224]  ERROR - napi.project.CacheUpdateRunner - Vendor: JetBrains s.r.o 
[   4224]  ERROR - napi.project.CacheUpdateRunner - OS: Linux 
[   4225]  ERROR - napi.project.CacheUpdateRunner - Last Action:  
[   4925]  ERROR - napi.project.CacheUpdateRunner - Error while indexing /home/chris/Development/symfony-githut/web/config.php
To reindex this file IDEA has to be restarted 
java.lang.NoClassDefFoundError: Could not initialize class com.intellij.psi.xml.XmlChildRole
	at com.intellij.psi.impl.source.xml.XmlTagImpl.getName(XmlTagImpl.java:572)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer$1.visitXmlAttribute(CssTemplateSelectorsIndex.java:133)
	at com.intellij.psi.impl.source.xml.XmlAttributeImpl.accept(XmlAttributeImpl.java:153)
	at com.intellij.psi.PsiWalkingState.visit(PsiWalkingState.java:64)
	at com.intellij.psi.PsiWalkingState.visit(PsiWalkingState.java:26)
	at com.intellij.util.WalkingState.walkChildren(WalkingState.java:65)
	at com.intellij.util.WalkingState.elementStarted(WalkingState.java:52)
	at com.intellij.psi.PsiWalkingState.elementStarted(PsiWalkingState.java:73)
	at com.intellij.psi.XmlRecursiveElementWalkingVisitor.visitElement(XmlRecursiveElementWalkingVisitor.java:38)
	at com.intellij.psi.PsiElementVisitor.visitFile(PsiElementVisitor.java:34)
	at com.intellij.psi.XmlRecursiveElementWalkingVisitor.visitFile(XmlRecursiveElementWalkingVisitor.java:56)
	at com.intellij.psi.XmlElementVisitor.visitXmlFile(XmlElementVisitor.java:26)
	at com.intellij.psi.impl.source.xml.XmlFileImpl.accept(XmlFileImpl.java:71)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer.map(CssTemplateSelectorsIndex.java:129)
	at com.intellij.psi.css.index.CssTemplateSelectorsIndex$MyDataIndexer.map(CssTemplateSelectorsIndex.java:116)
	at com.intellij.util.indexing.MapReduceIndex.update(MapReduceIndex.java:398)
	at com.intellij.util.indexing.FileBasedIndexImpl.updateSingleIndex(FileBasedIndexImpl.java:1831)
	at com.intellij.util.indexing.FileBasedIndexImpl$23.run(FileBasedIndexImpl.java:1760)
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.freezeFileTypeTemporarilyIn(FileTypeManagerImpl.java:510)
	at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:1718)
	at com.intellij.util.indexing.FileBasedIndexImpl.indexFileContent(FileBasedIndexImpl.java:1703)
	at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:108)
	at com.intellij.util.indexing.UnindexedFilesUpdater$2.consume(UnindexedFilesUpdater.java:105)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$1.run(CacheUpdateRunner.java:226)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1178)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable$2.run(CacheUpdateRunner.java:246)
	at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:446)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:443)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
	at com.intellij.openapi.project.CacheUpdateRunner$MyRunnable.run(CacheUpdateRunner.java:240)
	at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
[   4925]  ERROR - napi.project.CacheUpdateRunner - PhpStorm 2016.1.1  Build #PS-145.970.40 
[   4925]  ERROR - napi.project.CacheUpdateRunner - JDK: 1.8.0_76-release 
[   4925]  ERROR - napi.project.CacheUpdateRunner - VM: OpenJDK 64-Bit Server VM 
[   4925]  ERROR - napi.project.CacheUpdateRunner - Vendor: JetBrains s.r.o 
[   4925]  ERROR - napi.project.CacheUpdateRunner - OS: Linux 
[   4925]  ERROR - napi.project.CacheUpdateRunner - Last Action:  
[  10381]  ERROR - pplication.impl.LaterInvocator - Could not initialize class com.intellij.psi.xml.XmlChildRole 
java.lang.NoClassDefFoundError: Could not initialize class com.intellij.psi.xml.XmlChildRole
	at com.intellij.psi.impl.source.xml.XmlTagImpl.getName(XmlTagImpl.java:572)
	at com.jetbrains.php.joomla.init.JoomlaDetectionManager.isJoomlaManifest(JoomlaDetectionManager.java:112)
	at com.jetbrains.php.joomla.init.JoomlaDetectionManager.isJoomlaExtension(JoomlaDetectionManager.java:101)
	at com.jetbrains.php.joomla.init.JoomlaDetectionManager.offerIntegrationSetup(JoomlaDetectionManager.java:70)
	at com.jetbrains.php.joomla.JoomlaProjectComponent$2$1.run(JoomlaProjectComponent.java:49)
	at com.intellij.openapi.project.DumbServiceImpl.runWhenSmart(DumbServiceImpl.java:163)
	at com.intellij.openapi.project.DumbServiceImpl$8.run(DumbServiceImpl.java:406)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.a(LaterInvocator.java:345)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:329)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
	at com.intellij.ide.IdeEventQueue.g(IdeEventQueue.java:857)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:658)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:386)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
[  10382]  ERROR - pplication.impl.LaterInvocator - PhpStorm 2016.1.1  Build #PS-145.970.40 
[  10382]  ERROR - pplication.impl.LaterInvocator - JDK: 1.8.0_76-release 
[  10382]  ERROR - pplication.impl.LaterInvocator - VM: OpenJDK 64-Bit Server VM 
[  10383]  ERROR - pplication.impl.LaterInvocator - Vendor: JetBrains s.r.o 
[  10383]  ERROR - pplication.impl.LaterInvocator - OS: Linux 
[  10383]  ERROR - pplication.impl.LaterInvocator - Last Action:

I’ve chosen to dump the whole error output here in the hope that it helps with Googling. I couldn’t find much help via Google for this one. Hopefully this saves someone some time in the future.

The Solution

I tried deleting my entire PHPStorm directory and recreating, by unzipping again. But no dice. Same total mess.

I got a bit worried, but the solution was actually really simple.

I unzipped to a new directory, and started PHPStorm using the command line:

➜  cd ~/Downloads/PhpStorm-145.970.40/bin 
➜  bin sh phpstorm.sh

And lo-and-behold, it started working again.

Of course, I’ve lost all my plugins, settings, and what-have-you, but that’s a marked improvement from the previous mess.

Hopefully this may help you too.

Just an entire hour of my life I’ll never get back.

How I Fixed: File is absent cannot continue

Lately I’ve been tidying up my Ansible playbook scripts ahead of a forthcoming project deployment. Lots of change, including upgrading to PHP7 across the board.

Pretty cool, and exciting, but quite a lot of work all the same.

I decided to take the opportunity to restructure my log files. I mean, that’s a good way to spend a Friday night, right? Of course it is.

The relevant part of the nginx playbook is:

    - name: "create access log file"
      file: dest="/var/log/nginx/{{ item.directory }}-access.log"
            mode=644
            state=file
            owner="{{ nginx_user }}"
            group="{{ nginx_group }}"
      with_items: "{{ website_directories }}"

It’s admittedly been a while since I’ve been regularly hands-on with my Ansible setup, so I was a little rusty. See if you can spot the error in the above.

The with_items section lives in my host_vars/my-symfony-3.dev file, and looks like:

website_directories:
  - { name: "Root", directory: "{{ website_domain_name }}" }
  - { name: "API", directory: "api.{{ website_domain_name }}" }

So, anyway the error that was being spat out was as follows:

TASK [create access log file] **************************************************
failed: [my-symfony-3.dev] (item={u'stat': {u'exists': False}, '_ansible_item_result': True, '_ansible_no_log': False, u'changed': False, 'item': {u'directory': u'my-symfony-3.dev', u'name': u'Root'}, 'invocation': {'module_name': u'stat', u'module_args': {u'checksum_algorithm': u'sha1', u'mime': False, u'get_checksum': True, u'path': u'/var/www/my-symfony-3.dev', u'follow': False, u'get_md5': True}}}) => {"failed": true, "item": {"changed": false, "invocation": {"module_args": {"checksum_algorithm": "sha1", "follow": false, "get_checksum": true, "get_md5": true, "mime": false, "path": "/var/www/my-symfony-3.dev"}, "module_name": "stat"}, "item": {"directory": "my-symfony-3.dev", "name": "Root"}, "stat": {"exists": false}}, "msg": "file (/var/log/nginx/my-symfony-3.dev-access.log) is absent, cannot continue", "path": "/var/log/nginx/my-symfony-3.dev-access.log", "state": "absent"}
failed: [my-symfony-3.dev] (item={u'stat': {u'exists': False}, '_ansible_item_result': True, '_ansible_no_log': False, u'changed': False, 'item': {u'directory': u'api.my-symfony-3.dev', u'name': u'API'}, 'invocation': {'module_name': u'stat', u'module_args': {u'checksum_algorithm': u'sha1', u'mime': False, u'get_checksum': True, u'path': u'/var/www/api.my-symfony-3.dev', u'follow': False, u'get_md5': True}}}) => {"failed": true, "item": {"changed": false, "invocation": {"module_args": {"checksum_algorithm": "sha1", "follow": false, "get_checksum": true, "get_md5": true, "mime": false, "path": "/var/www/api.my-symfony-3.dev"}, "module_name": "stat"}, "item": {"directory": "api.my-symfony-3.dev", "name": "API"}, "stat": {"exists": false}}, "msg": "file (/var/log/nginx/api.my-symfony-3.dev-access.log) is absent, cannot continue", "path": "/var/log/nginx/api.my-symfony-3.dev-access.log", "state": "absent"}

Hopefully it make it easier to Google for this for someone in the future.

Anyway, the solution will make you kick yourself. I can’t imagine that many people will make this typo, but you never know:

    - name: "create access log file"
      file: dest="/var/log/nginx/{{ item.directory }}-access.log"
            mode=644
            state=touch
            owner="{{ nginx_user }}"
            group="{{ nginx_group }}"
      with_items: "{{ website_directories }}"

    - name: "create error log file"
      file: dest="/var/log/nginx/{{ item.directory }}-error.log"
            mode=644
            state=touch
            owner="{{ nginx_user }}"
            group="{{ nginx_group }}"
      with_items: "{{ website_directories }}"

Yeah… d’oh. RTFM.

Though to be fair, I had RTFM, it was just a long time ago, and I guess I rely too heavily on IDE code completion. When it comes to Sublime + YAML, I am going to make mistakes 🙂

If this looks interesting to you, and you want to know more about Ansible, be sure to check out the tutorial series I did here at Code Review Videos.

It’s shameless self promotion, I know, but hey, it is free. And hopefully you find it useful.