Shell is not changin

╭─[email protected] in ~
╰─λ garuda-inxi
Kernel: 6.2.9-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 12.2.1
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=d581b092-954c-495c-b56c-3855444ad049 rw [email protected]
quiet quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
resume=UUID=2be48266-c1a0-4ea8-9c01-faaf3db8bf5f loglevel=3 ibt=off
Desktop: KDE Plasma v: 5.27.3 tk: Qt v: 5.15.8 wm: kwin_x11 vt: 1 dm: SDDM
Distro: Garuda Linux base: Arch Linux
Type: Laptop System: ASUSTeK product: ASUS TUF Gaming F15 FX506LI_FX506LI
v: 1.0 serial: <superuser required>
Mobo: ASUSTeK model: FX506LI v: 1.0 serial: <superuser required>
UEFI: American Megatrends v: FX506LI.310 date: 11/26/2021
ID-1: BAT1 charge: 29.1 Wh (70.5%) condition: 41.3/48.1 Wh (85.9%)
volts: 11.2 min: 11.7 model: ASUS A32-K55 type: Li-ion serial: N/A
status: discharging
Info: model: Intel Core i5-10300H bits: 64 type: MT MCP arch: Comet Lake
gen: core 10 level: v3 note: check built: 2020 process: Intel 14nm family: 6
model-id: 0xA5 (165) stepping: 2 microcode: 0xF4
Topology: cpus: 1x cores: 4 tpc: 2 threads: 8 smt: enabled cache:
L1: 256 KiB desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB
L3: 8 MiB desc: 1x8 MiB
Speed (MHz): avg: 2075 high: 2500 min/max: 800/4500 scaling:
driver: intel_pstate governor: powersave cores: 1: 2500 2: 2500 3: 2500
4: 800 5: 2500 6: 800 7: 2500 8: 2500 bogomips: 39999
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Vulnerabilities: <filter>
Device-1: Intel CometLake-H GT2 [UHD Graphics] vendor: ASUSTeK driver: i915
v: kernel arch: Gen-9.5 process: Intel 14nm built: 2016-20 ports:
active: eDP-1 empty: none bus-ID: 00:02.0 chip-ID: 8086:9bc4
class-ID: 0300
Device-2: NVIDIA TU117M [GeForce GTX 1650 Ti Mobile] vendor: ASUSTeK
driver: nvidia v: 530.41.03 alternate: nouveau,nvidia_drm non-free: 530.xx+
status: current (as of 2023-03) arch: Turing code: TUxxx
process: TSMC 12nm FF built: 2018-22 pcie: gen: 3 speed: 8 GT/s lanes: 16
bus-ID: 01:00.0 chip-ID: 10de:1f95 class-ID: 0300
Device-3: Sonix USB2.0 HD UVC WebCam type: USB driver: uvcvideo
bus-ID: 1-7:3 chip-ID: 322e:202c class-ID: 0e02
Display: x11 server: X.Org v: 21.1.8 with: Xwayland v: 23.1.1
compositor: kwin_x11 driver: X: loaded: modesetting,nvidia unloaded: nouveau
alternate: fbdev,intel,nv,vesa dri: iris gpu: i915 display-ID: :0
screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
s-diag: 582mm (22.93")
Monitor-1: eDP-1 model: Najing CEC Panda 0x004d built: 2019 res: 1920x1080
dpi: 142 gamma: 1.2 size: 344x194mm (13.54x7.64") diag: 395mm (15.5")
ratio: 16:9 modes: 1920x1080
API: OpenGL v: 4.6 Mesa 23.0.1 renderer: Mesa Intel UHD Graphics (CML GT2)
direct-render: Yes
Device-1: Intel Comet Lake PCH cAVS vendor: ASUSTeK driver: snd_hda_intel
v: kernel alternate: snd_soc_skl,snd_sof_pci_intel_cnl bus-ID: 00:1f.3
chip-ID: 8086:06c8 class-ID: 0403
Device-2: NVIDIA vendor: ASUSTeK driver: snd_hda_intel v: kernel pcie:
gen: 3 speed: 8 GT/s lanes: 16 bus-ID: 01:00.1 chip-ID: 10de:10fa
class-ID: 0403
API: ALSA v: k6.2.9-zen1-1-zen status: kernel-api tools: N/A
Server-1: PipeWire v: 0.3.67 status: active with: 1: pipewire-pulse
status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Device-1: MEDIATEK MT7921 802.11ax PCI Express Wireless Network Adapter
vendor: AzureWave driver: mt7921e v: kernel pcie: gen: 2 speed: 5 GT/s
lanes: 1 bus-ID: 03:00.0 chip-ID: 14c3:7961 class-ID: 0280
IF: wlp3s0 state: up mac: <filter>
Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
vendor: ASUSTeK driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s
lanes: 1 port: 3000 bus-ID: 04:00.0 chip-ID: 10ec:8168 class-ID: 0200
IF: enp4s0 state: down mac: <filter>
Device-1: IMC Networks Wireless_Device type: USB driver: btusb v: 0.8
bus-ID: 1-14:4 chip-ID: 13d3:3563 class-ID: e001 serial: <filter>
Report: bt-adapter ID: hci0 rfk-id: 0 state: up address: <filter>
Local Storage: total: 476.94 GiB used: 32.45 GiB (6.8%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Micron model: 2210 MTFDHBA512QFD
size: 476.94 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
lanes: 4 type: SSD serial: <filter> rev: P6MA001 temp: 39.9 C scheme: GPT
ID-1: / raw-size: 57.59 GiB size: 57.59 GiB (100.00%)
used: 32.45 GiB (56.3%) fs: btrfs dev: /dev/nvme0n1p9 maj-min: 259:9
ID-2: /boot/efi raw-size: 512 MiB size: 511 MiB (99.80%)
used: 612 KiB (0.1%) fs: vfat dev: /dev/nvme0n1p8 maj-min: 259:8
ID-3: /home raw-size: 57.59 GiB size: 57.59 GiB (100.00%)
used: 32.45 GiB (56.3%) fs: btrfs dev: /dev/nvme0n1p9 maj-min: 259:9
ID-4: /var/log raw-size: 57.59 GiB size: 57.59 GiB (100.00%)
used: 32.45 GiB (56.3%) fs: btrfs dev: /dev/nvme0n1p9 maj-min: 259:9
ID-5: /var/tmp raw-size: 57.59 GiB size: 57.59 GiB (100.00%)
used: 32.45 GiB (56.3%) fs: btrfs dev: /dev/nvme0n1p9 maj-min: 259:9
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 7.6 GiB used: 0 KiB (0.0%) priority: 100
dev: /dev/zram0
ID-2: swap-2 type: partition size: 512 MiB used: 0 KiB (0.0%) priority: -2
dev: /dev/nvme0n1p7 maj-min: 259:7
System Temperatures: cpu: 49.0 C pch: 56.0 C mobo: N/A
Fan Speeds (RPM): cpu: 0
Processes: 266 Uptime: 22m wakeups: 1 Memory: 7.6 GiB used: 3.63 GiB (47.7%)
Init: systemd v: 253 default: graphical tool: systemctl Compilers:
gcc: 12.2.1 Packages: pm: pacman pkgs: 1272 libs: 334 tools: octopi,paru
Shell: fish v: 3.6.1 default: Bash v: 5.1.16 running-in: konsole
inxi: 3.3.26
Garuda (2.6.16-1):
System install date:     2023-04-06
Last full system update: 2023-04-07
Is partially upgraded:   No
Relevant software:       snapper NetworkManager dracut nvidia-dkms
Windows dual boot:       Probably (Run as root to verify)
Failed units:

Hello, I'm trying to change my shell to fish in fish konsole. I have changed it from bash to fish in garuda assistant (under : setting), also from my konsole configuration setting (profile). Although shell type is described as fish when I open konsole but still it's running bash shell.

One thing is the login shell (changed with chsh) and another is the default command run by the terminal emulator (Konsole, Alacritty, whatever).

To quickly confirm if the one running is fish or not, try a simple variable assignment:

fish❯ test=1
fish: Unsupported use of '='. In fish, please use 'set test 1'.

if it silently works, it's bash (or some other POSIX shell). If it complains as above, it's fish.
(there are better ways but this works). I think the one in the screenshot is fish.

fish❯ echo $SHELL

here too.


Yeah, thanks. I have used ps command and now it's showing fish is running.

╭─[email protected] in ~ took 5m8s
╰─λ ps
10764 pts/1 00:00:00 fish
11167 pts/1 00:00:00 ps


1 Like

But i didn't understand why echo $SHELL giving output as "bash"

It may be needed to reboot, or log out/log back in before echo $SHELL shows the updated value.


$SHELL reflects the user shell from /etc/passwd (the one changed with chsh).
I'm not sure exactly where it is set, I also think it doesn't change until next login.
It does not reflect the change even opening another shell.

edit: @falling
Now that I think of it, I'm not really sure but I think the login shell better be a POSIX one.
$SHELL is used by other programs to run shell commands, and fish uses a different syntax.
For instance:

SHELL=/bin/bash  fzf --preview 'test=1'  # --> nothing in the preview panel
SHELL=/bin/fish  fzf --preview 'test=1'  # --> error in the preview panel

Even if you're not using fzf, I think this is going to affect something.
This suggests systemd is one of those something: systemd.exec(5) — Arch manual pages

1 Like

The shell: bash running-in: xterm item in inxi takes about 300 lines of code to try to get this right, it's not trivial. Most of that is for the 'running-in:' item, which is the actual terminal type window running the shell, which can be several parents away from the direct shell process you are in at the moment.

Here's the simplest way to understand what SHELL is.

# parent is terminal/console
echo $SHELL
ps -o comm=
# parent is bash
echo $SHELL
ps -o comm=
# parent is zsh
echo $SHELL
ps -o comm=

This is the puzzle, the default SHELL is set to bash, but has exactly no necessary connection to your current shell actually being used, it's a worthless item unless you want to know what your default shell is. It never tells you the actual shell you are in, unless your default and your current happen to be the same.

If you leave off the -o comm=, it will show the process numbers, so you will know the highest number after ps process is the actual shell running ps command, like:

~> ps
    PID TTY          TIME CMD
2353833 pts/5    00:00:00 zsh
2354114 pts/5    00:00:00 fish
2354122 pts/5    00:00:00 ps
3979647 pts/5    00:00:00 bash

As you can see, it's tricky, but it is safe to say that fish started ps command, since they are the closest process numbers in the list, and are greater than the zsh process, though that's not reliable because as you can also see, bash has a higherprocess number, even though it's the true parent shell in this stack, in this case, probably because the kernel is rolling over the numbers, and that terminal window / bash process is old, whereas the lower numbers are younger.

The reason inxi was right in this case is because it knows this issue, and will query to get the actual shell, which in this case, is usually but not always the parent of the inxi process, that is, what is inxi running in as first parent?

If you are entering it directly into shell:

ps -o comm=

which gives bash running the ps process.

It's not quite that simple because some shells misrepresent themselves so you have to add in some logic to catch those shells and correct their names, but that's the basic idea.

I'm a bit rusty on this, but I believe the default shell is what for example runs when you execute a subshell, like: echo $(uname -r). The shell that ran the command uname -r is NOT your present shell, it's I think the default, which is why you don't really want to change that, it will lead to unexpected and maybe bad behaviors.

The default is often bash, sh, which is itself often a generic that might point to another shell, or could point to actual sh shell, it varies, but it will be I think always a fully posix compliant shell.

And this is why I put this type of logic into inxi, and stop worrying about, these are hard problems to really nail down, hard to explain, and hard to code and debug, so it's easier to just pop it into inxi and call it good.

For scripts running in a terminal or shell, it's very easy by the way, it's just this:

ps -p $PPID

Which says, give me the parent of the current process (the script), which is the active shell. This is usually right unless it's not, for example, if the parent is another tool, not a shell, it gets confusing.

By the way, you can readily find the limits of a simple tool like neofetch, which does not robustly check its data, like so:

#bash shell, $SHELL=bash
#now we are in fish shell:
Shell: bash 5.2.15

Ooops, close but no cigar.

inxi -Ix
Info: ...  Shell: fish v: 3.5.1
zsh # making this bash running zsh running fish running zsh
Info: ... Shell: Zsh v: 5.9

And this is why inxi dumped bash/gawk and moved to Perl, so complicated data could be handled and processed, though in this case, it's not super complicated, though if memory serves, this logic was a total mess in inxi bash, and could not be fixed until it was switched to Perl, and had to be rewritten several times before it actually became fairly reliable.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.