Hi there, welcome to the forum.
Some good reading
https://wiki.archlinux.org/title/Pacman#"Failed_to_init_transaction_(unable_to_lock_database)"_error
If something happens during the process here (see 1 and 5):
https://wiki.archlinux.org/title/Pacman#What_happens_during_package_install/upgrade/removal
5 Likes