HELP with java issue: Too many levels of symbolic links

after ‘zypper dup’ to 12.1 mile 3 i get this error in super user terminal:

/usr/sbin/update-alternatives --config java

update-alternatives: error: cannot stat /usr/bin/gvim: Too many levels of symbolic link

any help is greatly appreciated … theo

As it says, you have too many levels of symbolic link indirection or even a loop. See where /usr/bin/gvim points to, follow it and see where it takes you, repeat until you find out where it eventually points in a real file or goes in a loop.

i am pretty much a gui guy, who just started diving into cli … how do i “[s]ee where /usr/bin/gvim points to, follow it and see where it takes you, repeat until you find out where it eventually points in a real file or goes in a loop.”? … i appreciate, if you could help me with the cl-code … thanks, theo

ls -l /usr/bin/gvim

then see where it links to, and repeat with the target.

here is the output:

ls -l /usr/bin/gvim

lrwxrwxrwx 1 root root 3 Aug 22 06:05 /usr/bin/gvim -> vim
Apollo:~ # ls -l /usr/bin/vim
lrwxrwxrwx 1 root root 8 Aug 22 00:31 /usr/bin/vim -> /bin/vim
Apollo:~ # ls -l /usr/bin/vin
lrwxrwxrwx 1 root root 8 Aug 22 00:32 /usr/bin/vim -> /bin/vim
Apollo:~ #

Your third step is wrong, do:

ls -l /bin/vim

and continue.

intriguing …

Apollo:~ # ls -l /bin/vim
lrwxrwxrwx 1 root root 21 Aug 22 00:31 /bin/vim -> /etc/alternatives/vim
Apollo:~ # ls -l /etc/alternatives/vim
lrwxrwxrwx 1 root root 13 Jan 19 2011 /etc/alternatives/vim -> /usr/bin/gvim
Apollo:~ # ls -l /usr/bin/gvim
lrwxrwxrwx 1 root root 3 Aug 22 06:05 /usr/bin/gvim -> vim
Apollo:~ #
i ended back at the beginning … so … what do i now to get my java working … thanks for all your help
theo

Do you have the package gvim installed? Maybe that will provide a real target file. (I don’t have it installed so I can’t say.)

looks like i’ve got the package …

zypper install gvim
Loading repository data…
Reading installed packages…
‘gvim’ is already installed.
No update candidate for ‘gvim-7.3-11.1.x86_64’. The highest available version is already installed.
Resolving package dependencies…

Nothing to do.
Apollo:~ #

Since you are playing with 12.1M3 I can’t say what would be the right thing to do here, but you could find where the real gvim is installed with:

rpm -ql gvim | grep gvim

One of those files will be the real binary, link to that:

ln -sf <the-real-gvim-path> /etc/alternatives/vim

I suspect you have a transitional issue due to playing around with a milestone release.

Apollo:~ # rpm -ql gvim | grep gvim
/etc/gvimrc
/usr/bin/egvim
/usr/bin/gvim
/usr/bin/gvim-normal
/usr/bin/gvimdiff
/usr/bin/rgvim
/usr/share/applications/gvim.desktop
/usr/share/doc/packages/gvim
/usr/share/doc/packages/gvim/README.Japanese-XIM
/usr/share/doc/packages/gvim/gvimrc_example.vim
/usr/share/doc/packages/gvim/suse.gvimrc
/usr/share/icons/hicolor/48x48/apps/gvim.png
Apollo:~ # ln -sf /usr/share/doc/packages/gvim /etc/alternatives/vim
ln: accessing `/etc/alternatives/vim’: Too many levels of symbolic links
Apollo:~ #

does that mean the issue is at
/etc/alternatives/vim
?
theo

No, I suspect the real binary is /usr/bin/gvim-normal, but you had existing files that prevented that package from installing properly when you did the upgrade. Try forcing a reinstall of gvim.

If that doesn’t work, try this:

ln -sf /usr/bin/gvim-normal /etc/alternatives/vim

already tried both … only could update in yast (uninstall generated the same error: too many level symbolic links; and did not proceed) the output of gvim-normal and gvim.desktop:

Apollo:~ # ln -sf /usr/bin/gvim-normal /etc/alternatives/vim
ln: accessing /etc/alternatives/vim': Too many levels of symbolic links Apollo:~ # ln -sf /usr/share/applications/gvim.desktop /etc/alternatives/vim ln: accessing /etc/alternatives/vim’: Too many levels of symbolic links
Apollo:~ #

this is weird … theo

Ah, remove /etc/alternatives/vim before doing the link or it will try to resolve the link again.

beautiful … you’re my hero … it worked … thank you, thank you so much … theo

Apollo:~ # rm /etc/alternatives/vim
Apollo:~ # ln -sf /usr/bin/gvim-normal /etc/alternatives/vim
Apollo:~ # /usr/sbin/update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status

0 /usr/lib64/jvm/jre-1.7.0-sun/bin/java 1700 auto mode

  • 1 /usr/lib64/jvm/jre-1.7.0-sun/bin/java 1700 manual mode
    2 /usr/lib64/jvm/jre-1.6.0-sun/bin/java 1617 manual mode
    3 /usr/lib64/jvm/jre-1.5.0-gcj/bin/java 1500 manual mode

Press enter to keep the current choice*], or type selection number:

Great. Please report this bug against 12.1 to help the devs.

topitz wrote:
> beautiful … you’re my hero … it worked … thank you, thank you so
> much … theo
>
> Apollo:~ # rm /etc/alternatives/vim
> Apollo:~ # ln -sf /usr/bin/gvim-normal /etc/alternatives/vim

I don’t think so. What I would expect is:

/etc/alternatives/vim -> /bin/vim-normal
/etc/alternatives/gvim -> /usr/bin/gvim-normal

Unless things have changed again.