Optware / Optware-ng

279 stars 52 forks source link

/opt/bin/update-alternatives on android doesn't work #200

Closed armando-basile closed 7 years ago

armando-basile commented 7 years ago

Hi all, i have optware-ng installed on my android box Amlogic S912 but after some ipkg updates now when is invoked /opt/bin/update-alternatives, process is block, i need to CTRL-C to exit.

alllexx88 commented 7 years ago

Hmm, I don't see how any ipkg updates could cause this. Could you try this:

  1. Install bash: ipkg update; ipkg install bash
  2. Edit /opt/bin/update-alternatives: change first line from #!/bin/sh to #!/opt/bin/bash

And test again

armando-basile commented 7 years ago

it's the same, i tryed to ipkg upgrade and during upgrade it launch

Configuring binutils.
pkg_run_script: Running script //opt/lib/ipkg/info/binutils.postinst.

that launch

/opt/bin/update-alternatives --install /opt/bin/strings strings /opt/bin/binutils-strings 50

i tryed also to launch this command manually but result is the same, process is block

alllexx88 commented 7 years ago

Let's find out where exactly it hangs. Add this line to /opt/bin/update-alternatives script right after the shebang (first line):

set -x

and launch /opt/bin/update-alternatives --install /opt/bin/strings strings /opt/bin/binutils-strings 50 again

armando-basile commented 7 years ago
+ set -e
+ ad=/opt/lib/ipkg/alternatives
+ '[' 5 -gt 0 ']'
+ arg=--install
+ shift
+ case $arg in
+ do_install /opt/bin/strings strings /opt/bin/binutils-strings 50
+ '[' 4 -lt 4 ']'
+ local link=/opt/bin/strings
+ local name=strings
+ local path=/opt/bin/binutils-strings
+ local priority=50
++ echo /opt/bin/binutils-strings
++ sed 's|/\+|/|g'
+ path=/opt/bin/binutils-strings
+ '[' -n '' ']'
+ register_alt strings /opt/bin/strings
+ '[' 2 -lt 2 ']'
+ local name=strings
+ local link=/opt/bin/strings
+ '[' '!' -d /opt/lib/ipkg/alternatives ']'
+ '[' -e /opt/lib/ipkg/alternatives/strings ']'
++ head -n 1 /opt/lib/ipkg/alternatives/strings
+ local olink=/opt/bin/strings
+ '[' /opt/bin/strings '!=' /opt/bin/strings ']'
+ return 0
+ add_alt strings /opt/bin/binutils-strings 50
+ '[' 3 -lt 3 ']'
+ local name=strings
+ local path=/opt/bin/binutils-strings
+ local priority=50
+ remove_alt strings /opt/bin/binutils-strings
+ '[' 2 -lt 2 ']'
+ local name=strings
+ local path=/opt/bin/binutils-strings
+ '[' '!' -f /opt/lib/ipkg/alternatives/strings ']'
++ echo /opt/bin/binutils-strings
++ protect_slashes
++ sed -e 's/\//\\\//g'
alllexx88 commented 7 years ago

Looks like it hangs on this command:

echo /opt/bin/binutils-strings | sed -e 's/\//\\\//g'

Which looks ok to me. Can you try to launch it manually? Also, what's the output of which sed? Possibly, there's something wrong with sed on your device.

armando-basile commented 7 years ago

manually echo command hangs equally, which sed command return /system/bin/sed can i try to use another sed ? from busybox ?

armando-basile commented 7 years ago

i saw that on my device there is /system/bin/sed -> toybox now i remapped to /system/bin/sed -> /system/xbin/sed (busybox) seems to work fine, i testing

armando-basile commented 7 years ago

i also needed to

ln -s /system/xbin/mount /opt/bin/mount
ln -s /system/xbin/df /opt/bin/df

because optware busybox give me errors:

df: /etc/mtab: No such file or directory
mount: no /etc/mtab
alllexx88 commented 7 years ago

seems to work fine

Great.

i also needed to

ln -s /system/xbin/mount /opt/bin/mount ln -s /system/xbin/df /opt/bin/df because optware busybox give me errors:

df: /etc/mtab: No such file or directory mount: no /etc/mtab

Android isn't Linux after all, and handles mounts in a different way, without using /etc/mtab