You are not logged in.

#1 2010-01-16 01:37:46

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

blackpac - blacklist and remove packages

blackpac is a bash script which maintains a blacklist of packages, and uses it to create a dummy package which pretends to provide those packages, allowing them to be removed from your system.  In short, it overrides pacman's dependency checks.

First...
WARNING: This script is for advanced users who understand the implications and consequences of removing packages that are required by other packages. It is YOUR responsibility to determine what packages are safe to remove in this manner.

I recently had a discussion about all the packages pacman insists on installing when they are not really required, at least for my purposes.  I think pacman should allow you to maintain a blacklist for such packages.  Until then, there is blackpac.  It is similar to "pacman -Rd packagename", except I was told that would be ineffective because an update may cause the package to be reinstalled.

Obviously this is something to be used with great care, but I find it very useful.

blackpac version 1.0.0
Usage: blackpac OPTION [...]
Blacklists packages so that they may be removed; packages which depend on them
are satisfied by the dummy package 'blackpacdummy'.  Designed for use on Arch
Linux.
All options except --show require blackpac to be run as root.
One or more options are required:
--blacklist PACKAGE [...]  add PACKAGE(s) to the blacklist
                             (/etc/blackpaclist)
                             and update blackpacdummy
--unlist PACKAGE [...]     install PACKAGE(s), remove them from the blacklist,
                             and update blackpacdummy
--unlistall                install blacklisted packages, clear the blacklist
                             of all entries, and remove blackpacdummy
--update                   add packages in the blacklist to blackpacdummy
                             (use after manually editing blackpaclist)
--remove                   use "pacman -R" to remove all blacklisted packages
                             (updates blackpackdummy first)
--removes                  use "pacman -Rs" to remove all blacklisted packages
                             and their unneeded dependencies
--noinstall                do not automatically install packages before
                             unlisting them (this may prevent successful
                             update or removal of blackpacdummy)
--show                     show list of blacklisted packages currently
                             provided by blackpacdummy and list of
                             packages that currently depend on blackpacdummy
WARNING: Removing packages may break other packages and cause serious system
         malfunction!  It is up to YOU to decide what packages are safe to
         remove from your system.

I realize people don't like running scripts as root, but after reviewing the various ways of going about it, I decided that it was best to make it full root-only.  This means all the files it maintains are root-owned, to prevent tampering.  FWIW I do have a lot of experience writing root scripts, and I have run this all day on my system to check it as thoroughly as possible.  Also, the only files it touches are its own /etc/blackpaclist and some files it creates in /tmp, then it runs pacman for all package maintenance.  Being a bash script you can open it up and check it out, use it as is, or modify it to your purposes.

Discussion and details at...
http://igurublog.wordpress.com/download … -blackpac/

I'll reprint a sample run here so you can get the idea of what it does (or for a color-coded version see the site)...

To illustrate the use and advantages of blackpac, a sample run is below.  In this case, installing kmail required the installation of kdelibs and kdepimlibs.  However, these in turn had dependencies on akonadi and soprano, which in turn had dependencies on mysql and mysql-clients.  It turns out that for most if not all uses, kmail does NOT require akonadi or soprano.  They may be removed without causing problems on my system - the only barrier was pacman requiring them.  The following example shows me removing akonadi and soprano, and their dependencies, using blackpac.  (Commands issued are shown in red, output in black.)

# First, I will check what is installed
root:/# pacman -Q akonadi soprano mysql mysql-clients blackpacdummy
akonadi 1.2.1-3
soprano 2.3.1-2
mysql 5.1.42-1
mysql-clients 5.1.42-1
error: package "blackpacdummy" not found


# Next, I will try to remove them without blackpac, which won't work
root:/# pacman -R akonadi soprano
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: kdelibs: requires soprano
:: kdepimlibs: requires akonadi>=1.1.90

# Now I will blacklist them with blackpac, and will include the
# --removes option to tell blackpac to run pacman and remove them *and their
# dependencies* (use with caution)
root:/# blackpac --removes --blacklist akonadi soprano
Blacklisting akonadi...
Blacklisting soprano...
Building blackpacdummy...
Installing blackpacdummy...
>>> pacman --noconfirm -U "/tmp/blackpac.tmp/blackpacdummy-1.0.0-1-any.pkg.tar.gz"
loading package data...
checking dependencies...
(1/1) checking for file conflicts                   [###################] 100%
(1/1) installing blackpacdummy                      [###################] 100%
Removing blacklisted packages...
>>> pacman -Rs  akonadi soprano
checking dependencies...
Remove (4): akonadi-1.2.1-3  mysql-5.1.42-1  mysql-clients-5.1.42-1
            soprano-2.3.1-2
Total Removed Size:   67.83 MB
Do you want to remove these packages? [Y/n]
(1/4) removing akonadi                              [###################] 100%
(2/4) removing mysql                                [###################] 100%
(3/4) removing mysql-clients                        [###################] 100%
(4/4) removing soprano                              [###################] 100%

# Now I will look at what blackpacdummy is providing, and what
# depends on it
root:/# blackpac --show
Showing dependencies...
(see the 'Provides:' and 'Required By:' lines below)

>>> pacman -Qi blackpacdummy
Name           : blackpacdummy
Version        : 1.0.0-1
URL            : http://igurublog.wordpress.com/downloads/script-blackpac/
Licenses       : unknown
Groups         : None
Provides       : akonadi=999  soprano=999
Depends On     : None
Optional Deps  : None
Required By    : kdelibs  kdepimlibs
Conflicts With : None
Replaces       : None
Installed Size :   4.00 K
Packager       : IgnorantGuru
                 [http://igurublog.wordpress.com/contact-ignorantguru/]
Architecture   : any
Build Date     : Fri 15 Jan 2010 05:37:57 PM MST
Install Date   : Fri 15 Jan 2010 05:37:57 PM MST
Install Reason : Explicitly installed
Install Script : No
Description    : Dummy package created by blackpac to provide blacklisted
                 packages

# Now I will attempt to remove blackpacdummy, which won't
# work because kdelibs and kdepimlibs require it
root:/# pacman -R blackpacdummy
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: kdelibs: requires soprano
:: kdepimlibs: requires akonadi>=1.1.90

# Now I will tell blackpac to unlist everything in the blacklist
# (akonadi and soprano), which will cause it to first run pacman so I can install
# them
root:/# blackpac --unlistall  
Installing blacklisted packages...                                            
>>> pacman --needed -S  akonadi soprano                                       
resolving dependencies...                                                     
looking for inter-conflicts...                                                                                                                             
Targets (4): mysql-clients-5.1.42-1  mysql-5.1.42-1  soprano-2.3.1-2          
             akonadi-1.2.1-3                                                  
Total Download Size:    0.00 MB                                               
Total Installed Size:   67.83 MB                                              
Proceed with installation? [Y/n]
checking package integrity...
(4/4) checking for file conflicts                   [###################] 100%
(1/4) installing mysql-clients                      [###################] 100%
(2/4) installing mysql                              [###################] 100%
(3/4) installing soprano                            [###################] 100%
(4/4) installing akonadi                            [###################] 100%
Unlisting akonadi...
Unlisting soprano...
Building blackpacdummy...
Removing blackpacdummy (blacklist is empty)...
>>> pacman --noconfirm -R blackpacdummy
checking dependencies...
(1/1) removing blackpacdummy                        [###################] 100%

# Now let's see what's installed - we're back to where we started
root:/# pacman -Q akonadi soprano mysql mysql-clients blackpacdummy
akonadi 1.2.1-3
soprano 2.3.1-2
mysql 5.1.42-1
mysql-clients 5.1.42-1
error: package "blackpacdummy" not found

In just this one example, blackpac allowed me to remove 68MB of packages from my system, not to mention packages I simply don't want installed, without breaking anything I use.  And it allowed me to un-blacklist them and reinstall them with one command.

It's not for everyone but I thought some of you might be interested.  I think something along these lines could also be used to hold a package at an older version, while convincing pacman it's version '999', but I haven't experimented with that yet.

And thanks to Allan for some evil ideas.  smile

http://igurublog.wordpress.com/download … -blackpac/

Offline

#2 2010-01-16 13:55:05

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: blackpac - blacklist and remove packages

I have added this to the AUR...  "yaourt -S blackpac" should do it
http://aur.archlinux.org/packages.php?ID=33608

Offline

#3 2010-01-16 14:00:04

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: blackpac - blacklist and remove packages

IgnorantGuru wrote:

And thanks to Allan for some evil ideas.  smile

I actually saw the package on the AUR and commented on your blog before I saw this post.  I recognized my evilness in the provides versions big_smile

Offline

#4 2010-01-16 14:22:33

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: blackpac - blacklist and remove packages

Allan wrote:

I actually saw the package on the AUR and commented on your blog before I saw this post.  I recognized my evilness in the provides versions big_smile

lol  I did see and reply to your blog comment - good suggestion.  Thanks again - we'll see how this evolves.  I'm also thinking I might make a pacman feature request for a blacklist/fake-version ability.  I wonder if they would go for that.  (Probably not!)

Offline

#5 2010-01-16 14:51:22

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: blackpac - blacklist and remove packages

IgnorantGuru wrote:

I'm also thinking I might make a pacman feature request for a blacklist/fake-version ability.  I wonder if they would go for that.  (Probably not!)

Maybe... but i agree more likely not.  Although if done right it could be an interesting feature for a package manager.  A feature request on the bug tracker is the only way to find out.

Offline

#6 2010-01-16 15:55:21

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: blackpac - blacklist and remove packages

Allan wrote:

Maybe... but i agree more likely not.  Although if done right it could be an interesting feature for a package manager.  A feature request on the bug tracker is the only way to find out.

Agreed.  Ubuntu's Synaptic used to allow me to lock a package version, such that it wouldn't be upgraded.  I think what would be more useful would be a) a blacklist, and b) a fake-version for packages (which I may see if I can add to blackpac).

I recently encountered a breakage with CUPS.  When I tried to downgrade it, as someone suggested I do when an update breaks things, I couldn't downgrade it without pretty much downgrading my whole system.  One package ties into the next into the next...  Being able to just downgrade CUPS and fool pacman into thinking it was a different version would probably have worked temporarily - how much can CUPS really change one minor version to the next?

As an interesting sidenote on what doesn't work in linux bug-reporting, I experienced the usual bug shuffle instead of a fix.  Upstream told me to report it downstream, and downstream categorized it as upstream!  (upstream is almost certainly correct).  I'm sure it won't get fixed.
http://www.cups.org/str.php?L3468
http://bugs.archlinux.org/task/17758?pr … &pagenum=3

I've had terrible results reporting bugs in linux (mostly KDE and Ubuntu).  This was actually my first bug report for Arch (which says a lot in itself), and it's not really an Arch bug.

Offline

#7 2010-01-16 16:02:41

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: blackpac - blacklist and remove packages

Allan wrote:
IgnorantGuru wrote:

I'm also thinking I might make a pacman feature request for a blacklist/fake-version ability.  I wonder if they would go for that.  (Probably not!)

Maybe... but i agree more likely not.  Although if done right it could be an interesting feature for a package manager.  A feature request on the bug tracker is the only way to find out.

Am I the only one thinking that if a dependency can be faked without creating any problems then the packager needs to move that to the optdeps array? This is like someone with bad b.o. showing up at a party and the host breaking out the air freshener... ok, it masks it, but someone needs to just tell the guy to take a shower. Deal with the problem at the source, keep it lightweight and simple, motto, slogan, saying, motto, motto, etc.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#8 2010-01-16 16:14:28

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: blackpac - blacklist and remove packages

Xyne wrote:

Am I the only one thinking that if a dependency can be faked without creating any problems then the packager needs to move that to the optdeps array? This is like someone with bad b.o. showing up at a party and the host breaking out the air freshener... ok, it masks it, but someone needs to just tell the guy to take a shower. Deal with the problem at the source, keep it lightweight and simple, motto, slogan, saying, motto, motto, etc.

Agreed - to an extent, and Allan did suggest this in his comment on my blog.  I do think it should be addressed at the source.  But 'should' and 'will be' are two different monsters, and KDE is not very responsive to this kind of issue in my experience.  It's nice as a user to be able to break out the air freshener when the guy refuses to take shower.  But it is indeed an ugly hack - a temporary solution at best.  But sometimes that's better than no solution.  I don't like being forced to have software packages installed on my system just because someone listed everything under the sun as a dependency.  I can't control what they do, so I can at least control my system this way.

There is also the issue of what constitutes a dependency.  Modern software is so dependent and so tied together with the libs that its hard to separate them.  But when one dependency leads to another to another it can get really ridiculous.  I don't think kdelibs or kdepimlibs should depend on akonadi and soprano, as they obviously work without them.  The programs that actually use them should list them as dependencies.  I honestly don't know if it's worth the effort to report it though, as talking to KDE is like contacting MS tech support.

Offline

#9 2010-01-16 16:27:49

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: blackpac - blacklist and remove packages

And lest I make it sound like KDE is the only culprit...  I also removed fuse using blackpac.  gnomelibs requires fuse, and was starting the fuse daemon somehow in order to mount ~/.gvfs.  I don't use gnome, just a few gnome apps, and I don't want fuse running.  Removing fuse with blackpac prevents the .gvfs and didn't break anything.

There are a lot of examples like this.  I suppose to some extent it depends on how you use a particular piece of software.  That's the problem with mandatory dependency lists - they try to accommodate every possible use of the software.  In the case of gnomelibs that's a big list.

root:/# pacman -R fuse
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: gvfs: requires fuse>=2.8.0

root:/# blackpac --removes --blacklist fuse
Blacklisting fuse...
Building blackpacdummy...
Installing blackpacdummy...
>>> pacman --noconfirm -U "/tmp/blackpac-1263659503.tmp/blackpacdummy-1.0.0-1-any.pkg.tar.gz"
loading package data...
checking dependencies...
(1/1) checking for file conflicts                   [###################] 100%
(1/1) upgrading blackpacdummy                       [###################] 100%
Removing blacklisted packages...
>>> pacman -Rs  fuse
checking dependencies...
Remove (1): fuse-2.8.1-1
Total Removed Size:   0.74 MB
Do you want to remove these packages? [Y/n]
(1/1) removing fuse                                 [###################] 100%

Good riddance!  smile

Last edited by IgnorantGuru (2010-01-16 16:35:02)

Offline

#10 2010-01-16 16:53:47

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: blackpac - blacklist and remove packages

In fact I just tried removing gvfs itself, which had 24MB of dependencies (plus fuse which was already removed).  I'll see if I experience any breakage from this.  Thus far everything appears to be working - for me at least.

root:/# blackpac --removes --blacklist gvfs
Blacklisting gvfs...
Building blackpacdummy...
Installing blackpacdummy...
>>> pacman --noconfirm -U "/tmp/blackpac-1263660312.tmp/blackpacdummy-1.0.0-1-any.pkg.tar.gz"
loading package data...
checking dependencies...
(1/1) checking for file conflicts                   [###################] 100%
(1/1) upgrading blackpacdummy                       [###################] 100%
Removing blacklisted packages...
>>> pacman -Rs  gvfs
checking dependencies...
Remove (11): gvfs-1.4.3-1  libsoup-gnome-2.28.2-1  libsoup-2.28.2-1
             libcdio-0.82-1  gnome-disk-utility-2.28.1-1  libunique-1.1.6-1
             libnotify-0.4.5-1  devicekit-disks-009-3  sg3_utils-1.28-1
             parted-1.9.0-3  libatasmart-0.17-1
Total Removed Size:   23.14 MB
Do you want to remove these packages? [Y/n]
( 1/11) removing gvfs                               [###################] 100%
( 2/11) removing libsoup-gnome                      [###################] 100%
( 3/11) removing libsoup                            [###################] 100%
( 4/11) removing libcdio                            [###################] 100%
( 5/11) removing gnome-disk-utility                 [###################] 100%
( 6/11) removing libunique                          [###################] 100%
( 7/11) removing libnotify                          [###################] 100%
( 8/11) removing devicekit-disks                    [###################] 100%
( 9/11) removing sg3_utils                          [###################] 100%
(10/11) removing parted                             [###################] 100%
(11/11) removing libatasmart                        [###################] 100%

If it turns out to be too much, this will bring it all back...

root:/# blackpac --unlist gvfs

Installing blacklisted packages...
>>> pacman --needed -S  gvfs
resolving dependencies...
looking for inter-conflicts...
Targets (11): libsoup-2.28.2-1  libsoup-gnome-2.28.2-1  libcdio-0.82-1
              libunique-1.1.6-1  sg3_utils-1.28-1  parted-1.9.0-3
              libatasmart-0.17-1  devicekit-disks-009-3  libnotify-0.4.5-1
              gnome-disk-utility-2.28.1-1  gvfs-1.4.3-1
Total Download Size:    6.45 MB
Total Installed Size:   23.14 MB
Proceed with installation? [Y/n]
:: Retrieving packages from extra...
 libsoup-2.28.2-1-x86_64  351.9K  646.3K/s 00:00:01 [###################] 100%
 libsoup-gnome-2.28....    13.1K  109.8K/s 00:00:00 [###################] 100%
 libcdio-0.82-1-x86_64    480.3K  747.9K/s 00:00:01 [###################] 100%
 libunique-1.1.6-1-x...    47.7K  220.2K/s 00:00:00 [###################] 100%
 sg3_utils-1.28-1-x86_64  619.9K  775.4K/s 00:00:01 [###################] 100%
 parted-1.9.0-3-x86_64    924.9K  846.7K/s 00:00:01 [###################] 100%
 libatasmart-0.17-1-...    32.8K  193.2K/s 00:00:00 [###################] 100%
 devicekit-disks-009...   160.5K  429.5K/s 00:00:00 [###################] 100%
 libnotify-0.4.5-1-x...    35.2K  205.4K/s 00:00:00 [###################] 100%
 gnome-disk-utility-...  1983.1K  980.0K/s 00:00:02 [###################] 100%
 gvfs-1.4.3-1-x86_64     1955.7K  964.0K/s 00:00:02 [###################] 100%
checking package integrity...
(11/11) checking for file conflicts                 [###################] 100%
( 1/11) installing libsoup                          [###################] 100%
( 2/11) installing libsoup-gnome                    [###################] 100%
( 3/11) installing libcdio                          [###################] 100%
( 4/11) installing libunique                        [###################] 100%
( 5/11) installing sg3_utils                        [###################] 100%
( 6/11) installing parted                           [###################] 100%
( 7/11) installing libatasmart                      [###################] 100%
( 8/11) installing devicekit-disks                  [###################] 100%
( 9/11) installing libnotify                        [###################] 100%
(10/11) installing gnome-disk-utility               [###################] 100%
(11/11) installing gvfs                             [###################] 100%
Unlisting gvfs...
Building blackpacdummy...
Installing blackpacdummy...
>>> pacman --noconfirm -U "/tmp/blackpac-1263660673.tmp/blackpacdummy-1.0.0-1-any.pkg.tar.gz"
loading package data...
checking dependencies...
(1/1) checking for file conflicts                   [###################] 100%
(1/1) upgrading blackpacdummy                       [###################] 100%

Offline

#11 2010-01-18 17:01:01

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: blackpac - blacklist and remove packages

Following up, I have experienced no problems from gnomelibs or apps after removing gvfs and all its dependencies, even with a reboot.  I did regretfully discover that Dolphin, which I use as a secondary large-font FM, requires soprano.  It refuses to start without one of the soprano libraries.  (But soprano's executables can still be manually disabled without affecting Dolphin if you like.)

Offline

#12 2012-11-19 20:51:13

flying sheep
Member
Registered: 2012-02-29
Posts: 90

Re: blackpac - blacklist and remove packages

woo, this is awesome.

bye-bye ttf-liberation and ttf-ms-fonts!

Offline

Board footer

Powered by FluxBB