vi ./list
to delete lines for packages you want to keep (running kernel, less,
hddtemp, whatever...)
pass the ./list file to a command that will beautify it and output
another list of just package names that you can pass to
apt-get --purge remove
Shouldn't be too hard but my bash is rusty, so I thought I'd ask if
anyone had done this already before I crack my knuckles and get all man
bash sed grep on it?
Thanks.
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Bob wrote:
> Hi,
> How can I do this, the way I'd like it to work is
> cat /var/log/dpkg.log > ./list
> but filtering by date so it only includes packages installed after a
> certain time (grep sed?)
>
> vi ./list
> to delete lines for packages you want to keep (running kernel, less,
> hddtemp, whatever...)
>
> pass the ./list file to a command that will beautify it and output
> another list of just package names that you can pass to
> apt-get --purge remove
>
> Shouldn't be too hard but my bash is rusty, so I thought I'd ask if
> anyone had done this already before I crack my knuckles and get all man
> bash sed grep on it?
>
> Thanks.
>
>
Perhaps something list this: (adapt it for your needs)
#!/bin/bash
dpkg -l | grep beryl | gawk -F" " '{ print $2 }' > beryl.list
apt-get remove --purge $(cat beryl.list)
rm beryl.list
#end
Joe
- --
Registerd Linux user #443289 at http://counter.li.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF/QWuiXBCVWpc5J4RAtrFAKCiT8tNnaARTd5FbeYmU6l8Yw3Y+gCglOuR
ZRylLzaVusn5tjnLRITef8w=
=7rIp
-----END PGP SIGNATURE-----
Thanks for that, I'll see what I can do, I found this on the web
somewhere, it lists installed packages, including dependency's by the
install date.
ls -l -t /var/lib/dpkg/info/*.list > ./inst.txt
so I can use that as a start point, it's probably easer to delete all
references to packages installed before the cut off by hand, but I don't
necessarily want the *easiest* way, or even the best way, I want the
most educational and accurate way.
I can't understand exactly why you want to do this, but it's your
system. The little script above will take dpkg -l output and format it
only pulling the names of the files that are specified by the grep. If
you change it so that dpkg outputs the files by date, then you don't
need the grep, and should manually edit the .txt file that is created
before running the apt-get remove --purge.
However, looking at what that command does, it's not going to help you.
All that does is list the .list files that dpkg created when it
installed a package. Each .list file contains the filenames of all
files that were in the package, but not the package. However, the
package names are there. This on the other hand:
ls -lt /var/lib/dpkg/info/*.list | awk -F"/" '{print $6}' | awk -F"."
'{print $1}' > list.txt
will give you a list of packages in cronological order. That you can
then edit and feed to apt-get. Like I said, I don't know why you want
to do it, but I found it fun creating that line.
I'm getting better with awk. :)
That command should be all one line. I can't quite figure out how to
get it to pull only after a certain date. It does them all.
Perhaps another method altogether would better suit your needs. There
is a package called partimage that will take a snapshot of a partition.
You can do that on a frequent basis and always restore from a previous
image, but the catch is you can run it on a mounted partition, so you
need a liveCD to catch the / partition.
I use grml for that, knowing that if I ever bork my system I can always
boot grml and run partimage and restore it back to what it was the when
I created the image. It works.
Joe
- --
Registerd Linux user #443289 at http://counter.li.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF/RXriXBCVWpc5J4RAtR5AKCdx9hsh+VuH8d5+9QRhrA9fK5rZgCePw8z
Ut3WKIgP6TzYs7aia1PmZ60=
=ju60
-----END PGP SIGNATURE-----
I'm just getting started with awk, but this seems to work:
ls -lt /var/lib/dpkg/info/*.list | sed 's/.*\(200[0-9]\)/\1/g' |
awk '$0 > "2007-03-01"' | awk -F"/" '{print $6}' |
awk -F"." '{print $1}' > list.txt
This produces a list of packages altered after 2007-03-01. You can
change that date around, or extend it to select a particular hour or
minute on that day to use as the cut-off.
Note that I have no idea what you're doing, or how dpkg works, I just
wanted to see if I could figure out a solution to the immediate
problem with sed and awk!
--
Regards,
Tyler Smit
Tyler Smith wrote:
> On 2007-03-18, Joe Hart <j.h...@orange.nl> wrote:
>> ls -lt /var/lib/dpkg/info/*.list | awk -F"/" '{print $6}' | awk -F"."
>> '{print $1}' > list.txt
>>
>> will give you a list of packages in cronological order. That you can
>> then edit and feed to apt-get. Like I said, I don't know why you want
>> to do it, but I found it fun creating that line.
>>
>> I'm getting better with awk. :)
>>
>> That command should be all one line. I can't quite figure out how to
>> get it to pull only after a certain date. It does them all.
>>
>
> I'm just getting started with awk, but this seems to work:
>
> ls -lt /var/lib/dpkg/info/*.list | sed 's/.*\(200[0-9]\)/\1/g' |
> awk '$0 > "2007-03-01"' | awk -F"/" '{print $6}' |
> awk -F"." '{print $1}' > list.txt
>
> This produces a list of packages altered after 2007-03-01. You can
> change that date around, or extend it to select a particular hour or
> minute on that day to use as the cut-off.
>
> Note that I have no idea what you're doing, or how dpkg works, I just
> wanted to see if I could figure out a solution to the immediate
> problem with sed and awk!
>
Now that's what I call a command! Good job Tyler. I hope Bob likes it.
- --
Registerd Linux user #443289 at http://counter.li.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF/VPwiXBCVWpc5J4RAuh8AJsEvyu4yTotd1F9JpM7sTcnTftHvQCcC81y
RRPQ/utPT3XSBgTFKgMZtfU=
=p+Xy
-----END PGP SIGNATURE-----
Fantastic, thanks very much, you've inspired me, now I'm going to read
the man pages and workout how those commands work, I've always found sed
& awk a bit intimidating but they're obviously very powerful for list
processing which I seem to do a lot, I find that starting with a working
command or script and pulling it apart is the best way to learn.
As for why I'm doing this, well I have a PC which is ultimately
earmarked to be a headless MythTV BackEnd but I've been using it to
experiment with packages to figure out which ones I like for my personal
desktop and also for a couple of old P!!!s I have as MythTV FrontEnds
and would like to guests girlfriends and me to be able to surf the web
and edit a document at, consequently it has lodes of stuff installed on
it that I don't want, I was just about to reinstall Etch to clear it
when I thought this way would be an interesting learning experience and
a challenge for me, this list and apt.
Ultimately if it doesn't work I'm running apt-proxy on my file server so
a reinstall doesn't take long.
Thanks for all your help I'll post my results
Ah ha. Now I understand your motivation.
I have to admit that I don't have much experience with sed, so this was
a learning exercise for me as well. Thanks Tyler.
Reading all the manuals in the world will not help one learn as much as
practical use.
A tip for you. Install Etch and only the base system. Then install
only the packages you want. You can end up with a very fast and light
system that way. (Not implying that the default desktops are slow, but
they do IMO, contain a lot of superfluous packages)
If you want a specific list packages for a good fast KDE system, I can
help you there.
Joe
Registerd Linux user #443289 at http://counter.li.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF/kLliXBCVWpc5J4RAv75AKCseqU5ZdCxxIQyhDKP3QsPV3bUIACfdq7L
63NK9khGNWJvFrBPtrM9Hy8=
=EZjB
-----END PGP SIGNATURE-----
>> As for why I'm doing this, well I have a PC which is ultimately
>> earmarked to be a headless MythTV BackEnd but I've been using it to
>> experiment with packages to figure out which ones I like for my personal
>> desktop and also for a couple of old P!!!s I have as MythTV FrontEnds
>> and would like to guests girlfriends and me to be able to surf the web
>> and edit a document at, consequently it has lodes of stuff installed on
>> it that I don't want, I was just about to reinstall Etch to clear it
>> when I thought this way would be an interesting learning experience and
>> a challenge for me, this list and apt.
>>
>> Ultimately if it doesn't work I'm running apt-proxy on my file server so
>> a reinstall doesn't take long.
>>
>>
> Ah ha. Now I understand your motivation.
>
> I have to admit that I don't have much experience with sed, so this was
> a learning exercise for me as well. Thanks Tyler.
>
> Reading all the manuals in the world will not help one learn as much as
> practical use.
>
My sentiment exactly
> A tip for you. Install Etch and only the base system. Then install
> only the packages you want. You can end up with a very fast and light
> system that way. (Not implying that the default desktops are slow, but
> they do IMO, contain a lot of superfluous packages)
>
> If you want a specific list packages for a good fast KDE system, I can
> help you there.
>
> Joe
>
That's sort of what I'm doing, I do a base install without even going
into the task selector or configuring apt sources
then I vi /etc/apt/sources.list and enter
deb http://192.168.4.99:9999/debian/ etch main
# deb-src http://192.168.4.99:9999/debian/ etch main
deb http://192.168.4.99:9999/security/ etch/updates main
# deb-src http://192.168.4.99:9999/security/ etch/updates main
by hand, (you may be able to guess the IP address of my apt-proxy)
then
apt-get install debian-archive-keyring
apt-key update
apt-get install ssh
So I can paste the rest into a terminal window from the comfort of my
own desktop.
apt-get update
apt-get upgrade
apt-get dist-upgrade
Get a better kernel depending on architecture
apt-get -s -V install linux-image-2.6-k7
apt-get install screen hdparm smartmontools ntp lm-sensors hddtemp sudo
then I need to edit
/etc/ntp.conf (my firewall runs ntpd)
/etc/smartd.conf
/etc/default/smartmontools
/etc/sensors.conf
# Update the hddtemp.db
wget http://www.guzu.net/linux/hddtemp.db
mv ./hddtemp.db /etc/
/etc/init.d/hddtemp restart
nc localhost 7634 ; echo
# install X a windowing environment and some tools
apt-get -s -V install xorg xfce4 thunar alsa-utils xfce4-cpugraph-plugin
xfce4-mixer-alsa xfce4-mixer xfce4-weather-plugin
apt-get -s -V install iceweasel icedove gaim gaim-encryption
gaim-irchelper gaim-themes gaim-guifications gaim-extendedprefs
apt-get -s -V install dia dcraw cinepaint inkscape xpdf mplayer
apt-get -s -V install abiword abiword-plugins myspell-en-gb
myspell-en-us openoffice.org openclipart-openoffice.org
openoffice.org-help-en-gb openoffice.org-help-en-gb libxrender1
libgl1-mesa-dri menu pstoedit imagemagick
then to /etc/sudoers add
ALL ALL = NOPASSWD: /usr/sbin/xfsm-shutdown-helper
That's as far as I've got, so far, it takes care of most of my everyday
tasks, and because of apt-proxy I can reproduce the install very fast.
I'm sure there'll be more but for the moment it's small, light and works
as well on my Athlon XP 3200s which a 1GB of ram as it does (with a few
omissions) on my P!!! 667s which have 256MB of ram. I haven't chosen an
SIP softvideophone yet, I like ekiga but it has so many gnome
dependencies that I'm reluctant to install it.
My top tip is apt-proxy has been having a *lot* of problems both
generally (see the bug reports) and with my weird internet connection
that allegedly requires me to use my ISPs proxy to access international
sites which then appears not to like relaying local sites, is to setup
your own squid proxy to beautify the internet for it and iron out some
of the kinks.
Good luck.
Why not just use aptitude interactivly (that's how I do it), limit the
display to everything but base system, mark those to be purged, remove
the limit, the unpurge anything you want to keep that you already have
installed. This assumes that you've alreay set up aptitude with
manual and automatic install (and don't have it install recommends by
default). Aptitude should then handle everything.
The only reason I ever reinstall is if I need to move drives around or
if there are features of the new installer that make it easier to
reinstall rather than reconfigure a base system.
YMMV
Doug.
I'll have a look at your method but I'm not used to aptitude and like
the simplicity and transparency of a command line approach.
Thanks.
I'm getting whatever version is in the standard Etch repository
The About Xfce 4 windows says
Xfce 4 Desktop Environment
version 4.3.99.2 (Xfce 4.4 RC2)
so..
> Just out of curiousities sake, why abiword and openoffice? I suppose
> you like abiword over writer, but need calc and impress and since it's
> all bundled....
>
Precisely, I use a word processor a lot and a spreadsheet rarely so
while I love Oo I don't want to have to fire it up every time I need to
edit a document.
I just had to install flash, first bit of non-free software on the
entire system, I feel all grubby.
[snip]
>> Looks like a fine system you're setting up there, of course, I'm
>> addicted to KDE, but xfce is a nice light desktop. Somehow I don't
>> think you're getting 4.4 that way, but how do I know what version is on
>> your proxy. Have you checked out icewm-crystal?
>>
>
> I'm getting whatever version is in the standard Etch repository
> The About Xfce 4 windows says
> Xfce 4 Desktop Environment
> version 4.3.99.2 (Xfce 4.4 RC2)
> so..
>
Pretty close. 4.4 is upstream. Sid is showing me 4.3.99.2 as well
>> Just out of curiousities sake, why abiword and openoffice? I suppose
>> you like abiword over writer, but need calc and impress and since it's
>> all bundled....
>>
>
> Precisely, I use a word processor a lot and a spreadsheet rarely so
> while I love Oo I don't want to have to fire it up every time I need to
> edit a document.
>
> I just had to install flash, first bit of non-free software on the
> entire system, I feel all grubby.
Most of the time I just use Kedit, Kate, Kwrite or Kword. If I need
real word processing I am starting to lean towards LaTex thanks to
people on this list.
I hear you about feeling grubby. I've got a few of those nasty little
non-free packages as well. Flash is one of them. Why? So I can see
the ads that I block with Ad Block Plus. :)
Really, some of the flash sites are too hilarious to miss.
Even the Linux Gazzette on tldp uses flash. Although they will show
fine using gnash.
- --
Registerd Linux user #443289 at http://counter.li.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGAOmQiXBCVWpc5J4RAobzAJ91C0CggIjiX4whHJ/MT0OM2gQQCwCgunex
DPk+231eJtKzh39xDh6QXmg=
=28Lx
-----END PGP SIGNATURE-----
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.
I would agree. End result is a broken system. Much better just to use
aptitude and mark packages individually. My addition to the script was
only as a learning exercise and Tyler fixed it to do exactly what was
wanted. I never would dream of running that.
What I don't get is why someone would even do something like that in the
first place. If one is worried about bloat, then install a base system
and add only packages that are needed.
Joe
- --
Registerd Linux user #443289 at http://counter.li.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGCLxxiXBCVWpc5J4RAlpXAJ9nvnyeLH3KPGR+4t0fTIPiyea+RwCfWYvD
pl62JhAcs2lQc/mZDbrWB80=
=BCnz
-----END PGP SIGNATURE-----
Well for reasons explained elsewhere in the thread I found myself in the
position of wanting something like this, and since I was going to
reinstall anyway, I thought this might be a fun alternative.
Another thought is that if I made a list of the packages in my base
install and had a way of subtracting the contents of one list from
another that might work.
Heh, I'm going to stick Sid on it for kicks before reinstalling etch and
setting it up as my MythTV backend.
you could use dpkg --get-selections on your target date (heck set up a
cron job to run it every day or every week or whatever and just
archive them) then to roll back use dpkg --set-selections followed
by apt-get dselect-upgrade.
provided you set things up in advance to record your selections as you
go so that you have the data you need, you can easily roll back.
A
Am 2007-03-18 11:08:28, schrieb Bob:
> Hi,
> How can I do this, the way I'd like it to work is
> cat /var/log/dpkg.log > ./list
> but filtering by date so it only includes packages installed after a
> certain time (grep sed?)
If you want to know the packages by installation/update date
you can use "tddebidate" but for this you need to put
<http://mentors.debian.net/> into your /etc/apt/sources.list
deb http://mentors.debian.net/debian unstable main
then
apt-get update
apt-get install tddebidate
The package works perfectly with Sarge, Etch and Sid on the console
and under X. To get only the packages, use
tddebidate --no-header |cut -d' ' -f3
Note: I am the Author :-)
Thanks, Greetings and nice Day
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSN LinuxMichi
0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)