Hello world, I felt like doing some scripting over the weekend, and managed to come up with "cruft", version 0.9 of which is available from http://va.debian.org/~ajt/ in i386 .deb format, or as deb-source. Please note, it's a pre-release, so I'm not particularly sure that I've ironed out all the bugs, and it *does* run as root so bad things *can* happen. That said, none have happened to *me*, yet, so... :) Anyway, it's based on an idea of, iirc, Manoj's -- writing a script that does a "find /" and then compares the output of that to the .list files that dpkg maintains, to see just how accurate dpkg's picture of your system is. Considering that doing that alone left a few thousand files unaccounted for, I added a few extra rules, and tidied up the output and the like a little, and ended up with a program that checks through: dpkg's database the alternatives database user's home directories rc.d scripts lost+found files /usr/local files /home/ftp files (and then goes ahead and just accepts everything in /dev, /etc, /usr/src, and /var/www because I couldn't think of good ways to determine what should be in them :( ) It's also possible to add local "explanations" for files, for example my system has an unpack-the-tgz installation of a program called "possum" in /home/possum, so I've added a short script that produces a list of all those files in /usr/local/lib/cruft/explain/possum, which cruft automatically includes in its considerations. When it's done, it produces two sets of reports: files that should be on your system, according to one set of "explanations" (eg, the alternatives database thinks it should have /etc/alternatives/editor.1 pointing somewhere, but there's no such file in /etc), but aren't. and files that are on your system, but cruft couldn't see a reason for them to be there. The former are categorized by "explanation", the latter by mount point, and all are dumped in /var/spool/cruft/, at the moment. It takes about ten minutes to run on my system (600MB in /usr, another 600MB scattered through /var and /home, all IDE), which doesn't seem too bad, although I'm hoping I can shave a little off that time. On my system it uses up about 10MB in /var/spool/cruft, and can get up to about 5MB in /tmp while sort(1) dumps temporary data. I'd appreciate it if some of you kind folks would be willing to have a look through it and perhaps run it over your system and if you can either give me some procedures for making sense of a few more files that are left lying around on your system; or suggestions on improving the output format. I'd _really_ like some way of working out what stuff should be in /etc, and what stuff shouldn't, but a number of the files in there are made in postinsts and I couldn't come up with a nice way of dealing with that. As an example of the output it produces, here's the contents of /var/spool/cruft/miss_*, and /var/spool/cruft/unex_in_{home,root}. miss_alternatives: /etc/alternatives/editor.1 /etc/alternatives/vi.1.gz /etc/alternatives/view.1.gz /usr/man/man1/pstogif.xemacs19.1.gz /usr/man/man1/pstogif.xemacs20.1.gz miss_dpkg: /etc/cron.daily/apache /etc/ftpd/ftpconversions /etc/ftpd/msg.toomany /etc/ftpd/welcome.msg /etc/news/control.ctl /sbin/ldconfig.new /usr/bin/perl.dist miss_lost_found: /usr/local/lost+found unex_in_home: /home/quota.user unex_root: /boot/boot.0300 /boot/boot.0301 /boot/boot.0302 /boot/map /lib/ld.so /lib/modules/2.0.33/fs/binfmt_aout.o /lib/modules/2.0.33/fs/binfmt_java.o /lib/modules/2.0.33/fs/fat.o /lib/modules/2.0.33/fs/msdos.o /lib/modules/2.0.33/fs/nfs.o /lib/modules/2.0.33/fs/smbfs.o /lib/modules/2.0.33/fs/vfat.o /lib/modules/2.0.33/ipv4/ip_masq_cuseeme.o /lib/modules/2.0.33/ipv4/ip_masq_ftp.o /lib/modules/2.0.33/ipv4/ip_masq_irc.o /lib/modules/2.0.33/ipv4/ip_masq_quake.o /lib/modules/2.0.33/ipv4/ip_masq_raudio.o /lib/modules/2.0.33/ipv4/ip_masq_vdolive.o /lib/modules/2.0.33/ipv4/ipip.o /lib/modules/2.0.33/modules.dep /lib/modules/2.0.33/net/bsd_comp.o /lib/modules/2.0.33/net/dummy.o /lib/modules/2.0.33/net/new_tunnel.o /lib/modules/2.0.33/net/slip.o /mail /mnt/cdrom /mnt/fd0-dos /mnt/fd0-ext2 /mnt/fd0-vfat /mnta /mntb /sbin/ldconfig /sbin/request-route /vmlinuz /vmlinuz.old Finally, thanks to the folks on #debian for their tips, tricks and diverting banter when I got stuck, and in particular to Adam "doogie" Heath, for his suggestions and complaining that error messages like "rm: *: No such file or directory" aren't really as reassuring as they could be. :) Cheers, aj -- Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/> I don't speak for anyone save myself. PGP encrypted mail preferred. ``It's not a vision, or a fear. It's just a thought.''
Attachment:
pgp4fCobcL4dv.pgp
Description: PGP signature