About --- Convert a C7, epel-7-sclo-x86_64 chroot, rpmdb created in EL9 as sqlite to bdb. When the epel-7-sclo-x86_64 chroot is initialized from an EL9 host, the rpmdb will be created by the host, for the host, or as sqlite. If you intend to shell into the chroot or run `mock -r epel-7-sclo-x86_64 --chroot "<>;"` your rpm database is broken from the C7 point of view. If our mock host was AL-8 or any EL8, its possible to run: rpm --rebuilddb -D '_db_backend bdb' --root /var/lib/mock/epel-7-sclo-x86_64/root in order to convert the database, since rpm in EL8 understands the difference between bdb and sqlite, via the macro. Its not possible to use mock chroot and do it, since EL7 has no support for sqlite, or its conversion. Are we stuck with a broken epel-7 chroot when our mock host is EL9? No we can use a bindmount trick and do the conversion of the epel-7 database from inside an AL-8 mock chroot. To start, create the epel-7 chroot with no bootstrap support: config_opts['use_bootstrap'] = False config_opts['use_bootstrap_image'] = False It will now have the undesireable sqlite rpmdb. mkdir /var/tmp/bm && cd $_ sudo tar -xf /var/cache/mock/epel-7-sclo-x86_64/root_cache/cache.tar.gz.sqlite now we have a local 2nd chroot which we will bindmount into the AL-8 chroot. [mockbuild@cs9min:~/.config/mock]$ !887 ls -al /var/lib/mock/epel-7-sclo-x86_64/root/var/lib/rpm total 35780 drwxr-xr-x 2 root root 4096 Nov 24 2021 . drwxr-xr-x 14 root root 4096 Jul 16 18:26 .. -rw-r--r-- 1 root mock 36597760 Jul 16 18:27 rpmdb.sqlite -rw-r--r-- 1 root mock 32768 Jul 16 18:27 rpmdb.sqlite-shm -rw-r--r-- 1 root mock 0 Jul 16 18:27 rpmdb.sqlite-wal -rw-r--r-- 1 root mock 0 Jul 16 18:26 .rpm.lock [mockbuild@cs9min:~/.config/mock]$ mock -r epel-7-sclo-x86_64 --init INFO: mock.py version 3.0 starting (python version = 3.9.13, NVR = mock-3.0-1.el9)... Start: init plugins INFO: selinux disabled Finish: init plugins INFO: Signal handler active Start: run INFO: Setting hostname: c7mock Start: clean chroot Finish: clean chroot Start: chroot init INFO: calling preinit hooks INFO: enabled root cache Start: unpacking root cache Finish: unpacking root cache INFO: enabled package manager cache Start: cleaning package manager metadata Finish: cleaning package manager metadata INFO: enabled HW Info plugin Mock Version: 3.0 INFO: Mock Version: 3.0 Finish: chroot init Finish: run [mockbuild@cs9min:~/.config/mock]$ ls -al /var/lib/mock/epel-7-sclo-x86_64/root/var/lib/rpm total 34412 drwxr-xr-x 2 root root 4096 Jul 16 18:35 . drwxr-xr-x 14 root root 4096 Jul 16 18:34 .. -rw-r--r-- 1 root root 1589248 Jul 16 18:34 Basenames -rw-r--r-- 1 root root 8192 Jul 16 18:34 Conflictname -rw-r--r-- 1 root root 0 Jul 16 18:35 .dbenv.lock -rw-r--r-- 1 root root 1011712 Jul 16 18:34 Dirnames -rw-r--r-- 1 root root 8192 Jul 16 18:34 Enhancename -rw-r--r-- 1 root root 8192 Jul 16 18:34 Filetriggername -rw-r--r-- 1 root root 8192 Jul 16 18:34 Group -rw-r--r-- 1 root root 12288 Jul 16 18:34 Installtid -rw-r--r-- 1 root root 20480 Jul 16 18:34 Name -rw-r--r-- 1 root root 8192 Jul 16 18:34 Obsoletename -rw-r--r-- 1 root root 32190464 Jul 16 18:34 Packages -rw-r--r-- 1 root root 143360 Jul 16 18:34 Providename -rw-r--r-- 1 root root 8192 Jul 16 18:34 Recommendname -rw-r--r-- 1 root root 122880 Jul 16 18:34 Requirename -rw-r--r-- 1 root root 32768 Jul 16 18:34 Sha1header -rw-r--r-- 1 root root 24576 Jul 16 18:34 Sigmd5 -rw-r--r-- 1 root root 8192 Jul 16 18:34 Suggestname -rw-r--r-- 1 root root 8192 Jul 16 18:34 Supplementname -rw-r--r-- 1 root root 8192 Jul 16 18:34 Transfiletriggername -rw-r--r-- 1 root root 8192 Jul 16 18:34 Triggername Add these into the AL-8 chroot config, remember to touch the CFG into the past when done. config_opts['plugin_conf']['bind_mount_enable'] = True config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/var/tmp/bm', '/mnt/' )) Next, launch the AL-8 shell: mock -r almalinux-dev-8-x86_64 --shell now your epel-7 chroot is at /mnt! while inside, we can run rpm --rebuilddb -D '_db_backend bdb' --root /mnt Exit the AL-8 chroot, then archive the fixed chroot back into /var/cache/mock: cd /var/tmp/bm sudo tar -Ipigz -cf /var/cache/mock/epel-7-sclo-x86_64/root_cache/cache.tar.gz ./ The next time you do: mock -r epel-7-sclo-x86_64 --init your chroot is OK for shell. Even below works, although the DB is bdb. mock -r epel-7-sclo-x86_64 --dnf-cmd replist These warnings will appear: warning: Found bdb_ro Packages database while attempting sqlite backend: using bdb_ro backend They are harmless. Note: any attempt to rebuild the epel-7 rpmdb from the EL9 host will get: [mockbuild@hatvm ~]$ sudo rpm --rebuilddb -D '_db_backend bdb' --root /var/tmp/bm warning: invalid %_db_backend: bdb warning: using dummy database, installs not possible warning: invalid %_db_backend: bdb warning: using dummy database, installs not possible This is why the trick to use the AL-8 chroot was tried. Author --- PryMar56 July 2022