# HOWTO Prevent KDE4 packages from installing, without masking

## Etal

What is this about?

If you have KDE 3 installed and you're running ~arch, you have probably been confronted with KDE4 trying to get installed. Perhaps this has been something you've been waiting for for months, and you're happy to install it. However, many people don't want to run KDE4 just yet - maybe you find KDE 3.5 good enough and don't want to bother spending the time compiling 4.1 when you know you won't be using it and want to wait until 4.2 or for 4.3 ... Or maybe like me, you just want to install only certain parts of KDE but not every 4.1 variant of the KDE 3.5 application that you installed.

Your first idea would be to mask all the KDE4 packages. You could either acquire the whole list of packages from somewhere and put them into package.mask, or you could put packages one-by-one until no updates show up, which could be tedious especially if you were picky as to what KDE 3.5 apps get installed. However, masking has disadvantages. If you suddenly have an urge to install a certain app that's in your masked list, you have to unmask it and all on its dependencies.

You may ask yourself why KDE4 is getting pulled in in the first place. The reason is that in your world file, you have that package name, so as soon is as it sees that there's a new version of that package, ignoring that it will be in a different slot.

In this guide, we will use sets, a new Portage 2.2 feature, to prevent KDE4 from wanting to be installed. Unlike masking, nothing will prevent you from installing anything; rather, nothing will pull KDE4 in. As an added added bonus, it will make it easier for you to uninstall KDE 3.5 when that inevitable day eventually comes.

Step 1: Move things out of your world file

Let's begin. The first step is to move all the stuff from the world that is related to KDE to a separate file. It is located at /var/lib/portage/world If you don't trust yourself (or me), you may want to back it up.

```
cp /var/lib/portage/world /root/world
```

Now, create a new, temporary file file somewhere: We'll refer to it as /tmp/kde-3.5. Now, cut and paste anything starting with "kde-base/" into it. Next, scan through the rest of the world file and move anything else that's KDE3-related (including anything in kde-misc) into a different file, /tmp/kde-extras.

Step 2: Create a set

Now that we have the list of packages, we can create a set. Make sure you have a directory called /etc/portage/sets/:

```
mkdir -p /etc/portage/sets/
```

 before putting it in a set we need to indicate that all these packages should be from KDE 3.5. The best way to do this is by specifying the slot they're in since all KDE3 packages are in the "3.5" slot. So all you have to do now is to append ":3.5" after the package name. Let's use bash to help us with this:

```
cat /tmp/kde-3.5 | while read line; do

     echo "$line:3.5" >> /etc/portage/sets/kde-3.5;

done
```

You can just paste the above into the terminal, or type it in in one line, if you want. Now do the same thing for the kde-optional file we created, except that those files have slot "0" instead of "3.5". All the new KDE4 programs introduced are in the slot "4.1".

```
cat /tmp/kde-extras | while read line; do

     echo "$line:0" >> /etc/portage/sets/kde-3.5;

done
```

Step 3: Make sure your set works

Let's try it out:

```
emerge -pv @kde-3.5
```

If you get no errors, you may skip to the next step.

If you do, it's probably a slot issue. Either change the package's slot to the correct one (if you know it) or remove the slot requirement altogether for that package.

Step 4: Finish up

Now all that is left to do is to emerge the set. Since we do not want to reemerge KDE, simply run:

```
emerge --noreplace @kde-3.5
```

Now, let's try it out:

```
emerge -ptuvD world
```

You should now only get updates to packages unrelated to KDE. If you do, then you're done! You may now delete /tmp/kde-4.1 and /var/kde-extras.

If for some reason there's something pulling KDE4 in, you probably missed it. Remove it from world and put it into your set with the appropriate slot dependency, and try again.

Now what?

Now, you can do anything you want without KDE4 getting in. If you decide you want to try KDE4, just emerge it as you would normally. If you just want to take a peek at it, you can emerge kdebase-meta, and that's all you'll get installed! No need to mess with mask files. And once it's time for the old kde to go, you can just unmerge the set and let depclean handle everything else.

If you have any questions, problems or suggestions, please post!

Errata

I confused my /tmp with /var. Wherever I wrote /var/kde-3.5, I meant /tmp/kde-3.5. Sorry about the confusion.

I also forgot to mention that you can delete those files once you're done. (Oct 13, 2008)

----------

## d2_racing

I will test that in a near future  :Razz: 

Thanks for this info.

----------

## rjw8703

I have no directory called /var/kde-3.5

What should I do?

----------

## Geralt

 *rjw8703 wrote:*   

> I have no directory called /var/kde-3.5
> 
> What should I do?

 

What do you mean by this? There should be no /var/kde-3.5 directory, unless you create it of course.

----------

## ToeiRei

```
cat /var/kde-3.5 | while read line; do 

      echo "$line:3.5" >> /etc/portage/sets/kde-3.5; 

 done
```

gives

```
cat: /var/kde-3.5: No such file or directory
```

----------

## Geralt

 *ToeiRei wrote:*   

> 
> 
> ```
> cat /var/kde-3.5 | while read line; do 
> 
> ...

 

This seems to be a typo, it should be /tmp/kde-3.5 or wherever you stored kde-3.5 (I don't think /tmp is a good idea).

----------

## michel7

well, i expect some troubles with updating kde if kde3-5 updates will be released in the near feature

----------

## notHerbert

I tried it and it left severeal (6 or7) packages that needed to be masked.  It's not a catchall.

 *https://forums.gentoo.org/viewtopic-t-708282.html wrote:*   

> KDE 4.1 in Portage - FAQ
> 
> Q: Why there are no sets for KDE 4.1?
> 
> A: KDE-4.1.2 so far is NOT making use of sets but sets are expected to arrive in near future - the reason is - the naming convention for sets is not yet established.

 

----------

## rjw8703

I've found that putting these packages in package.mask works better:

>=kde-base/kdelibs-4.0.0

>=kde-base/kdesu-4.0.0

>=kde-base/kdebase-meta-4.0.0

>=kde-base/kde-meta-4.0.0

These 4 packages stopped all kde-4 from being installed.  This isn't much.

----------

## notHerbert

On my box I only need this line in package.mask to prevent the installation of all of KDE-4

```
>media-sound/amarok-1.4.10-r1
```

And this line in /var/lib/portage/world

```
kde-base/kde-meta:3.5
```

  :Cool: 

----------

## Etal

 *Geralt wrote:*   

>  *ToeiRei wrote:*   
> 
> ```
> cat /var/kde-3.5 | while read line; do 
> 
> ...

 

You're correct, I confused the /tmp with /var. Sorry about that.  :Embarassed: 

----------

## Etal

 *michel7 wrote:*   

> well, i expect some troubles with updating kde if kde3-5 updates will be released in the near feature

 

From what I know, there will never be a KDE 3.6, so since we did this by the "3.5" slot, there will be no problems with updates.

 *notHerbert wrote:*   

> I tried it and it left severeal (6 or7) packages that needed to be masked.  It's not a catchall.

 

Could you share which packages gave problems?

 *rjw8703 wrote:*   

> These 4 packages stopped all kde-4 from being installed.  This isn't much.

 

Maybe for you it's 4 packages, but for me it's 37  :Wink: 

----------

## notHerbert

 *AM088 wrote:*   

>  *notHerbert wrote:*   I tried it and it left severeal (6 or7) packages that needed to be masked.  It's not a catchall. 
> 
> Could you share which packages gave problems?

 

Certainly

```
# grep kde /var/lib/portage/world

# grep kde /var/lib/portage/world_sets 

@kde-3.5

# grep kde /etc/portage/sets/kde-3.5 

kde-base/kde-meta:3.5

# grep kde /etc/portage/package.mask

# emerge -uDNpv @system @world

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild  N    ] dev-cpp/clucene-0.9.20  USE="-debug -doc -threads" 1,513 kB

[ebuild  N    ] kde-base/automoc-0.9.84  8 kB

[ebuild  N    ] kde-base/qimageblitz-0.0.4  USE="3dnow mmx (-altivec) -debug -sse -sse2" 55 kB

[ebuild  N    ] media-sound/phonon-4.2.0  USE="gstreamer -debug" 392 kB

[ebuild  N    ] dev-util/boost-build-1.35.0-r1  USE="python -examples" 22,868 kB

[ebuild  N    ] dev-libs/boost-1.35.0-r2  USE="-debug -doc -expat -icu -mpi -tools" 5 kB

[ebuild  N    ] app-misc/strigi-0.5.11  USE="clucene dbus fam qt4 -debug -exif -hyperestraier -inotify -log -test" 857 kB

[ebuild  N    ] media-libs/raptor-1.4.18  USE="curl unicode xml" 1,619 kB

[ebuild  N    ] app-office/akonadi-server-1.0.0  USE="-mysql" 120 kB

[ebuild  N    ] dev-libs/soprano-2.1  USE="clucene sesame2 -debug -doc -redland" 1,789 kB

[ebuild  NS   ] kde-base/kdelibs-4.1.2-r1 [3.5.10-r2] USE="3dnow acl alsa bzip2 fam kerberos mmx nls opengl semantic-desktop spell ssl (-altivec) -bindist -debug -doc -htmlhandbook -jpeg2k -kdeprefix -openexr -sse -sse2 -test -zeroconf" 8,899 kB

[ebuild  N    ] kde-base/kdepimlibs-4.1.2  USE="ldap sasl -debug -htmlhandbook -kdeprefix -test" 1,844 kB

[ebuild  N    ] kde-base/libtaskmanager-4.1.2  USE="xcomposite -debug -kdeprefix" 46,387 kB

[ebuild  N    ] kde-base/libkworkspace-4.1.2  USE="-debug -kdeprefix" 0 kB

[ebuild  N    ] kde-base/libplasma-4.1.2  USE="opengl -debug -kdeprefix -test -xinerama" 0 kB

[ebuild  NS   ] media-sound/amarok-1.90-r1 [1.4.10-r1] USE="opengl -cdaudio -daap -debug -ifp -ipod -kdeprefix -mp3tunes -mp4 -mtp -mysql -njb -visualization" 3,306 kB

Total: 16 packages (14 new, 2 in new slots), Size of downloads: 89,657 kB

```

Of course I could mask all the rest, but the other way is easier

```
# grep kde /var/lib/portage/world

kde-base/kde-meta:3.5

# grep amarok /etc/portage/package.mask

>media-sound/amarok-1.4.10-r1

# emerge -uDNpv @system @world

These are the packages that would be merged, in order:

Calculating dependencies... done!

Total: 0 packages, Size of downloads: 0 kB

```

  :Razz: 

----------

## Edweirdo

I installed kde4 and like it but it has some problems with my multiple monitors.  I want to be able to start kde3 now with kde4 still installed.  I can't find the information on how to do that.  kdm has a kde-4 but not kde-3 selection to log in from.

I'd like to be able to choose between the two.

Any help would be appreciated.

----------

## notHerbert

This should work (unless KDE-4 completely changed how kdm works)

```
# cat /usr/share/xsessions/kde-3.5.desktop 

[Desktop Entry]

Encoding=UTF-8

Type=XSession

Exec=/usr/kde/3.5/bin/startkde

TryExec=/usr/kde/3.5/bin/startkde

Name=KDE 3.5
```

----------

## Edweirdo

notHerbert

That sounds reasonable, except startkde is gone becuase there was a conflict between 3.5 and 4.1 so it uninstalled startkde.  That could cause me issues trying to switch between the two.

----------

## Edweirdo

I resynced today and it now allows me to have both kdestart-3.5 and kdestart-4.1.  Once I emerged kdestart-3.5 the kde-3.5 showed up in the session list.

Thanks for the help.

----------

## notHerbert

No problem   :Razz: 

----------

## Randy Andy

Hi AM088,

i've tried out your procedure until i came to the step: 

```
emerge -ptuvD world
```

Now emerge tells me one blocked package cause circular dependeny. It was kde-base/kdebase-startkde-3.5.10-r2 and r3, pulled  by differnt packages i coudn't name now exactly, cause i went on, trying to solve this, maybe not in a clever way.

As far as i remember, i cleared the kdebase-startkde and reinstalled it without saying explizit the version. So portage installed version 4.1.2-r1 with all the other new depending packages.

Next time i do the pretend option at first - ok.

So ich changed my strategy and masked the packages too, as some others did.

But i had to mask the following packages to get success.

```

>=kde-base/kdelibs-4.0.0

>=kde-base/kdesu-4.0.0

>=kde-base/kdebase-meta-4.0.0

>=kde-base/kde-meta-4.0.0

>=media-sound/amarok-1.90

>=kde-base/kopete-4.0.0

```

So it seems not to work under all conditions for me. One important hint for some others, when doing: 

```
cat /tmp/kde-3.5 | while read line; do echo "$line:3.5" >> /etc/portage/sets/kde-3.5; done 
```

 you have to delete the maybe doubled :3.5 lines, cause some packages just contain this information. E.g. in my case the kde-base/kdemultimedia-arts:3.5 into the world file.

P.S. I tried the KDE 4.1.2 Desktop for three days, but went back today, cause to much pain and confusion and malfunctions.

Give it a try when its as stable and intuitive as the testing KDE-3.5 Version - my opinion, Andy.

----------

## Smart1

I have make all of this but

emerge -a kdelibs

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild  NS   ] kde-base/kdelibs-4.1.3-r1 [3.5.10-r2] USE="3dnow acl alsa bzip2 fam jpeg2k kerberos mmx nls opengl semantic-desktop spell sse sse2 ssl (-altivec) -bindist -debug -doc -htmlhandbook -kdeprefix -openexr -test -zeroconf"

Would you like to merge these packages? [Yes/No] n

emerge -ptuvD world

These are the packages that would be merged, in reverse order:

Calculating dependencies \--- WARNING: Package 'dev-java/gnu-crypto-2.1.0' uses '-*' keyword.

--- WARNING: Package 'dev-java/gnu-crypto-2.1.0' uses '-*' keyword.

--- WARNING: Package 'dev-java/gnu-crypto-2.1.0' uses '-*' keyword.

... done!

!!! Ebuilds for the following packages are either all

!!! masked or don't exist:

kde-base/kde-meta:3.5:3.5

!!! All ebuilds that could satisfy ">=kde-base/kdesu-4.1.3:4.1" have been masked.

!!! One of the following masked packages is required to complete your request:

- kde-base/kdesu-4.1.3 (masked by: package.mask)

For more information, see the MASKED PACKAGES section in the emerge

man page or refer to the Gentoo Handbook.

(dependency required by "kde-base/kdebase-kioslaves-4.1.3" [ebuild])

(dependency required by "@world" [argument])

I wish to remove KDE 4 and only use KDE 3.5

notHerbert wrote at

https://forums.gentoo.org/viewtopic-t-714854.html?sid=965f629f2164e76abb3747f7120f24cc

There is a thread  here about preventing KDE4 from being installed.

To remove kde4 this should work fine

Code:

emerge -Ca $(qlist -IC | grep "kde.*4.1" | sed 's/^/=/' | tr '\n' ' ')

emerge --depclean -av

revdep-rebuild -- --ask

emerge -Ca $(qlist -IC | grep "kde.*4.1" | sed 's/^/=/' | tr '\n' ' ')

emerge unmerge can only be used with specific package names

----------

## notHerbert

There was a follow up post where I corrected the command to remove KDE4

I had forgotten to add the v option in qlist -IC  so the correct command is 

```
emerge -Ca $(qlist -ICv | grep "kde.*4.1" | sed 's/^/=/' | tr '\n' ' ')
```

 :Razz:   :Cool: 

----------

## Martux

Just stumbled upon this due to kde-4.3 masking madness.

Thanks to the OP!

----------

## freifunk_connewitz

since the portage maintainers have removed the functionality of user defined sets from portage, the HOWTO doesn't work with the current emerge command. but for me it worked by extracting the kde-lines from the world file like OP wrote, then appending to all of them the suggested :3.5 or :0 slot definitions and then pasting them back to the world file.

by doing so, I was able to update world without kde-3.5.10 being "updated" to kde4.

(surely - this is nothing to live with very long if upstream really has stopped maintaining kde-3.5. but I've read somewhere (wikipedia I think) that it will be updated for a further while because quite a few administration and public service offices rely on it).

----------

