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 ?

Zanna
  • 70,465
kbenoit
  • 2,350

3 Answers3

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

Tim
  • 32,861
  • 27
  • 118
  • 178
  • 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 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? – Jellicle 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
  • @Tim : thanks. With your guidance, I incorporated this answer to successfully use xdotool on the login screen from system-sleep: http://stackoverflow.com/a/10721288/507721 – Jellicle Sep 11 '16 at 16:19
  • Additionally, in my script, I needed to run xdotool as my own user, not as root (which matters because system-sleep's scripts run as root. – Jellicle Sep 11 '16 at 16:27
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.

sbergeron
  • 2,660
  • 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 01 '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.