6

I was using virtualbox on a laptop and closed the lid which locked the screen and sleep the computer. Now it came back from sleep, the screen is locked, but I can not type my password. The mouse work, I can set focus in the password box, but typing does nothing.

I guess the keyboard is held by virtualbox.

I tried plugin in a keyboard, no luck. I tried killing unity-panel-service --lockscreen-mode, it seems to have a watchdog that restart it.

I'll find some command line to sleep my vm, but is there anyway to unlock the screen from command line ?

  • 1
    "vboxmanage controlvm <VMName> savestate" -- saves the state of the vm then in my case I have no other work in progress so I just restarted lightdm. – kbenoit Jul 31 '14 at 20:19
  • have you tried to SIGSTOP vbox? – Aquarius Power Aug 2 '14 at 0:32
6

Go to TTY and run the command:

sleep 5; xdotool type <yourpassword>; xdotool key Return

and then go back to the login screen and click in the password box. Wait ~5 secs and your password will be typed and enter will have been pressed.

My pronouns are He / Him

  • Sounds good, but it refuse my password ??? – kbenoit Jul 31 '14 at 20:38
  • 1
    One should use "read pwd < /dev/stdin", type your password then use $pwd in place of <yourpassword> so that your password is not saved in history or use HISTIGNORE. – kbenoit Jul 31 '14 at 20:42
  • xdotool type abcdefghijklmnopqrstuvwxyz ouput qbcdefghijkl~nopqrstuvwxywcq ? But works fine on some other computer. That one was installed in french, the installer set a few things fr_FR instead of fr_CA. This seems to be the problem. – kbenoit Jul 31 '14 at 20:58
  • Why does this work when entered on a shell but not when run from a script in /lib/systemd/system-sleep? – JellicleCat Sep 10 '16 at 19:48
  • 1
    @JellicleCat I guess because no x screen is attached to systmd? – Tim Sep 10 '16 at 20:43
0

Currently there is no way to unlock one X session from another of them as reached by pressing ctrl+alt+f key, but you could try killing all x sessions if you need to log back in by using sudo killall Xorg , but that logs you out of all x sessions. Sorry I don't have much more help to offer, but as I know of they all run independently and without editing the ramdisk are completely separate, with the login screen running on top making editing it almost impossible.

  • You can normally set your DISPLAY variable to access you X session from a virtual terminal, but to be helpful, there should be a command to tell unity to unlock the screen. – kbenoit Jul 31 '14 at 20:18
  • but without accessing a terminal from that specific x session i don't think it's possible – sbergeron Jul 31 '14 at 20:20
  • Type ctrl-alt-F1, log in, type "export DISPLAY=:0". This terminal is now the same as a terminal inside you X session, you can start X programs and they will appear in the virtual terminal at ctrl-alt-F7. To ensure you are allowed to access the session, the file $HOME/.Xauthority contains the credentials needed to access a particular X instance. – kbenoit Aug 1 '14 at 12:35
0
  1. Use ps x from an ssh shell to find the PID (e.g. 1234) of a command running under X
  2. Type cat /proc/1234/environ | xargs -0 -L1 echo | grep Y= to show the DISPLAY and XAUTHORITY environment variables
  3. Copy those lines with export: export DISPLAY=:0 export XAUTHORITY=xxx
  4. Now you can run xdotool or whatever.

I found that I had to use xdotool key Return before the login prompt would recognise keypresses from x11vnc to let me type the real one normally.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.