If you cannot copy and paste from KeePass2 to the terminal, all you need to do is install xsel which is used for getting and setting contents of the X selection:

sudo apt-get install xsel

Some forum posts suggest logging in and out of the session, which wasn't necessary in our case.