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

Re: cleanlinks breaks xterm and apt



On Mon, Jan 24, 2005 at 04:51:52PM -0500, Hollis Easter wrote:
> This was apparently a bad idea, as it turns out that there are about a
> million dangling symlinks in subdirectories of /. Many of them have been
> removed, but after I saw the huge number of filenames scrolling past my
> screen, I killed cleanlinks with Ctrl-C. I had hoped that nothing bad
> would happen, but it did.
> 
> The first thing I noticed was that xterm no longer works. Indeed, `which
> xterm` gives no result. I thought I would reinstall it, to make sure
> that everything is fine.

What has happened is that all symlinks to other symlinks (and symlinks
to directories, if any) have been deleted by this bogus program, because
it assumes any symlink that doesn't point to a regular file is a broken
symlink.

To fix your xterm, try:

ln -s /etc/alternatives/x-terminal-emulator /usr/bin/x-terminal-emulator

If that doesn't work, try this (but this link shouldn't have been
deleted):

ln -s /usr/X11R6/bin/xterm /usr/bin/xterm


# but this one should still be ok


The symlinks to /etc/alternatives will be gone, as they are symlinks to
symlinks.  Almost all of these symlinks belong in /usr/bin.  You can fix
it by running the following:

for A in /etc/alternatives/*; do [ -x "$A" ] && ln -s "$A" /usr/bin; done

After that, you should be able to run all those programs again.

If it gives error messages about files already existing, that's ok, it
just means your runaway cleanlinks didn't have time to kill that
symlink.

If you don't want to put anything in /usr/bin that doesn't belong there,
symlink them to /usr/local/bin or some other directory instead.  But
cron scripts, etc. may not work if you do that.

Here is a list of ones (on my box) that don't belong in /usr/bin, or are
otherwise irregular:

ln -s /etc/alternatives/csh /bin/csh
ln -s /etc/alternatives/ipfwadm /sbin/ipfwadm
ln -s /etc/alternatives/mt /bin/mt
ln -s /etc/alternatives/nethack /usr/games/nethack
ln -s /etc/alternatives/rmt /sbin/rmt
ln -s /etc/alternatives/rzsh /bin/rzsh
ln -s /etc/alternatives/traceroute.sbin /usr/sbin/traceroute
ln -s /etc/alternatives/zsh-usrbin /usr/bin/zsh

good luck



Reply to: