# GF22: Circular upgrades and downgrades of a package

## kallamej

Navigation: [Gentoo Fundamentals] [Table of Contents]

Q: I have this package that portage wants to first upgrade, then downgrade, then upgrade again and so on. Why does it do that and what can I do to stop it?

A: This is due to the way portage handles dependencies. When you run for instance 

```
emerge -Dup world
```

and there is a conflict between the highest available version of a package matching your ACCEPT_KEYWORDS setting in /etc/make.conf as well as any entries in /etc/portage/package.{keywords,mask,unmask} and another package depending on a lower version, portage doesn't simultaneously handle both your request to upgrade to the highest available version and the lower version dependency, see Bug 13632. If you have the lower version installed, portage wants to upgrade, and if you have the higher version installed, portage wants to downgrade.

Chances are that it is a temporary problem that will be fixed the next time you run emerge --sync. Otherwise, run 

```
emerge -Duptv world
```

when you have the higher version installed to see which the other package that depends on the lower version is. Next you have to decide for yourself what do. There are a number of solutions such as:Hard masking the higher version of the yoyo-ing package by putting 

```
>=category/package-higher_version
```

in /etc/portage/package.mask.

Upgrading the other package to a higher version (if such a version exists) that doesn't have the problematic version dependency. Typically this upgrade would be to install a testing branch version on an otherwise stable branch system. Put 

```
=category/other_package-higher_version ~arch
```

in /etc/portage/package.keywords.

Disabling a USE-flag for the other package if it is caused by a conditional dependency. Put 

```
category/other_package -flag
```

in /etc/portage/package.use.

2005-07-26: Added link to the relevant bug. --kallamej

----------

