A listing of random software, tips, tweaks, hacks, and tutorials I made for Ubuntu
Easy way to fix ‘unable to open file ‘/var/lib/dpkg/tmp.ci//.svn’: Is a directory’
June 29, 2011Posted by on
While helping a friend with his computer, I had some issues trying to install a certain .deb package, as there was this error popping up:
unable to open file '/var/lib/dpkg/tmp.ci//.svn': Is a directory
This is actually caused by poor packaging, where the package was generated by code in an SVN source tree. To fix it, we just have to remove all .svn directories in the package.
Run this code in a terminal (replace debfile_REPLACE_ME by the name of the broken debfile, and path/to/bad/debfile_REPLACE_ME.deb by the path to the broken debfile, including it):
sudo apt-get install dpkg-dev # Installs tools to rebuild the debian package mkdir /tmp/deb$$ cp path/to/bad/debfile_REPLACE_ME.deb /tmp/deb$$ cd /tmp/deb$$ dpkg-deb -x debfile_REPLACE_ME.deb deb # Extracts filesystem data cd deb dpkg-deb -e ../debfile_REPLACE_ME.deb # Extracts metadata
Now copy the “Raw Paste Data” of this webpage to a file: http://pastebin.com/AvtFVRuK. I originally included the contents of this file in the post, but wordpress kept breaking it, so I had to upload it to a pastebin. Copy the file to /tmp/deb(random numbers, probably 4 of them), and rename it to ‘svn.sh’ (without quotes).
Run this code in the same terminal as before:
chmod a+x ../svn.sh ../svn.sh . cd .. sudo dpkg-deb -b deb
You can then install it using:
sudo dpkg -i deb.deb