termux / proot

An chroot-like implementation using ptrace.
https://wiki.termux.com/wiki/PRoot
Other
745 stars 161 forks source link

proot error: 'SMP' not found(changing hostname) #240

Closed dontknowhy closed 1 year ago

dontknowhy commented 1 year ago

Problem description

umm.I saw #80 and i wanted to change my 'localhost' host name. BUT i can't use the command to run my container. aughhhhhh ( ) Steps to reproduce

Screenshot_20220815_222432.jpg Expected behavior

neofetch(dontknowhy/neofetch):

         _,met$$$$$gg.          dontknowhy@dontknow-pad
    ,g$$$$$$$$$$$$$$$P.       -----------------------
  ,g$$P"        """Y$$.".     OS: Debian GNU/Linux bookworm/sid aarch64
 ,$$P'              `$$$.     Host: HONOR BRT-W09
',$$P       ,ggs.     `$$b:   Kernel: 5.18.15-release
`d$$'     ,$P"'   .    $$$    Uptime: 12 hours, 48 mins
 $$P      d$'     ,    $$P    Packages: 1746 (dpkg)
 $$:      $$.   -    ,d$$'    Shell: zsh 5.9
 $$;      Y$b._   _,d$P'      Terminal: Termux 0.118.0
 Y$$.    `.`"Y$$$$P"'         Terminal Font: Ubuntu Mono Nerd Font Complete Mono
 `$$b      "-.__              CPU: MT8797 (8) @ 2.000GHz
  `Y$$                        Memory: 4537MiB / 7838MiB
   `Y$$.
     `$$b.
       `Y$$b.
          `"Y$b._
              `"""

Additional information

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=25084
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirrors.ustc.edu.cn/termux/apt/termux-main stable main
# sources.list.d/pointless.list
deb https://mirrors.ustc.edu.cn/termux-its-pointless/24 termux extras
# x11-repo (sources.list.d/x11.list)
deb https://mirrors.ustc.edu.cn/termux/apt/termux-x11/ x11 main
Updatable packages:
All packages up to date
termux-tools version:
1.26.0
Android version:
12
Kernel build information:
Linux localhost 4.14.186+ #1 SMP PREEMPT Thu Aug 4 21:24:09 CST 2022 aarch64 Android
Device manufacturer:
HONOR
Device model:
BRT-W09
michalbednarski commented 1 year ago

That is due to shell scripting gotcha, see for example https://github.com/koalaman/shellcheck/wiki/SC2089

dontknowhy commented 1 year ago

That is due to shell scripting gotcha, see for example https://github.com/koalaman/shellcheck/wiki/SC2089

The real problem is $(uname -v) It will output:#1 SMP PREEMPT Thu Aug 4 21:24:09 CST 2022 And PRoot will think the SMP is a program and PREEEMPT… is the program's arg. Now i replace $(uname -a) with WHAT: Screenshot_20220816_132957.jpg

dontknowhy commented 1 year ago

That is due to shell scripting gotcha, see for example https://github.com/koalaman/shellcheck/wiki/SC2089

The real problem is $(uname -v) It will output:#1 SMP PREEMPT Thu Aug 4 21:24:09 CST 2022 And PRoot will think the SMP is a program and PREEEMPT… is the program's arg. Now i replace $(uname -a) with WHAT: Screenshot_20220816_132957.jpg

umm… i think i resolve it… Screenshot_20220816_134034.jpg

dontknowhy commented 1 year ago

That is due to shell scripting gotcha, see for example https://github.com/koalaman/shellcheck/wiki/SC2089

The real problem is $(uname -v) It will output:#1 SMP PREEMPT Thu Aug 4 21:24:09 CST 2022 And PRoot will think the SMP is a program and PREEEMPT… is the program's arg. Now i replace $(uname -a) with WHAT: Screenshot_20220816_132957.jpg

umm… i think i resolve it… Screenshot_20220816_134034.jpg

umm… nope Once i run mv debian-test debian-backup And this line doesn't work anymore Screenshot_20220816_140807.jpg (you can see the hostname isn't your-hostname)

michalbednarski commented 1 year ago

This is because this parameter wasn't even passed to proot

Seems that passing multiple arguments where some contains spaces through variable is difficult in base, inline proot invocation and -k "..." argument away from variable into exec line

dontknowhy commented 1 year ago

This is because this parameter wasn't even passed to proot

Seems that passing multiple arguments where some contains spaces through variable is difficult in base, inline proot invocation and -k "..." argument away from variable into exec line

So i changed the last line to:$proot -k\ "\Linux\dontknow-pad\5.19.2-aarch64\$(uname -v)\aarch64\localdomain\-1\" $command /usr/bin/login $@ PS:$proot=$PREFIX/bin/proot