Reflashing the Librem 5 is the best way to remove your personal data and put the phone back into factory defaults.
Warning, this procedure will completely erase everything on the device! Make a backup beforehand!
The Librem 5 gets reflashed from a separate 64-bit x86 computer running PureOS (or booted from the live PureOS disk).
Reflashing from that computer is as simple as installing the needed packages:
sudo apt install git python3-jenkins python3-tqdm uuu
Downloading the flashing scripts:
And flashing the phone for Evergreen (mass-produced version)
cd librem5-devkit-tools sudo ./scripts/librem5-flash-image
Detailed directions including how to flash the older Dogwood/Chestnut/Birch versions can be found here; while the above procedure is demonstrated in this video:
If you’re not running PureOS or a recent version of Debian or Ubuntu, you may need to alter the install step for your distribution. If all else fails, you can build a live USB of PureOS, boot it, and flash the Librem 5 from there.