Thank you for the suggestions, Alan. With more debugging here's what I've discovered. It actually succeeds in setting up and running the iRODS server, but the failure is happening towards the end of setup_irods.py when it tries to stop the server process after the installation and setup is complete. It looks like the issue is a side effect of things running through the emulator when a non-native platform is specified.
2023-03-16 12:57:24,833 - Traceback (most recent call last):
File "/var/lib/irods/scripts/setup_irods.py", line 529, in <module>
sys.exit(main())
File "/var/lib/irods/scripts/setup_irods.py", line 515, in main
setup_server(irods_config,
File "/var/lib/irods/scripts/setup_irods.py", line 162, in setup_server
IrodsController(irods_config).stop()
File "/var/lib/irods/scripts/irods/controller.py", line 221, in stop
server_proc = self.get_server_proc()
File "/var/lib/irods/scripts/irods/controller.py", line 77, in get_server_proc
if server_proc.exe() and os.path.samefile(self.config.server_executable, server_proc.exe()):
File "/usr/lib/python3.8/genericpath.py", line 101, in samefile
s2 = os.stat(f2)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/qemu-x86_64'
In controller.py, it gets the server_pid and then attempts to check that the server process executable associated with that pid matches the executable path stored in the config. That can be seen at "controller.py, line 77, in get_server_proc" in the traceback where it is checking server_proc.exe(). At that point, server_proc has been set to psutil.Process(server_pid). The problem is that when the emulator is involved, psutil.Process().exe() doesn't return "/usr/sbin/irodsServer" as would be expected. We can see in the ps output that when run on Linux natively or in Docker when the native architecture is amd64, things are run as would be expected:
david@irods-ubuntu:~$ ps ax | grep irods
805 ? Ssl 0:01 /usr/sbin/irodsServer
806 ? S 0:01 /usr/sbin/irodsServer
827 ? Sl 0:00 irodsDelayServer
And therefore, psutil.Process().exe() returns the path to the iRODS server as expected:
>>> psutil.Process(805).exe()
'/usr/sbin/irodsServer'
However, when run in Docker with a non-native platform (in this case - specified platform: amd64, native architecture: arm64), the emulator gets involved:
irods@0fe1b03f67b4:/$ ps ax | grep irods
4036 ? Ssl 0:01 /usr/bin/qemu-x86_64 /usr/sbin/irodsServer /usr/sbin/irodsServer
4038 ? Sl 0:00 /usr/bin/qemu-x86_64 /usr/sbin/irodsServer /usr/sbin/irodsServer
4058 ? Sl 0:00 /usr/bin/qemu-x86_64 irodsDelayServer irodsDelayServer
And psutil.Process().exe() returns the emulator instead of the iRODS server path:
>>> psutil.Process(4036).exe()
'/usr/bin/qemu-x86_64'
That gets passed to os.path.samefile() and eventually when it tries to stat that file we get the FileNotFoundError, causing setup_irods.py to fail which leads to the "failed to set up iRODS server" and "failed to set up one or more iRODS Zones" error messages.
I suppose a potential workaround could be to recognize when the path returned is actually the emulator, and instead of exe() use psutil.Process().cmdline() to get to the other arguments. I'm going to try that for now, but I'm all ears if anyone has any other thoughts.
Thanks again,
David