PDA

Bekijk de volledige versie : Fix for the /opt/bin/update-alternatives problem!!!



sollie
04-11-2007, 16:24
0a: ipkg-opt install uclibc-opt

0b: ipkg-opt install busybox-links

1: change first line (/opt/bin/update-alternatives):
- nano /opt/bin/update-alternatives
- #!/bin/sh ---> #!/opt/bin/bash

2: ln -s /opt/bin/busybox sort /opt/bin/sort

3: ln -s /opt/bin/busybox dirname /opt/bin/dirname

4: /opt/lib/ipkg/info/busybox-links.postinst

When you get this error:

head: error while loading shared libraries: head: symbol vprintf, version GLIBC_2.0 not defined in file libc.so.6 with link time reference update-alternatives: Error: cannot register alternative [ to /opt/bin/[ since it is already registered to

Do this: nano /opt/bin/update-alternatives and change tho folowing line:

local olink=`head -n 1 $ad/$name` ---> local olink=`$IPKG_OFFLINE_ROOT/opt/bin/busybox head -n 1 $ad/$name`


Sollie.

Rejan
04-11-2007, 17:03
Hi Sollie and thanx for the effort!

The second and third commands didn't work, already existed files.

The fourth gave this error:

head: error while loading shared libraries: head: symbol vprintf, version GLIBC_2.0 not defined in file libc.so.6 with link time reference
update-alternatives: Error: cannot register alternative [ to /opt/bin/[ since it is already registered to

Still doesn't work but it created the files in /opt/lib/ipkg/alternatives

Rejan.

sollie
04-11-2007, 17:34
Did you install uclibc-opt?

sollie
04-11-2007, 17:37
The second and third commands didn't work, already existed files.

I had that also.

Test:
- rm /opt/bin/sort
- sort
- ln -s /opt/bin/busybox sort /opt/bin/sort
- sort

You will see it workes.

Rejan
04-11-2007, 18:07
I did as you described and installed uclibc-opt

Still gets:

head: error while loading shared libraries: head: symbol vprintf, version GLIBC_2.0 not defined in file libc.so.6 with link time reference

Seems to hang aswell... break it with ctrl-c

Rejan.

pvarela
04-11-2007, 20:11
Hi Sollie,

I've the same problems as reported by Rejan, lots of erros as below:

head: error while loading shared libraries: head: symbol vprintf, version GLIBC_2.0 not defined in file libc.so.6 with link time reference
update-alternatives: Error: cannot register alternative sysctl to /opt/sbin/sysctl since it is already registered to

How can we solve this?

Regards,

PVarela

Rejan
04-11-2007, 20:43
The update-alternatives defaults the "head" command to old busybox from /apps/bin hence the error:

head: error while loading shared libraries: head: symbol vprintf, version GLIBC_2.0 not defined in file libc.so.6 with link time reference update-alternatives: Error: cannot register alternative [ to /opt/bin/[ since it is already registered to

Workaround:

Edit row in /opt/bin/update-alternatives from:

local olink=`head -n 1 $ad/$name`

to:

local olink=`$IPKG_OFFLINE_ROOT/opt/bin/busybox head -n 1 $ad/$name`


And then run:

/opt/lib/ipkg/info/busybox-links.postinst


Rejan.

sollie
04-11-2007, 21:20
Rejan, is this possible (step 3a)?:

ln -s /opt/bin/busybox head /opt/bin/head

Rejan
04-11-2007, 21:40
Hi Sollie, tried ln -s /opt/bin/busybox head /opt/bin/head but got file exist, even after rm /opt/bin/head

Editing the the file /opt/bin/update-alternatives with qualified path to head was the thing that helped.

After editing I did the /opt/lib/ipkg/info/busybox-links.postinst, checked everything and did a ipkg upgrade and all linked well and works again.

Rejan.

sollie
04-11-2007, 21:46
Hi Sollie, tried ln -s /opt/bin/busybox head /opt/bin/head but got file exist, even after rm /opt/bin/head

Thats what it says all the time, but its making the file.

Sollie.

Rejan
04-11-2007, 22:01
Hi Sollie, even though the file is made, the postinst-file didn't work until I did a fully qualified path in update_alternatives.

The link still defaults to the old busybox, easy way to test is to write the command: head-? and check versioninfo on Busybox. That was how I found out that it defaulted wrong version of Busybox.

sollie
04-11-2007, 22:16
K, thanks.

Sollie.

Faw
08-11-2007, 00:31
Ok, I've tried everything time to ask. :)

I have the same problem, syntax error in update-alternatives.
I tried everything on this post, and still nothing.

Right now, if I type 'head -?' I get the 'error while loading shared libraries'
if I type '/opt/bin/head -?' I get 'Busybox v1.7.2 blah,blah,blah' so I guess that's ok.

I changed the /opt/bin/update-alternatives line from:
local olink=`head -n 1 $ad/$name`
to:
local olink=`/opt/bin/busybox head -n 1 $ad/$name` and
local olink=`/opt/bin/head -n 1 $ad/$name`

and neither worked. Help please?

BTW, 'ln -s /opt/bin/busybox head /opt/bin/head' gave me an error message, 'ln -s /opt/bin/busybox /opt/bin/head' worked ok.

Rejan
08-11-2007, 17:24
Did you use full path as I described it:
local olink=`$IPKG_OFFLINE_ROOT/opt/bin/busybox head -n 1 $ad/$name`

Also


'ln -s /opt/bin/busybox head /opt/bin/head' gave me an error message, 'ln -s /opt/bin/busybox /opt/bin/head' worked ok.

The last one I think links busybox to the command /opt/bin/head instead of command '/opt/bin/busybox head' to '/opt/bin/head' which seems like a bad idea. So the linkname for you will be wrong according to syntax, or?

Usage: ln [OPTION] TARGET... LINK_NAME|DIRECTORY

Rejan.

Gizmo1007
08-11-2007, 20:15
Just to confirm,

The problem is "Syntax error" comes up when installing / running some busybox commands particularly at configuration of ipkg installs correct?

when you complete the tasks as defined by Sollie and Rejan is the expected output as per below?


update-alternatives: Linking //opt/sbin/losetup to /opt/bin/busybox
update-alternatives: Linking //opt/sbin/lsmod to /opt/bin/busybox
update-alternatives: Linking //opt/sbin/mkswap to /opt/bin/busybox
update-alternatives: Linking //opt/sbin/modprobe to /opt/bin/busybox
update-alternatives: Linking //opt/sbin/pivot_root to /opt/bin/busybox
update-alternatives: Linking //opt/sbin/rdate to /opt/bin/busybox
update-alternatives: Linking //opt/sbin/rmmod to /opt/bin/busybox
update-alternatives: Linking //opt/sbin/route to /opt/bin/busybox
update-alternatives: Linking //opt/sbin/start-stop-daemon to /opt/bin/busybox
update-alternatives: Linking //opt/sbin/swapoff to /opt/bin/busybox
update-alternatives: Linking //opt/sbin/swapon to /opt/bin/busybox
update-alternatives: Linking //opt/sbin/sysctl to /opt/bin/busybox


One suggestion for those of you struggling to get this going is to do an install of uclibc-opt first, then reinstall busybox and then do the edits per sollie's info

Rejan
08-11-2007, 21:24
Hi Gizmo1007!

The error is the way you stated 'Syntax error' also the expected result after change.

The problem was that: install of uclibc-opt first, then reinstall busybox and then do the edits per sollie's info did not work for me. Struggled for hours with it different solutions and that didn't work got the error everytime. Tried to downgrade to 1.5.1-1 didn't work either. The qualified path to the right busybox command 'head' in the 'update-alternatives' did it for me. The default 'head' command came from the wrong busybox (probably the one ASUS shipped it with)

Rejan.

Faw
09-11-2007, 01:14
Finally! Thanks everyone for the help.


The last one I think links busybox to the command /opt/bin/head instead of command '/opt/bin/busybox head' to '/opt/bin/head' which seems like a bad idea. So the linkname for you will be wrong according to syntax, or?

Usage: ln [OPTION] TARGET... LINK_NAME|DIRECTORY

Rejan.

I tested it and it works: ln -s /opt/bin/busybox /opt/bin/head
It seems busybox checks the arg[0] (program name, in this case head) to see the command. If I create that link I get the correct help:

Busybox 1.7.2 ....
Usage head [OPTION] ...

Gizmo1007
11-11-2007, 03:18
On a slightly different tangent,

Does anyone have a problem when running ps command with busybox 1.7.2
I can only run ps -w
nothing else will work.
Is there another way to check what process are being executed currently.
I know it's supposed to be ps -x but busybox won't allow me to run that option, only gives -w as available
any other commands that do the similar?

al37919
11-11-2007, 08:31
if you install procps ipkg you will get fully functional ps

Gizmo1007
11-11-2007, 12:20
thanks for last pointer it worked out,

One final problem which I have noticed since installing busybox ver 1.7 is that when I power down the unit and repower again windows cannot see the WL700 as a share drive.
You can see ushare as a media server but cannot see WL700.
When I reset the unit it comes up fine.
Question is there any way in rc.local to correct this?

gratitude182
18-12-2007, 14:53
sorry... now it works

mumsoft
24-01-2008, 23:11
Maybe superfluous, but the original title Sollie gave: Fix for the /opt/bin/update-alternatives problem!!!, did not tell me very much, when I first saw it. I really never had heard of update-alternatives. Hence, also not of any problem arising from it...

But, after installing a new package with ipkg these days, which I had not done for months, gave me all sorts of syntax errors and post-errors, as with so many people here.
But NOW I understand that's because the newer ipkg scripts in /opt/bin/update-alternatives use /bin/sh in stead of /opt/bin/bash. AHA.

I changed step 2 and 3 from Sollie in:
2: ln -s /opt/bin/busybox /opt/bin/sort
3: ln -s /opt/bin/busybox /opt/bin/dirname
and added:
3b: ln -s /opt/bin/busybox /opt/bin/head

Now ipkg does its job fine.
So I guess this is the final recipe (partly), let alone that if you run K.C.Furge's latest 1.0.7.8 firmware with KCSHELL set, this should not be needed anymore.:p

Marc

metamorphose
14-03-2008, 21:41
Hi there,


a good advice for anyone who has kfurge custom firmware and has ever encountered this problem, above steps will not work, if your environment variables PATH and LD_LIBRARY_PATH are not set properly before!

You must apply:

export PATH=/opt/bin:${PATH}
export LD_LIBRARY_PATH=/opt/lib:${LD_LIBRARY_PATH}

pitsch
06-04-2008, 03:22
guess i'm stuck and considering to do a complete reinstall after failed upgrade.
changes made, still get the following errors, symlinks do not work... maybe someone found a fix here?

ipkg upgrade


Configuring bzip2
update-alternatives: Error: cannot register alternative bzip2 to /opt/bin/bzip2 since it is already registered to
postinst script returned status 1
ERROR: bzip2.postinst returned 1
Configuring e2fsprogs
update-alternatives: Error: cannot register alternative chattr to /opt/bin/chattr since it is already registered to
update-alternatives: Error: cannot register alternative lsattr to /opt/bin/lsattr since it is already registered to
update-alternatives: Error: cannot register alternative fsck to /opt/sbin/fsck since it is already registered to
postinst script returned status 1
ERROR: e2fsprogs.postinst returned 1
Configuring findutils
update-alternatives: Error: cannot register alternative find to /opt/bin/find since it is already registered to
update-alternatives: Error: cannot register alternative xargs to /opt/bin/xargs since it is already registered to
postinst script returned status 1
ERROR: findutils.postinst returned 1
Configuring ncurses
update-alternatives: Error: not linking //opt/bin/clear to /opt/bin/ncurses-clear since //opt/bin/clear exists and is not a link
postinst script returned status 1
ERROR: ncurses.postinst returned 1
Nothing to be done


/opt/lib/ipkg/info/busybox-links.postinst


update-alternatives: Error: cannot register alternative bzip2 to /opt/bin/bzip2 since it is already registered to
update-alternatives: Error: cannot register alternative chattr to /opt/bin/chattr since it is already registered to
update-alternatives: Error: cannot register alternative bzip2 to /opt/bin/bzip2 since it is already registered to
update-alternatives: Error: not linking //opt/bin/clear to /opt/bin/ncurses-clear since //opt/bin/clear exists and is not a link
update-alternatives: Error: cannot register alternative find to /opt/bin/find since it is already registered to
update-alternatives: Error: cannot register alternative lsattr to /opt/bin/lsattr since it is already registered to
update-alternatives: Error: cannot register alternative lsattr to /opt/bin/lsattr since it is already registered to
update-alternatives: Error: cannot register alternative xargs to /opt/bin/xargs since it is already registered to
update-alternatives: Error: cannot register alternative fsck to /opt/sbin/fsck since it is already registered to

uclibc-opt installed,as well as busybox force-reinstalled, and changes made in

/opt/bin/update-alternatives
#!/opt/bin/
local olink=`$IPKG_OFFLINE_ROOT/opt/bin/busybox head -n 1 $ad/$name`

pitsch
06-04-2008, 14:17
set

PATH='/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'


ipkg status | grep Conflicts

Conflicts: busybox-links
Conflicts: vorbis-tools
Conflicts: thttpd
Conflicts: wget-ssl

:confused:

mumsoft
06-04-2008, 21:46
set


ipkg status | grep Conflicts


:confused:

Maybe there is nothing wrong. I had installed wget, that conflicts with wget-ssl. Now I removed wget, and installed wget-ssl. That conflicts with wget, but that is just informative, because wget is not there anymore. So have a look in the list that ipkg status produces to spot the places with Conflicts.
For instance:

Package: wget-ssl
Version: 1.11.1-1
Depends: openss
Conflicts: wget
Status: install user installed
Architecture: mipsel
Installed-Time: 1207514113


and


Package: ivorbis-tools
Version: 1.0-6
Depends: libvorbis, libogg, libao, libcurl, libvorbisidec
Conflicts: vorbis-tools
Status: install user installed
Architecture: mipsel

Regards
Marc

Maccro
26-04-2008, 15:25
Can someone post their full, working copy?

Thanks!

Actually it's the update-alternatives config file I need.

mumsoft
26-04-2008, 15:46
Can someone post their full, working copy?

Thanks!

Actually it's the update-alternatives config file I need.

Here is mine (rename it without extension .txt)

regards,
Marc

Maccro
26-04-2008, 21:09
Here is mine (rename it without extension .txt)

regards,
Marc

That did the trick...thanks!