termux-app icon indicating copy to clipboard operation
termux-app copied to clipboard

[Bug]: can't change shell to zsh

Open ballo opened this issue 9 months ago • 5 comments

Problem description

Can't change shell to zsh

Steps to reproduce the behavior.

chsh -s $(which zsh) /data/data/com.termux/files/usr/bin//data/data/com.termux/files/usr/bin/zsh is not an executable file!

What is the expected behavior?

No response

System information

  • Termux application version:
  • Android OS version: 15
  • Device model: pixel 7 POS
  • zsh --version zsh 5.9 (aarch64-unknown-linux-android)

ballo avatar Mar 25 '25 01:03 ballo

This also DOES NOT WORK: chsh -s zsh It executes without error but does nothing. Please help me get out of 1990s bash hell

ballo avatar Mar 25 '25 01:03 ballo

As a workaround, you can call chsh without arguments and then type zsh at the prompt.

mentalisttraceur avatar Apr 06 '25 16:04 mentalisttraceur

zsh only shows up when logging in via ssh.

Did you guys really hard code bash into termux?

ballo avatar Apr 07 '25 22:04 ballo

We did not hardcode bash into Termux. It's just the default shell.

chsh -s zsh followed by restarting Termux works just fine on my device.

The user's shell is determined via ~/.termux/shell in Termux

// ~% ls -l ~/.termux/shell
lrwxrwxrwx. 1 u0_a215 u0_a215 39 Apr  8 02:02 /data/data/com.termux/files/home/.termux/shell -> /data/data/com.termux/files/usr/bin/zsh

Please verify that it is correctly pointing at Zsh. Also make sure your packages are up to date using pkg up.

Full termux-info output

Termux Variables:
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP__APK_FILE=/data/app/~~60Ek9m3hh5NpYxFhNrKDxQ==/com.termux-NBt6rfnzEkChmN0Ise-0Uw==/base.apk
TERMUX_APP__APK_RELEASE=GITHUB
TERMUX_APP__APP_VERSION_CODE=1021
TERMUX_APP__APP_VERSION_NAME=0.119.0-beta.2
TERMUX_APP__BUILD_DATA_DIR=/data/data/com.termux
TERMUX_APP__DATA_DIR=/data/user/0/com.termux
TERMUX_APP__IS_DEBUGGABLE_BUILD=true
TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE=false
TERMUX_APP__LEGACY_DATA_DIR=/data/data/com.termux
TERMUX_APP__PACKAGE_NAME=com.termux
TERMUX_APP__PID=9824
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c215,c256,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_APP__TARGET_SDK=28
TERMUX_VERSION=0.119.0-beta.2
TERMUX__APPS_DIR=/data/user/0/com.termux/termux/apps
TERMUX__HOME=/data/data/com.termux/files/home
TERMUX__PREFIX=/data/data/com.termux/files/usr
TERMUX__ROOTFS=/data/data/com.termux/files
TERMUX__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c215,c256,c512,c768
TERMUX__UID=10215
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.dev/apt/termux-main stable main
# root-repo (sources.list.d/root.list)
deb https://packages-cf.termux.dev/apt/termux-root root stable
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
# x11-repo (sources.list.d/x11.list)
deb https://packages-cf.termux.dev/apt/termux-x11 x11 main
Updatable packages:
binutils-bin/stable 2.44-3 aarch64 [upgradable from: 2.43.1]
binutils-libs/stable 2.44-3 aarch64 [upgradable from: 2.43.1]
binutils/stable 2.44-3 aarch64 [upgradable from: 2.43.1]
glib-bin/stable 2.84.1 aarch64 [upgradable from: 2.84.0-2]
glib/stable 2.84.1 aarch64 [upgradable from: 2.84.0-2]
gtk-layer-shell/x11 0.9.1 aarch64 [upgradable from: 0.9.0]
imlib2/stable 1.12.5 aarch64 [upgradable from: 1.12.4-1]
jackett/stable 0.22.1740 aarch64 [upgradable from: 0.22.1733]
lua-language-server/stable 3.14.0 aarch64 [upgradable from: 3.13.9]
patch/stable 2.8 aarch64 [upgradable from: 2.7.6-4]
termux-tools version:
1.45.0
Android version:
14
Kernel build information:
Linux localhost 5.4.242-qgki-g11988e3a4817 #1 SMP PREEMPT Tue Feb 18 17:17:10 CST 2025 aarch64 Android
Device manufacturer:
Fairphone
Device model:
FP5
Supported ABIs:
SUPPORTED_ABIS: arm64-v8a,armeabi-v7a,armeabi
SUPPORTED_32_BIT_ABIS: armeabi-v7a,armeabi
SUPPORTED_64_BIT_ABIS: arm64-v8a
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec-ld-preload.so
Installed termux plugins:
com.termux.api versionCode:1000
com.termux.x11 versionCode:15

There does seem to be an edgecase where our version of chsh -s doesn't handle absolute paths e.g $(which zsh) like the util-linux version. I can take a look at that tomorrow.

TomJo2000 avatar Apr 08 '25 00:04 TomJo2000

Unsurprisingly:

% ls -l ~/.termux/shell
lrwxrwxrwx. 1 u0_a391 u0_a391 39 Mar 24 18:53 /data/data/com.termux/files/home/.termux/shell -> /data/data/com.termux/files/usr/bin/zsh

which explains why when I ssh to the phone I get the zsh shell

ballo avatar Apr 08 '25 01:04 ballo