It all started with a simple problem. I just wanted to use rsync on Linux to copy some files from z/OS to a backup disk. In later discussions using rsync may not be the best approach because it does not support the extended attributes and code page support used on z/OS. But that is a different problem.
The problems were
- rsync was not installed
- I could not get rsync installed because of networking problem
- I could not get my machine to talk to the outside world, because I had changed my router.
- My non interactive shell did not have the path in the PATH environment
- My non interactive shell wrote something, which rsync was not expecting.
rsync was not installed
rsync uses SSH to connect to the system. I could ssh to the system, so that was OK.
rsync -a colin@172.26.1.2:/usr/tmp/zowet/colin/* /run/media/colin/ADCD110/rsync/zOS
** WARNING: connection is not using a post-quantum key exchange algorithm.
** This session may be vulnerable to "store now, decrypt later" attacks.
** The server may need to be upgraded. See https://openssh.com/pq.html
bash: line 1: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(232) [Receiver=3.4.1]
This did
- logon to colin@172.26.1.2
- :
- /usr/tmp/zowet/colin/* files from this directory
- to /run/media/colin/ADCD110/rsync/zOS
The response bash: line 1: rsync: command not found meant that rsync was not installed on the remote end.
Install rsync failed
I found it was available with the zopen install rsync command
The command
zopen install rsync
- Querying repo for latest package information.
curl: (6) Could not resolve host: raw.githubusercontent.com
So there was a problem finding raw.githubusercontent.com.
Ping failed., so ….
Investigate the network
Because it was a routing type problem I looked into this configuration. In my resolver started task I had
//*
//* TCPIP RESOLVER - COLINS
//*
//RESOLVER PROC PARMS=CTRACE(CTIRES00)
//*
//EZBREINI EXEC PGM=EZBREINI,REGION=0M,TIME=1440,
// PARM=('&PARMS',
// 'ENVAR("RESOLVER_TRACE=/var/log/resolver"/')
//SETUP DD DISP=SHR,DSN=COLIN.TCPPARMS(GBLRESOL),FREE=CLOSE
//SYSTCPT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//*
The setup file had
DEFAULTTCPIPDATA('COLIN.TCPPARMS(GBLTDATA)')
GLOBALTCPIPDATA('COLIN.TCPPARMS(RESOLVE)')
# GLOBALTCPIPDATA(/etc/resolv.conf)
;
# -----------------------------------------------------------------
# Default zPDT Linux Base to z/OS Tunnel (Stand-Alone)
# -----------------------------------------------------------------
;
# GLOBALIPNODES(/etc/hosts)
GLOBALIPNODES('COLIN.TCPPARMS(HOSTS)')
The HOSTS file had
185.199.110.133 raw.githubusercontent.com
185.199.110.133 release-assets.githubusercontent.com
169.63.188.167 downloads.pyaitoolkit.ibm.net
I tried refreshing it,
f resolver,refresh,setup=COLIN.TCPPARMS(GBLRESOL)
But that didn’t help.
A wireshark trace
I did a wireshark trace. It showed the ping request coming from z/OS, but there was no response.
This felt familiar, and found a blog post (from me) zopen: installing packages which pointed me to How to get out to the internet. SNAT, DNAT and MASQUERADE
This had
iface=wlxcc641aee92c5
sudo iptables -t nat -A POSTROUTING -s 10.1.1.2 -o $iface -j MASQUERADE
Unfortunately, my wireless router had changed, and I did not have my current router in the list – so it was failing.
The solution for the network problem
I added my wireless router (with the correct name) and I was able to issue the command zopen install rsync
Retry the rsync command – not in path
I retried the rsync command – and it still failed.
When I log interactively using SSH it invokes .profile.
When I logon non interactively it uses .bashrc.
In my .bashrc script, I had not set the path. I added
export PATH=/usr/zopen/usr/local/bin/:$PATH
export >> bashlog
I looked at the bashlog file and it had
declare -x PATH="/usr/zopen/usr/local/bin/:/bin"
So the PATH now included zopen stuff.
The non interactive script was writing to “the console”.
In the script I was writing out debug information.
I used the following to solve the problem
echo "in shell" b>> bashlog
I could log on and see what environment variables were used.
And finally
And the rsync from Linux worked!
What a faff to get the rsync command to work, and later on find that rsync is not the best option for backing up files on z/OS!