Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 394131 - /etc/alternatives/emacs link is wrong after upgrading emacs
/etc/alternatives/emacs link is wrong after upgrading emacs
Status: CLOSED DUPLICATE of bug 474578
Product: Fedora
Classification: Fedora
Component: emacs (Show other bugs)
All Linux
low Severity high
: ---
: ---
Assigned To: Daniel Novotny
Fedora Extras Quality Assurance
: 437599 439076 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2007-11-21 08:27 EST by Jonathan Kamens
Modified: 2009-02-16 09:36 EST (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-02-16 09:36:03 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jonathan Kamens 2007-11-21 08:27:47 EST
Afer upgrading to emacs-22.1.50-1.fc9, /etc/alternatives/emacs points at
/usr/bin/emacs-22.1, which doesn't exist.  It should point at
/usr/bin/emacs-22.1.50, I think.
Comment 1 Michel Alexandre Salim 2008-01-26 20:01:52 EST
This is bizarre, as both the F-8 and devel versions of the Emacs spec files
properly call alternatives in %preun and %posttrans. Might it be a path problem?
It's calling alternatives without /usr/sbin, and I'm not sure it's in the path
(on the other hand, I did not notice any error when upgrading)
Comment 2 Chip Coldwell 2008-01-28 12:52:04 EST
Usually the problem is that the /usr/bin/emacs file/link already exists, because
it isn't properly removed by the scriptlet in the *old* package during the
upgrade process.  /sbin/alternatives won't overwrite it.

The scriptlet ordering is a bit non-intuitive (to my mind).  See


for details, but basically, because the %postun of the old package runs *after*
the %post of the new package during an upgrade, if the %postun of the old
package removes the old link, it will happen *after* the %post of the new
package has tried to install it.  That's why I moved it all to %posttrans.

What should work is removing the old package and then installing the new one
(i.e. do the upgrade in two steps).

Comment 3 Michael Schwendt 2008-01-29 10:28:22 EST
$ sudo yum -y remove emacs
$ sudo yum -y install emacs
$ which emacs
/usr/bin/which: no emacs in

$ cd /usr/bin
$ ll emacs
lrwxrwxrwx 1 root root 23 2007-06-28 10:26 emacs -> /etc/alternatives/emacs

$ rpm -q emacs
Comment 4 Chip Coldwell 2008-01-29 12:23:41 EST
What does the /etc/alternatives/emacs symlink point to?

Comment 5 Michael Schwendt 2008-01-29 13:22:15 EST
/etc/alternatives/emacs -> /usr/bin/emacs-22.1

which doesn't exist. Only /usr/bin/emacs-22.1.50 exists.
Comment 6 Chip Coldwell 2008-01-29 13:50:42 EST
So the problem is that the old package didn't properly remove the symlink; thus
when the new package was installed, alternatives didn't overwrite it.  Try this:

remove emacs.
Manually remove the two (broken) symlinks /usr/bin/emacs and
install emacs.

And let me know if the symlink is there and working.

Comment 7 Michael Schwendt 2008-01-29 14:47:21 EST

# rm -f /etc/alternatives/emacs   /usr/bin/emacs
# yum -y remove emacs
# yum -y install emacs
Transaction Test Succeeded
Running Transaction
  Installing: emacs                        ######################### [1/1] 
failed to read link /usr/bin/emacs: No such file or directory
# which emacs
/usr/bin/which: no emacs in
# ll /usr/bin/emacs*
lrwxrwxrwx 1 root root      23 2008-01-29 20:45 /usr/bin/emacs ->
-rwxr-xr-t 1 root root 5563696 2007-12-13 19:58 /usr/bin/emacs-22.1.50
-rwxr-xr-x 1 root root   18660 2007-12-13 19:59 /usr/bin/emacsclient
# ll /etc/alternatives/emacs
lrwxrwxrwx 1 root root 19 2008-01-29 20:45 /etc/alternatives/emacs ->
Comment 8 Ulrich Drepper 2008-03-08 02:20:05 EST
In rawhide, the emacs link is now completely gone.

Comment 9 Chip Coldwell 2008-03-18 09:35:15 EDT
*** Bug 437599 has been marked as a duplicate of this bug. ***
Comment 10 Matt Domsch 2008-04-20 21:57:09 EDT
This still is a problem.  I upgraded what was a previously up-to-date rawhide
system with emacs-22.1.50-4.fc9, to the new rawhide emacs-23.0.60-2.fc9.  The
/usr/bin/emacs symlink points to /etc/alternatives/emacs. 
/etc/alternatives/emacs still pointed pointed to the now removed older package.

# alternatives  --display emacs
emacs - status is auto.
 link currently points to /usr/bin/emacs-22.1
/usr/bin/emacs-22.1 - priority 80
/usr/bin/emacs-23.0.60 - priority 80
Current `best' version is /usr/bin/emacs-22.1.

Of course, this breaks any system where emacs was working properly before. 
Users must manually run:

# alternatives --set emacs /usr/bin/emacs-23.0.60

to restore emacs to working.  This isn't good behavior.
Comment 11 Jens Petersen 2008-04-28 20:25:47 EDT
*** Bug 439076 has been marked as a duplicate of this bug. ***
Comment 12 Jens Petersen 2008-04-28 20:27:34 EDT
Moving this to F9Blocker since bug 439076 was on the blocker list.

Is it actually possible to fix this for people upgrading from F8?
Comment 13 Braden McDaniel 2008-04-30 12:03:02 EDT
Still a problem with 22.2-1.fc9.

I removed emacs, removed /etc/alternatives/emacs. After then installing
emacs-22.2-1.fc9, I now have a fresh dead /etc/alternatives/emacs symlink:

# ll /etc/alternatives/emacs
lrwxrwxrwx 1 root root 19 2008-04-30 11:50 /etc/alternatives/emacs ->
Comment 14 Bill Nottingham 2008-05-02 10:48:23 EDT
Can someone reproduce this with 22.2-4.fc9?
Comment 15 Brad Walker 2008-05-02 11:09:07 EDT
On my F9-preview box I yum erased emacs, installed emacs-22.1-8.fc8 and then
upgraded to emacs-22.2-4.fc9 using rpm -Uvh. It's still affected:

[root@brad ~]# alternatives --display emacs
emacs - status is auto.
 link currently points to /usr/bin/emacs-22.1
/usr/bin/emacs-22.1 - priority 80
/usr/bin/emacs-22.2 - priority 80
Current `best' version is /usr/bin/emacs-22.1.
Comment 16 Braden McDaniel 2008-05-03 00:38:52 EDT
And in the situation I described in comment #13, 22.2-4.fc9 behaves exactly the
Comment 17 Bill Nottingham 2008-05-05 15:34:25 EDT
This is a problem with the F-8 (or similar) packages that have:

if [ $1 -eq 0 ] ; then
  alternatives --remove emacs %{_bindir}/emacs-%{version}

The current latest update for F-8 (22.1-8.fc8) has this problem.

This can't be fixed in F-9 - we need to push a newer build for F-8 that removes
the conditional from the %preun. These fixes appear to already be in CVS, so we
just need to build and push an update.
Comment 18 Bill Nottingham 2008-05-05 15:38:39 EDT
As it's not a F-9 fix, removing from the F9 Blocker.
Comment 19 Braden McDaniel 2008-05-05 16:08:35 EDT
Per the scenario I described, there would appear to be something still
malfunctioning irrespective of F-8.
Comment 20 Brad Walker 2008-05-07 11:25:30 EDT
I did a clean install of 22.1-8.fc8 on F9-preview with rpm, upgraded to
22.1-11.fc8 with rpm, and then yum upgraded to 22.2-4.fc9. The 22.2 package
updated the alternatives as it should.
Comment 21 Bug Zapper 2008-05-13 23:58:15 EDT
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
Comment 22 Braden McDaniel 2008-05-14 14:06:59 EDT
If this bug is just about upgrading (as the summary suggests), then perhaps it's
fixed. I've created bug 446467 to cover the problem I'm observing.
Comment 24 Daniel Novotny 2009-02-16 09:36:03 EST

*** This bug has been marked as a duplicate of bug 474578 ***

Note You need to log in before you can comment on or make changes to this bug.