# GF16: Corrupt or empty world file, what do I do?

## tomk

Navigation: [Gentoo Fundamentals] [Table of Contents]

If you notice that packages are missing when you run 

```
emerge -uDp world
```

check that the world file (in /var/cache/edb/ for portage-2.0.50, /var/lib/portage for portage-2.0.51) contains those packages. If it doesn't or is empty you can fix it by running this as root:

```
regenworld
```

This uses your /var/log/emerge.log to regenerate your world file. It may not work if the log has been deleted or you are using an unstable version of portage. If this is the case, there is a workaround using qpkg which is part of gentoolkit*.

```
qpkg -I -nc > /var/cache/edb/world  # portage-2.0.50

qpkg -I -nc > /var/lib/portage/world  # portage-2.0.51
```

This will create a new world file which lists all installed packages. You should edit the world file afterwards to remove unnecessary packages, this can be done with the dep script or manually.

* Note that qpkg is deprecated in favour of equery. However, the output of the equivalent equery command

```
equery -C -q list
```

is not compatible with the world file as it also gives the version number of the installed packages. You can find qpkg in /usr/lib/gentoolkit/bin/ and /usr/share/doc/gentoolkit-<version>/deprecated/qpkg/ if you have gentoolkit-0.2.0 and gentookit-0.2.1, respectively.

2004-10-21: Portage-2.0.51 updates

2005-12-22: Added deprecation notice of qpkg  --kallamej

----------

