Configuration Backup Fails

NethServer Version: 7.9.2009
Module: nethserver-backup-config

Fails at command “/etc/e-smith/events/pre-backup-config/S40nethserver-dc-pre-backup”

Failed to insert into /var/lib/samba/private/sam.ldb.d/DC=DOMAINDNSZONES,DC=MYDOMAIN,DC=LAN.ldb.bak.tmp
failed to copy /var/lib/samba/private/sam.ldb.d/DC=DOMAINDNSZONES,DC=MYDOMAIN,DC=LAN.ldb

The /var/lib/samba/private/sam.ldb.d, I tried creating it and no difference

Did you already update to the most recent nethserver-backup-config 2.5.3?

Yes, 2.5.3-1.ns7

I can’t reproduce it. Maybe a permission issue as it’s not possible to insert or copy?

This is the code in nethserver-dc-pre-backup:

cd /var/lib/machines/nsdc/
nsdc-run -e -- tdbbackup $(find var/lib/samba/ -name "*.[t,l]db" | sed -e '\|^var/lib/samba/private/netlogon_creds_cli.tdb$| d ; s/^/\//')

It just does a tdbbackup in the container, see also Using the samba backup script - SambaWiki

Check howto:useful_commands [NethServer Wiki] for more information about how to work in the samba container.

I think it’s /var/lib/samba/private/sam.ldb.d in the NethServer DC container so please check /var/lib/machines/nsdc/var/lib/samba/private/sam.ldb.d, here’s an example of my server:

[root@server2 ~]# ls -l /var/lib/machines/nsdc/var/lib/samba/private/sam.ldb.d/
total 57132
-rw------- 1 root root 18923520 Oct  8 22:30 CN=CONFIGURATION,DC=AD,DC=MRMARKUZ,DC=DOMAIN,DC=EU.ldb
-rw------- 1 root root 21942272 Oct  8 22:30 CN=SCHEMA,CN=CONFIGURATION,DC=AD,DC=MRMARKUZ,DC=DOMAIN,DC=EU.ldb
-rw------- 1 root root  6750208 Dec  3 18:26 DC=AD,DC=MRMARKUZ,DC=DOMAIN,DC=EU.ldb
-rw------- 1 root root  6737920 Nov 28 10:57 DC=DOMAINDNSZONES,DC=AD,DC=MRMARKUZ,DC=DOMAIN,DC=EU.ldb
-rw------- 1 root root  3317760 Nov 28 10:57 DC=FORESTDNSZONES,DC=AD,DC=MRMARKUZ,DC=DOMAIN,DC=EU.ldb
-rw-r----- 1 root root   831488 Dec  2 13:07 metadata.tdb

EDIT:

Did you already test the config backup on command line:

backup-config

Yes, my /var/lib/machines/nsdc/var/lib/samba/private/sam.ldb.d contains the same files as yours.
And yes, “backup-config” results in;

===== Report for configuration backup =====
Backup started at 2022-12-03 13:23:39
Event pre-backup-config: FAIL
Backup status: FAIL

What’s your DC samba version?

nsdc-run -e -- samba -V

Please also check /var/log/messages for errors.

Version 4.9.18

/var/log/messages contains the following errors when runing “backup-config”

Dec 3 13:45:59 lrtserv-data esmith::event[24210]: Event: pre-backup-config
Dec 3 13:46:00 lrtserv-data esmith::event[24210]: expanding /etc/backup-config.d/nethserver-sssd.include
Dec 3 13:46:00 lrtserv-data esmith::event[24210]: Action: /etc/e-smith/events/actions/generic_template_expand SUCCESS [0.132487]
Dec 3 13:46:01 lrtserv-data esmith::event[24210]: Failed to insert into /var/lib/samba/private/sam.ldb.d/DC=DOMAINDNSZONES,DC=MYDOMAIN,DC=LAN.ldb.bak.tmp
Dec 3 13:46:01 lrtserv-data esmith::event[24210]: failed to copy /var/lib/samba/private/sam.ldb.d/DC=DOMAINDNSZONES,DC=MYDOMAIN,DC=LAN.ldb
Dec 3 13:46:01 lrtserv-data esmith::event[24210]: Action: /etc/e-smith/events/pre-backup-config/S40nethserver-dc-pre-backup FAILED: 1 [0.89886]
Dec 3 13:46:01 lrtserv-data esmith::event[24210]: Action: /etc/e-smith/events/pre-backup-config/S40nethserver-mail-shrmbx-cfgbackup SUCCESS [0.012343]
Dec 3 13:46:01 lrtserv-data esmith::event[24210]: Action: /etc/e-smith/events/pre-backup-config/S40nethserver-sssd-backup-tdb SUCCESS [0.010848]
Dec 3 13:46:02 lrtserv-data esmith::event[24210]: Action: /etc/e-smith/events/pre-backup-config/S50nethserver-backup-config-list-packages SUCCESS [1.639033]
Dec 3 13:46:02 lrtserv-data esmith::event[24210]: Event: pre-backup-config FAILED

That’s still the old version, are you sure you have updated to nethserver-dc-1.9.1-1?

1 Like

I have not updated nethserver-dc, as if I do, it deletes all of my users and groups.
I reverted my VM and have tried a couple of times to update, always deletes the users and groups.
I was going to try and do a config backup, then update nethserver-dc and then restore, and that is when I noticed it was not working.
I opened a seperate issue for nethserver-dc udpate here;

Just if you missed it (like I did), take into account that it’s reporting a path inside the container (that means you have to look for it using nsdc-run command, systemd-run -M nsdc -t /bin/bash or at /var/lib/machines/nsdc/var/lib/samba/private/sam.ldb.d/...).

EDIT: nevermind, I see Markus already reported the same.

What happens after running (check for your *.ldb.bak and logs):

/etc/e-smith/events/actions/nethserver-dc-pre-backup

or from inside nsdc (systemd-run -M nsdc -t /bin/bash):

tdbbackup $(find var/lib/samba/ -name "*.[t,l]db" | sed -e '\|^var/lib/samba/private/netlogon_creds_cli.tdb$| d ; s/^/\//')

EDIT: nevermind, I see Markus bit me to it and today I’ve lack of attention. :wink:

1 Like

nethserver-backup-config fixes an error with the new nethserver-dc so maybe you need to downgrade nethserver-backup-config to make it work with the old nethserver-dc.

yum downgrade nethserver-backup-config

2 Likes

Tried that, same errors.

Did you already try to restart NSDC or reconfigure nethserver-dc?

systemctl restart nsdc

signal-event nethserver-dc-update

1 Like

I ran both those commands and no change.

inside nsdc container:

samba-tool dbcheck --cross-ncs

don’t know it this also checks for errors in that ldb database

1 Like

I’m out of ideas.

Did you try the tdbbackup in the container to hopefully get more information about the error?

Are there custom template files in /etc/e-smith/templates-custom ?

Did you reboot the server?

1 Like

there is an specific command to check ldb databases using tdbtool…
inside the nsdc container

tdbtool "/var/lib/samba/private/sam.ldb.d/[here your database].ldb" check

replace the path to the ldb file as necessary

1 Like