Context: I forgot my unlock pattern, so I used TWRP and ADB to move gatekeeper.password.key and gatekeeper.pattern.key to /sdcard, so now I am able to use my phone again :-)
Problem: I want to set a new pattern, but whenever I go to Settings>Security and press Screen lock, it crashes:
How to solve the problem?
I restarted, cleared all apps cache, wiped the cache partition from TWRP, booted in safe mode, always crash. I am afraid that if I move the files back the situation will get even worse, or at best it will ask me for the pattern that I still can't remember.
Android 7.1.2 LineageOS


locksettings.db*files from the same place where you removed the.keyfiles (see my second comment on your answer). :) – Izzy Jul 27 '18 at 09:01