An error you might come across when you're just starting out is CKR_DEVICE_ERROR. The first reason that can cause this error is that the device could not be reached over the network, so check whether the HSM value is set in /etc/hosts, whether the address is right and it is operational. In short, when you get this error, check your setup and configuration.