7

I want to install Open JDK or Oracle JDK to my machine but I got an error during installation. The error is:

Selecting previously unselected package oracle-java8-installer.
dpkg: warning: files list file for package 'unity-scope-gourmet' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'unity-scope-guayadeque' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'unity-scope-gmusicbrowser' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'unity-scope-manpages' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'unity-scope-firefoxbookmarks' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'unity-scope-gdrive' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'unity-scope-home' missing; assuming package has no files currently installed
E: Sub-process /usr/bin/dpkg returned an error code (2)

I searched on Google and try to something for install/reinstall this packages. Finally i try to remove Unity. I faced this error for my every tries. I am using Xmonad. How can I fix this issue?

2 Answers2

10

One loop over the seven packages' names to recreate the list-file for each package.

But first run

sudo apt-get autoclean

to remove unneeded DEBs in /var/cache/apt/archives. This is necessary that the following commands work properly.

arch="$(dpkg --print-architecture)"
for p in
  unity-scope-gourmet unity-scope-guayadeque unity-scope-gmusicbrowser
  unity-scope-manpages unity-scope-firefoxbookmarks unity-scope-gdrive
  unity-scope-home
do
    find /var/cache/apt/archives -type f -name "${p}_*_${arch}.deb" -exec dpkg-deb --fsys-tarfile {} \; -quit | tar t | cut -f2- -d. | sed 's|^/$|/.|;s|/$||' | sudo tee "/var/lib/dpkg/info/$p.list" > /dev/null
done
sudo chmod -R a+r /var/lib/dpkg/info

Some tests later, the command

sudo apt-get install --reinstall unity-scope-gourmet unity-scope-guayadeque unity-scope-gmusicbrowser unity-scope-manpages unity-scope-firefoxbookmarks unity-scope-gdrive unity-scope-home

should also help.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
A.B.
  • 90,397
  • dpkg-deb shouldn't need sudo, the find command should probably be terminated after the first match. And instead of dpkg-deb -c ... | awk ... |, where you're processing tar's verbose output, you could use tar to print only the paths: dpkg-deb --fsys-tarfile {} | tar t | ... – muru Jan 01 '16 at 12:21
  • Can you explain in detail one command to recreate? What if I do not want to install but to remove the package? – Timo Mar 05 '18 at 19:55
  • @Timo: If you want to remove the package you should still reinstall it to recreate its file list first and only then remove it, so that Apt knows which files to remove. – David Foerster Jul 22 '18 at 05:53
-1

I tried it A.B.'s approach but i faced same error with unity-scope-devhelp. Then, i deleted /var/lib/dpkg/unity-scope-devhelp.list

It Works :)