Cockpit backup : Access denied for user 'root'@'localhost' (using password: NO)

Hi,

Another issue I encounter configuring a backup task using Cockpit :

That’s a restic to NFS task. The S50mysql-dump-tables event fails, because of SQL complaining tat “Access denied for user ‘root’@‘localhost’ (using password: NO)”

Full log :

Dec 21 **11:56** :02 cloud esmith::event[3368]: Requested path not found
Dec 21 **11:56** :03 cloud esmith::event[3368]: Action: /etc/e-smith/events/pre-backup-data/S20nethserver-restore-data-duc-index SUCCESS [321.010953]
Dec 21 **11:56** :03 cloud esmith::event[3368]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Dec 21 **11:56** :03 cloud esmith::event[3368]: Action: /etc/e-smith/events/pre-backup-data/S50mysql-dump-tables FAILED: 1 [0.087702]
Dec 21 **11:56** :03 cloud esmith::event[3368]: Action: /etc/e-smith/events/pre-backup-data/S70mount-cifs SUCCESS [0.096513]
Dec 21 **11:56** :03 cloud esmith::event[3368]: Action: /etc/e-smith/events/pre-backup-data/S70mount-nfs SUCCESS [0.095388]
Dec 21 **11:56** :03 cloud esmith::event[3368]: Action: /etc/e-smith/events/pre-backup-data/S70mount-usb SUCCESS [0.094141]
Dec 21 **11:56** :03 cloud esmith::event[3368]: Action: /etc/e-smith/events/pre-backup-data/S70mount-webdav SUCCESS [0.054487]
Dec 21 **11:56** :03 cloud esmith::event[3368]: Action: /etc/e-smith/events/pre-backup-data/S80nethserver-sogo-backup-users SUCCESS [0.424122]
Dec 21 **11:56** :03 cloud esmith::event[3368]: Event: pre-backup-data FAILED
Dec 21 **11:56** :14 cloud systemd: cockpit-backup-data-restic_nfs.service: main process exited, code=exited, status=1/FAILURE
Dec 21 **11:56** :14 cloud systemd: Unit cockpit-backup-data-restic_nfs.service entered failed state.
Dec 21 **11:56** :14 cloud systemd: cockpit-backup-data-restic_nfs.service failed.

If I run the same task as configured in server-manager (same target, same settings) by triggering the cron job manually, it works perfectly :

Dec 21 12:16:24 cloud esmith::event[26931]: Event: pre-backup-data
Dec 21 12:16:25 cloud esmith::event[26931]: ===== Report for configuration backup =====
Dec 21 12:16:25 cloud esmith::event[26931]: oot
Dec 21 12:16:25 cloud esmith::event[26931]: Backup started at 2018-12-21 12:16:25
Dec 21 12:16:25 cloud esmith::event[26936]: Event: pre-backup-config
Dec 21 12:16:25 cloud esmith::event[26936]: expanding /etc/backup-config.d/nethserver-sssd.include
Dec 21 12:16:25 cloud esmith::event[26936]: Action: /etc/e-smith/events/actions/generic_template_expand SUCCESS [0.122476]
Dec 21 12:16:25 cloud esmith::event[26936]: Action: /etc/e-smith/events/pre-backup-config/S20nethserver-directory-dump-ldap SUCCESS [0.211806]
Dec 21 12:16:25 cloud esmith::event[26936]: Action: /etc/e-smith/events/pre-backup-config/S40nethserver-mail-shrmbx-cfgbackup SUCCESS [0.052279]
Dec 21 12:16:25 cloud esmith::event[26936]: Action: /etc/e-smith/events/pre-backup-config/S40nethserver-sssd-backup-tdb SUCCESS [0.011314]
Dec 21 12:16:26 cloud esmith::event[26936]: Action: /etc/e-smith/events/pre-backup-config/S50nethserver-backup-config-list-packages SUCCESS [1.060307]
Dec 21 12:16:26 cloud esmith::event[26936]: Event: pre-backup-config SUCCESS
Dec 21 12:16:26 cloud esmith::event[26931]: Event pre-backup-config: SUCCESS
Dec 21 12:16:26 cloud esmith::event[26931]: Action backup-config-execute: SUCCESS
Dec 21 12:16:26 cloud esmith::event[27123]: Event: post-backup-config
Dec 21 12:16:26 cloud esmith::event[27123]: Event: post-backup-config SUCCESS

Dec 21 12:16:26 cloud esmith::event[26931]: Event post-backup-config: SUCCESS
Dec 21 12:16:26 cloud esmith::event[26931]: Backup status: SUCCESS
Dec 21 12:16:26 cloud esmith::event[26931]: Backup ended at 2018-12-21 12:16:26
Dec 21 12:16:26 cloud esmith::event[26931]: Time elapsed: 0 hours, 0 minutes, 1 seconds
Dec 21 12:16:26 cloud esmith::event[26931]: Action: /etc/e-smith/events/pre-backup-data/S20nethserver-backup-config-predatabackup SUCCESS [1.955921]
Dec 21 12:27:10 cloud esmith::event[26931]: Requested path not found
Dec 21 12:27:11 cloud esmith::event[26931]: Action: /etc/e-smith/events/pre-backup-data/S20nethserver-restore-data-duc-index SUCCESS [644.360313]
Dec 21 12:27:20 cloud esmith::event[26931]: Action: /etc/e-smith/events/pre-backup-data/S50mysql-dump-tables SUCCESS [9.709271]
Dec 21 12:27:21 cloud esmith::event[26931]: Action: /etc/e-smith/events/pre-backup-data/S70mount-cifs SUCCESS [0.093104]
Dec 21 12:27:21 cloud esmith::event[26931]: Action: /etc/e-smith/events/pre-backup-data/S70mount-nfs SUCCESS [0.113759]
Dec 21 12:27:21 cloud esmith::event[26931]: Action: /etc/e-smith/events/pre-backup-data/S70mount-usb SUCCESS [0.106775]
Dec 21 12:27:21 cloud esmith::event[26931]: Action: /etc/e-smith/events/pre-backup-data/S70mount-webdav SUCCESS [0.099866]
Dec 21 12:27:21 cloud esmith::event[26931]: Action: /etc/e-smith/events/pre-backup-data/S80nethserver-sogo-backup-users SUCCESS [0.441157]
Dec 21 12:27:21 cloud esmith::event[26931]: Event: pre-backup-data SUCCESS
Dec 21 12:28:34 cloud esmith::event[5176]: Event: post-backup-data
Dec 21 12:28:35 cloud esmith::event[5176]: Action: /etc/e-smith/events/post-backup-data/S20nethserver-backup-config-push2history SUCCESS [0.57952]
Dec 21 12:28:35 cloud esmith::event[5176]: Action: /etc/e-smith/events/post-backup-data/S20nethserver-backup-config-push2mount SUCCESS [0.200011]
Dec 21 12:28:35 cloud esmith::event[5176]: Action: /etc/e-smith/events/post-backup-data/S50mysql-delete-dumped-tables SUCCESS [0.051063]
Dec 21 12:28:37 cloud esmith::event[5176]: Local and Remote metadata are synchronized, no sync needed.
Dec 21 12:28:37 cloud esmith::event[5176]: Last full backup date: none
Dec 21 12:28:37 cloud esmith::event[5176]: No old backup sets found, nothing deleted.
Dec 21 12:28:37 cloud esmith::event[5176]: Local and Remote metadata are synchronized, no sync needed.
Dec 21 12:28:37 cloud esmith::event[5176]: Last full backup date: none
Dec 21 12:28:37 cloud esmith::event[5176]: No extraneous files found, nothing deleted in cleanup.
Dec 21 12:28:37 cloud esmith::event[5176]: Action: /etc/e-smith/events/post-backup-data/S70cleanup-data-duplicity SUCCESS [1.507211]
Dec 21 12:28:37 cloud esmith::event[5176]: Action: /etc/e-smith/events/post-backup-data/S70cleanup-restore-index SUCCESS [0.127673]
Dec 21 12:28:37 cloud esmith::event[5176]: Action: /etc/e-smith/events/post-backup-data/S70disk-usage SUCCESS [0.111596]
Dec 21 12:28:37 cloud esmith::event[5176]: Action: /etc/e-smith/events/post-backup-data/S80umount-cifs SUCCESS [0.156038]
Dec 21 12:28:37 cloud esmith::event[5176]: Action: /etc/e-smith/events/post-backup-data/S80umount-nfs SUCCESS [0.135998]
Dec 21 12:28:38 cloud esmith::event[5176]: Action: /etc/e-smith/events/post-backup-data/S80umount-usb SUCCESS [0.301716]
Dec 21 12:28:38 cloud esmith::event[5176]: Action: /etc/e-smith/events/post-backup-data/S80umount-webdav SUCCESS [0.105628]
Dec 21 12:28:38 cloud esmith::event[5176]: Event: post-backup-data SUCCESS

If I try to manually dump from command line it works too.

Strange… Any idea ?

Yes, the script is running using 2 different environments: using root user with a shell, and using sudo.
I need time to inspect the problem and find a workaround: on my todo list for the next year :wink:

Thanks for reporting!

1 Like

Should be fixed now with latest commit: https://github.com/NethServer/nethserver-cockpit/commit/1307c7aca743788a9710abc6a454bc8c7120d826

(Package is already in testing)

1 Like