[SOLVED] How to migrate all USERS from one FB installation to another?

Hi everybody!

My Raspberry 3b+ installation became unusable after a SD-Card failure. Now I did a fresh install on a new SD-Card, recovered the Backup and noticed that the users were not recovered. (I guess this feature is not yet implemented?)

Now my question is: how can I do this manually? Is there a step-by-step guide describing this process? I found this feature request but unfortunately I can’t interpret what exactly I have to do.

Thanks in advancefor any help!
J

Hi Jonny.

While I do not have a howto, I can see that FB is using OpenLDAP (the slapd package) with its configuration sitting in

/etc/ldap/

and the data files in

/var/lib/ldap

I am not sure if there is more that is required. But maybe moving over the files in these directories is worth a try? I noticed that the bug report mentions dumping the contents of the files using slapcat but that will only give you the raw data and you will somehow need to import it into the new FB. Moving the data files directly (assuming they are compatible and slapd versions are the same across systems) could work.

Cheers,
Axel

1 Like

Thanks @kopfkind for your advice. I will try it as soon as I get the chance.

I just succesfully migrated one of my setups. Moving

/etc/ldap/

and

/var/lib/ldap/

is not enought, you also have to move

/var/lib/plinth/plinth.sqlite3

and then restart FreedomBox.

2 Likes

Hi @nbenedek , I just tried your procedure, unfortunately without luck:

Jan 23 13:23:52 freedombox-rpi4 systemd[1]: Starting LSB: OpenLDAP standalone server (Lightweight Directory Access Protocol).>
β–‘β–‘ Subject: A start job for unit slapd.service has begun execution
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘ 
β–‘β–‘ A start job for unit slapd.service has begun execution.
β–‘β–‘ 
β–‘β–‘ The job identifier is 976.
Jan 23 13:23:52 freedombox-rpi4 slapd[1484]: @(#) $OpenLDAP: slapd 2.4.57+dfsg-3 (May 15 2021 23:03:34) $
                                                     Debian OpenLDAP Maintainers <pkg-openldap-devel@lists.alioth.debian.org>
Jan 23 13:23:52 freedombox-rpi4 nslcd[946]: [45e146] <group/member="openldap"> failed to bind to LDAP server ldapi:///: Can't contact LDAP server: Connection refused
Jan 23 13:23:52 freedombox-rpi4 nslcd[946]: [45e146] <group/member="openldap"> no available LDAP server found: Can't contact contact LDAP server: Connection refused
Jan 23 13:23:52 freedombox-rpi4 nslcd[946]: [45e146] <group/member="openldap"> no available LDAP server found: Server is unavailable: Connection refused
Jan 23 13:23:52 freedombox-rpi4 slapd[1485]: mdb_db_open: database "dc=thisbox" cannot be opened: MDB_INVALID: File is not an LMDB file (-30793). Restore from backup!
Jan 23 13:23:52 freedombox-rpi4 slapd[1485]: backend_startup_one (type=mdb, suffix="dc=thisbox"): bi_db_open failed! (-30793)
Jan 23 13:23:52 freedombox-rpi4 slapd[1485]: DIGEST-MD5 common mech free
Jan 23 13:23:52 freedombox-rpi4 slapd[1485]: DIGEST-MD5 common mech free
Jan 23 13:23:52 freedombox-rpi4 slapd[1485]: slapd stopped.
Jan 23 13:23:52 freedombox-rpi4 slapd[1479]: Starting OpenLDAP: slapd
Jan 23 13:23:52 freedombox-rpi4 slapd[1486]:  failed!
Jan 23 13:23:52 freedombox-rpi4 systemd[1]: slapd.service: Control process exited, code=exited, status=1/FAILURE
β–‘β–‘ Subject: Unit process exited
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘ 
β–‘β–‘ An ExecStart= process belonging to unit slapd.service has exited.
β–‘β–‘ 
β–‘β–‘ The process' exit code is 'exited' and its exit status is 1.
Jan 23 13:23:52 freedombox-rpi4 systemd[1]: slapd.service: Failed with result 'exit-code'.
β–‘β–‘ Subject: Unit failed
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support

It seems as if the MDB files are not recognized. Can you explain how exactly you copy the three files/directories?

Thanks a lot!

Okay, I found a solution here which basically uses two slapd tools for backupping and restoring ( slapcat and slapadd). It works trouble-free and could also be easily automated for the backup tool. The /var/lib/plinth/plinth.sqlite3 file needs still to be added though :blush:

1 Like