# How do I hide packages from appearing in apt system?

The list of uninstalled packages appearing in my aptitude is massive, but is full of packages that I'm very sure I will never ever install. E.g. my laptop is using intel graphics, so it doesn't make sense to install xserver-xorg-video-nouveau. Therefore I want to hide it forever. This is important while listing using !~i!~v, as it shows all packages available for installation (I still need to know the filter for packages with dependencies marked UNAVAILABLE), so if I can hide them, it's easier to find packages that I haven't tried out.

How do I make it so, if possible, for the whole apt database to ignore the uninteresting packages?

-
Sorry, I misinterpreted your question. I've deleted my answer. –  camh Jun 7 '11 at 7:36

I'm sure there's now way, unless you create your own APT repository. There's a bunch of tools for that, my favorite being reprepro. Once you got it setup, removing a single package from the repository is as easy as:

reprepro --basedir /path/to/.custom_repo remove custom_repo_name unwanted_package


It removes both from the index and the filesystem. After that, you'll need to update your APT list of course, apt-get update.

-
#!/bin/sh
# apt-filter
# Shell script for filtering the apt packages list. Useful if you don't want to
# see too many packages in your synaptic/aptitude. Improves startup time of
# both, at the expense of time taken for filtering the updates.
listpath=/var/lib/apt/lists
skiplist=/etc/apt/skiplist  # This is user defined list of package to skip. Put yours there
skiplist_prev=/var/cache/apt/skiplist
statustmp=/tmp/apt-update.1

cd $listpath if [ ! -e orig ] then #first time running. create the required folder mkdir -p orig mv *_dists_* orig skiplist_changed=1 else #compare current skiplist with last time's skiplist_changed=$(diff -q $skiplist$skiplist_prev)
#delete prev skiplist, in case update fails, then it will be forced to refilter
[ -e $skiplist_prev ] && rm$skiplist_prev
fi
#check for new package lists. Save the output to list, with progress visible.
apt-get update -o Dir::State::Lists=$listpath/orig | tee$statustmp

cd orig
cp *InRelease ..
if [ ! $skiplist_changed ] then #skip processing package lists with no updates #apt-get update displays "Get" for each repository that has updated pkgs=$(grep Get $statustmp | awk '{\ if (/Packages/ && !/Diff/){\ sub(/(ht|f)tp:\/*/,"",$2);\
sub(/\//,"_",$3);\ print$2"_debian_dists_"$3"_binary-"$4"_Packages"\
}\
}')
else
#skiplist changed, must reprocess all
pkgs=$(ls *Packages 2>/dev/null) fi #now let the fun begin! for pkglist in$pkgs
do
#there is chance the list failed to download, check if it exists
if [ -e $pkglist ] then echo Processing$pkglist...
awk '{\
skiplist = "'$skiplist'";\ if (/^Package/){\ skip = 0;\ while (!skip && (getline pkg < skiplist) > 0)\ skip=(pkg==$2);\
close(skiplist);\
};\
if (!skip) print $0\ }'$pkglist > ../$pkglist fi done #finally, save state of skiplist for future comparison cp$skiplist \$skiplist_prev


Just script it!

## Caveat emptor:

1. It puts existing lists in another folder, while the filtered ones take their place. This means if updated via conventional means, the filtered lists will be destroyed, and filter script must be run again.
2. The filter isn't optimized, process may take long time.
3. Smaller list should mean faster synaptic/aptitude startup, though I have no guarantee on that.
4. May result in many non-installable packages which still are on the list. If you know how to filter them, please answer on my other question!

## Outcome

The result? I no longer see emacs and its minions, no more windowmaker. Talk about peace on earth!

-