The DISPLAY environment variable was set but no graphical - Qt or GTK backend of the pinentry was installed (packages pinentry-gtk or pinentry-qt). Due to this issue, the volume_key command printed "volume_key: Error creating `packet': GPGME: Bad passphrase" although the user supplied the correct credentials. This workaround unsets the environment variable DISPLAY. Now, the volume_key works as expected.
# unset DISPLAY