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

Re: /usr/bin/editor missing: update-alternatives problem SOLVED

On Thu, 2004-08-26 at 14:35, Ross Boylan wrote:
> Somehow /usr/bin/editor got deleted, and this is causing problems
> upgrading many of my editors.
> I first saw this with vim
> (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=267095) a week ago,
> but it's since bit me with many others (I track testing).
> I suspect this has something to do with the fact that, in an effort to
> make emacs my default text editor, I pointed editor at
> /etc/alternatives/emacs (rather than a "real" binary):
> # update-alternatives --display editor
> editor - status is auto.
>  link currently points to /etc/alternatives/emacs
> /usr/bin/emacs21 - priority 0
> /bin/ed - priority -100
>  slave editor.1.gz: /usr/share/man/man1/ed.1.gz
> /usr/bin/nvi - priority 19
>  slave editor.1.gz: /usr/share/man/man1/nvi.1.gz
> /usr/bin/vim - priority 120
>  slave editor.1.gz: /usr/share/man/man1/vim.1.gz
> /bin/nano - priority 40
>  slave editor.1.gz: /usr/share/man/man1/nano.1.gz
> /etc/alternatives/emacs - priority 150
>  slave editor.1.gz: /etc/alternatives/emacs.1.gz
> Current `best' version is /etc/alternatives/emacs.
> (That was from before /usr/bin/editor vanished, though I see about the
> same output now).
> I suspect the real problem is not vim, but either that I have used
> update-alternatives improperly, or that it has a bug.
> Can anyone shed any light on this, or even on whether I should reassign
> the bug elsewhere (dpkg?)?
> Thanks
> Ross Boylan
> P.S. If you could cc this address that would be great, as I am
> subscribed through a different one.
Stefan O'Rear wrote:
Which /usr/bin/editor?

~/linux-2.6.0/drivers/scsi/aic7xxx %% ls -l /usr/bin/editor /etc/alternatives/editor
lrwxrwxrwx    1 root     root           12 Oct  4  2003 /etc/alternatives/editor -> /usr/bin/vim
lrwxrwxrwx    1 root     root           24 Aug  2  2003 /usr/bin/editor -> /etc/alternatives/editor
~/linux-2.6.0/drivers/scsi/aic7xxx %% 

Which of those two files is missing? The second you can recreate easily:

ln -s /etc/alternatives/editor /usr/bin/editor

The first you could probably do:

update-alternatives --auto editor

Did you say you pointed /usr/bin/editor at /etc/alternatives/emacs?
Don't do that. Instead, restore the link to /etc/alternatives/editor,

update-alternatives --config editor

Select emacs from the list.

In response to his question, the /usr/bin/editor, not
/etc/alternatives/editor, was the one that got zapped.  I followed his
advice to recreate it.  Thank you.

I pointed /etc/alternatives/editor, not /usr/bin/editor (directly) to
/etc/alternatives/emacs.  I did this with update-alternatives.

Those fixes exposed additional problems, as shown in this upgrade log
Setting up vim (6.3-013+2) ...
mv: cannot stat `editor': No such file or directory
update-alternatives: unable to rename editor to /usr/bin/editor: Invalid
cross-device link

The problem here was that when I used update-alternatives I said
"editor" in some places I should have said "/usr/bin/editor".  As a
result, dpkg couldn't find the file when the postint script said, for
    for i in vi view ex editor ; do
      update-alternatives \
        --install /usr/bin/$i $i /usr/bin/vim 120 \
        --slave /usr/share/man/man1/$i.1.gz $i.1.gz
That, incidentally, show the correct use of paths for

I manually edited /var/lib/dpkg/alternatives/editor to put paths where
they belonged, and everything seems back to normal

See bug 26705 for more on this issue.

Ross Boylan                                      wk:  (415) 502-4031
530 Parnassus Avenue (Library) rm 115-4          ross@biostat.ucsf.edu
Dept of Epidemiology and Biostatistics           fax: (415) 476-9856
University of California, San Francisco
San Francisco, CA 94143-0840                     hm:  (415) 550-1062

Reply to: