Open-source Languages & Tools for z/OS

 View Only

 Issue with bash usage during non-interactive SSH session

Ong One's profile image
Ong One posted 09-30-2024 21:49

Hello everyone,

I am trying to setup a Gitlab runner that will SSH from a RHEL into my z/OS USS and execute commands via Rocket Bash.

But I am hitting some issues that seems like an encoding issue when my runner is firing the commands and is not getting read correctly on Rocket Bash

Running with gitlab-runner 17.3.1 (66269445)
  on SSH Runner abc123asif, system ID: a_bcde123452c1
Resolving secrets
Preparing the "ssh" executor
00:03
Using SSH executor...
Preparing environment
00:00
/usr/lpp/Rocket/rsusr/ported/bin/bash: line 1: $'\226@\247\243\231\201\203\205\025\211\206@\242\205\243@': command not found
/usr/lpp/Rocket/rsusr/ported/bin/bash: line 1: $'\226@\227\211\227\205\206\201\211\223^@\206\211^@\242\205\243@': command not found
/usr/lpp/Rocket/rsusr/ported/bin/bash: line 1: $'\361\367\362': command not found
/usr/lpp/Rocket/rsusr/ported/bin/bash: line 1: $'\361': command not found
/usr/lpp/Rocket/rsusr/ported/bin/bash: line 1: $'\242\226\244\243\210\205\201\242\243': command not found
/usr/lpp/Rocket/rsusr/ported/bin/bash: line 1: $'{Za\244\242\231a\202\211\225a\205\225\245@\202\201\242\210\025\025\242\205\243@\226@O@\207\231\205\227@\227\211\227\205\206\201\211\223@n@a\204\205\245a\225\244\223\223^@\243\210\205\225@\242\205\243@\226@\205\231\231\205\247\211\243\025\242\205\243@N\226@\225\226\203\223\226\202\202\205\231\025z@O@\205\245\201\223@[}\205\203\210\226@\177\331\244\225\225\211\225\207@\226\225@[M\210\226\242\243\225\201\224\205]@\245\211\201@\211\227\362\360\366K\201\227\361K\203\226\224\227\244\243\205K\211\225\243\205\231\225\201\223KKK\177\340\225}\025\205\247\211\243@\360\025': command not found
ERROR: Job failed: prepare environment: Process exited with status 127. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information


in my etc/profile file I have also configured the following settings:

export _BPXK_AUTOCVT=ON

Changing the locale of the z/OS and also my RHEL

z/OS - locale from C to IBM-1047

LANG=En_US.IBM-1047
export LANG

RHEL - locale from UTF-8 to ISO8859-1

LANG=En_US.ISO8859-1
export LANG

I have also tried to set LC_ALL in my /etc/profile of z/OS to use IBM-1047 but am getting the below error:

bash: warning: setlocale: LC_ALL: cannot change locale (En_US.IBM-1047): No such file or directory

Giancarlo Frix's profile image
ROCKETEER Giancarlo Frix

Please make sure that /etc/profile and any other startup files that you are using are tagged according to their encoding. You can tag a file using the `chtag` command. If the problem persists, create a ~/.profile file using `touch ~/.profile && chtag -tc 819 ~/.profile && echo ‘_BPXK_AUTOCVT=ON’ >>~/.profile` (make sure to move any existing ~/.profile before doing this, you can copy the contents of your old ~/.profile into the new one after you create the new one).

Bash is an ASCII-mode program, so it does not support running in an EBCDIC codepage, we recommend running in a UTF-8 locale like En_US.UTF-8. It is still able to interact with EBCDIC files and utilities while running in a UTF-8 locale so you lose no functionality by using a UTF-8 locale.