[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Uninstall (nearly) everything installed after spacific date



8< Snip original thread, to see it in all it's glory go here
http://groups.google.com/group/linux.debian.user/browse_frm/thread/d273b566e1a761d5/3bb0f539cdd82281?

Thought I'd update the list on my progress on this,
*WARNING THIS WILL BRAKE YOUR INSTALL* but the reasons are interesting

# make a list of installed packages by date
ls -l -t /var/lib/dpkg/info/*.list > ./inst.txt
vi ./inst.txt
# delete what you want to keep

# beautify the list (thanks Joe and Tyler)
cat ./inst.txt | sed 's/.*\(200[0-9]\)/\1/g' | awk -F"/" '{print $6}' | awk -F"." '{print $1}' > uninstall.txt
apt-get -s remove --purge $(cat ./uninstall.txt)

# At this point you'll get errors like "E: Couldn't find package libldap-2"
# so in another terminal open ./uninstall.txt and delete the offending entrys
# (there'll be many) until the command runs cleanly, then
# it will most likely have a section like

WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
apt libc6 (due to apt) libgcc1 (due to apt) libstdc++6 (due to apt) debian-archive-keyring (due to apt) base-files base-passwd (due to base-files) bash debianutils (due to bash) libncurses5 (due to bash) bsdutils coreutils libacl1 (due to coreutils) libselinux1 (due to coreutils) mktemp (due to debianutils) diff dpkg e2fsprogs e2fslibs (due to e2fsprogs) libblkid1 (due to e2fsprogs) libcomerr2 (due to e2fsprogs) libss2 (due to e2fsprogs) libuuid1 (due to e2fsprogs) findutils grep gzip hostname login libpam-modules (due to login) libpam0g (due to login) mount ncurses-base ncurses-bin perl-base sed sysvinit libsepol1 (due to sysvinit) initscripts (due to sysvinit) sysvinit-utils (due to sysvinit) tar util-linux lsb-base (due to util-linux) tzdata (due to util-linux) libslang2 (due to util-linux) zlib1g (due to
 util-linux)

# you should remove any listed packages from the uninstall.txt list until it all runs without a warning,
# you may have to go to the packages webpage to figure out dependencies.
http://www.debian.org/distrib/packages
# for instance on my system libldap2 gnupg gpgv were causing apt to get listed # you should also have a look at the page for your running kernel and make sure you're
# not uninstalling any  of it's dependencies.

# after that you can run apt-get without the -s


The process went fine but I uninstalled networking so gave up and reinstalled, the problem is when a package gets updated it causes it to appear on a different date that that on-which it was initially installed so you can easily remove something you want to keep.

If I had been a little more cautious or if I was removing less from the system it would have gone fine, all I need is a way of listing packages by when they were *first* installed.

Hay ho, it's no substitute for aptitude but it was an interesting experiment.



Reply to: