The LCD displays correctly five seconds or so then stops with keypad input. Both nano and uno behave the same. I assume this is a hardware problem but have little experience with these. I would appreciate your advise.
You could be correct, or wrong. I cannot see your wiring, or your code, so who knows.
Depends what you mean by "a hardware problem". The most obvious such is naïvely thinking you can actually power a project from "Vin" or the "barrel jack" and having the on-board regulator lacking proper heat-sinking, shut down when it overheats after a matter of seconds.
However if it is a response to keyboard input, it is far more likely a problem in your secret code. Do read the instructions for posting here.
Does the LCD run longer if you don't press any button on the keypad?
Can it be that the keypad somehow shortens something if a button is pressen?
As missdeew already said, you have to provide more information. Without, how should someone be able to find out what's wrong?