Dbus + gio mount within script passed to sbatch not working anymore

Primary informations

Username: kamouna
Cluster: bamboo

Description

The mounting of my NAS share does not work anymore when i want to include it in a script that i launch with sbatch on bamboo. However if i run the dbus-launch + gio mount lines one after the other on an salloc session it works (if i copy paste the 2 lines in one go it fails). I tried to add sleep 5 after dbus-launch bash and before gio mount but it did not solve the issue. The exact same script used to work before (2 weeks ago).

These are the lines in the script that i pass to sbatch

module purge
module load GCCcore/12.3.0 Python

dbus-launch bash
gio mount smb://nasac-m2.unige.ch/m-CDGG < .credentials

When i run the sbatch command calling this script, i get the following error in the logfile:

Error creating proxy: Could not connect: Connection refused (g-io-error-quark, 39)
gio: smb://nasac-m2.unige.ch/m-CDGG: volume doesn’t implement mount

Steps to Reproduce

I tried to debug using salloc and copy pasted these 4 lines in the shell
module purge
module load GCCcore/12.3.0 Python
dbus-launch bash
gio mount smb://nasac-m2.unige.ch/m-CDGG < .credentials

→ The mount was not successful

However when i sequentially paste the 3 first lines:

module purge
module load GCCcore/12.3.0 Python
dbus-launch bash

Then the last one:
gio mount smb://nasac-m2.unige.ch/m-CDGG < .credentials

→ The mount is successful

Expected Result

I expect that the mount to be successful after

dbus-launch bash

gio mount smb://nasac-m2.unige.ch/m-CDGG < .credentials

when they are run via sbatch

Actual Result

I get the following error

Error creating proxy: Could not connect: Connection refused (g-io-error-quark, 39)
gio: smb://nasac-m2.unige.ch/m-CDGG: volume doesn’t implement mount

Hello @Aurelie.Kamoun

You need to start with a clean session. Before running salloc, make sure you do not have any GIO session running. When using sbatch, you should add a sleep between dbus-launch and the GIO command. We suspect that GIO is not fully initialized before the GIO command executes, which is why the delay is necessary.

In your sbatch script:

dbus-launch bash 
sleep 5
gio mount smb://nasac-m2.unige.ch/m-CDGG < .credentials