Оказывается, мне не хватало пакета python3 .7-gdbm (это Ubuntu Xenial Server).
Его можно установить с помощью apt-get:
sudo apt-get install python3.7-gdbm
После установки пакета gdbm python начнет сохранять полку как GNU dbm вместо Berkeley DB:
$ file *
shelve_obj_berkley: Berkeley DB (Hash, version 9, native byte-order)
shelve_obj_gdbm: GNU dbm 1.x or ndbm database, little endian, old