Autokey suddenly won't start

106 views
Skip to first unread message

Johnny Rosenberg

unread,
Dec 20, 2018, 12:14:40 PM12/20/18
to autoke...@googlegroups.com
I don't know if something happened to my system (Manjaro) or if there was an AutoKey update that changed things (sometimes there are hundreds of upgrades in Manjaro and I usually don't check every one of them, so I don't know in this case).
Anyway, I currently have the autokey-py3 package 0.95.4-1 installed from AUR.
This is what happens when I start autokey-gtk:
johnny $ autokey-gtk -l
2018-12-20 17:58:00,080 INFO - root - Initialising application
2018-12-20 17:58:00,089 INFO - root - Initialise global hotkeys
2018-12-20 17:58:00,089 INFO - config-manager - Loading config from existing file: /home/johnny/.config/autokey/autokey.json
2018-12-20 17:58:00,090 DEBUG - config-manager - Loading folder at '/home/johnny/.config/autokey/data/Skript'
2018-12-20 17:58:00,097 DEBUG - config-manager - Loading folder at '/home/johnny/.config/autokey/data/Fraser'
2018-12-20 17:58:00,133 INFO - config-manager - Configuration changed - rebuilding in-memory structures
2018-12-20 17:58:00,133 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Skript
2018-12-20 17:58:00,133 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Skript/Tillfälligt
2018-12-20 17:58:00,133 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Skript/Basic-programmering
2018-12-20 17:58:00,133 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Skript/Handla
2018-12-20 17:58:00,133 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Skript/Exempel
2018-12-20 17:58:00,133 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Skript/Översättning
2018-12-20 17:58:00,134 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser
2018-12-20 17:58:00,134 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Ekonomi
2018-12-20 17:58:00,134 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Chatförkortningar
2018-12-20 17:58:00,134 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Korrigeringar
2018-12-20 17:58:00,134 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Datorförkortningar
2018-12-20 17:58:00,134 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Datorförkortningar/Internet
2018-12-20 17:58:00,134 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Datorförkortningar/Sökvägar
2018-12-20 17:58:00,134 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Datorförkortningar/Taggar
2018-12-20 17:58:00,134 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Namn
2018-12-20 17:58:00,135 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Specialtecken
2018-12-20 17:58:00,135 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Musikprojekt
2018-12-20 17:58:00,135 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Musikprojekt/Prylar
2018-12-20 17:58:00,135 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Musikprojekt/Genres
2018-12-20 17:58:00,135 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Musikprojekt/Upphovsmän
2018-12-20 17:58:00,135 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Musikprojekt/Låttitlar
2018-12-20 17:58:00,135 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Matematik
2018-12-20 17:58:00,135 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Bank-förkortningar
2018-12-20 17:58:00,135 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Adresser
2018-12-20 17:58:00,136 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Adresser/E-post
2018-12-20 17:58:00,136 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Förkortningar
2018-12-20 17:58:00,136 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data/Fraser/Artister
2018-12-20 17:58:00,136 INFO - config-manager - Successfully loaded configuration
2018-12-20 17:58:00,136 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey/data
2018-12-20 17:58:00,136 DEBUG - inotify - Adding watch for /home/johnny/.config/autokey
2018-12-20 17:58:00,136 DEBUG - config-manager - Global settings: {'isFirstRun': True, 'serviceRunning': True, 'menuTakesFocus': False, 'showTrayIcon': True, 'sortByUsageCount': True, 'promptToSave': False, 'enableQT4Workaround': False, 'interfaceType': 'XRecord', 'undoUsingBackspace': False, 'windowDefaultSize': [824, 1020], 'hPanePosition': 390, 'columnWidths': [150, 50, 100], 'showToolbar': True, 'notificationIcon': 'autokey-status', 'workAroundApps': '.*VirtualBox.*|krdc.Krdc', 'triggerItemByInitial': False, 'scriptGlobals': {}}
2018-12-20 17:58:00,136 INFO - service - Starting service
2018-12-20 17:58:00,149 ERROR - root - Error starting interface: Can't connect to display ":0.0": b'Invalid MIT-MAGIC-COOKIE-1 key'
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/autokey/gtkapp.py", line 149, in initialise
    self.service.start()
  File "/usr/lib/python3.7/site-packages/autokey/service.py", line 81, in start
    self.mediator = IoMediator(self)
  File "/usr/lib/python3.7/site-packages/autokey/iomediator/_iomediator.py", line 50, in __init__
    self.interface = XRecordInterface(self, service.app)
  File "/usr/lib/python3.7/site-packages/autokey/interface.py", line 201, in __init__
    self.__initMappings()
  File "/usr/lib/python3.7/site-packages/autokey/interface.py", line 254, in __initMappings
    self.localDisplay = display.Display()
  File "/usr/lib/python3.7/site-packages/Xlib/display.py", line 89, in __init__
    self.display = _BaseDisplay(display)
  File "/usr/lib/python3.7/site-packages/Xlib/display.py", line 71, in __init__
    protocol_display.Display.__init__(self, *args, **keys)
  File "/usr/lib/python3.7/site-packages/Xlib/protocol/display.py", line 167, in __init__
    raise error.DisplayConnectionError(self.display_name, r.reason)
Xlib.error.DisplayConnectionError: Can't connect to display ":0.0": b'Invalid MIT-MAGIC-COOKIE-1 key'

Can I do anything about this? What?


Kind regards

Johnny Rosenberg

Joe

unread,
Dec 20, 2018, 1:32:31 PM12/20/18
to autoke...@googlegroups.com
First guess is that there's something it doesn't like about your
display. Display :0 is usually your first/primary display (there would
be others if you had additional monitors attached to your computer.) If
you type

echo $DISPLAY

in a terminal, it will tell you the name of your current display. The
magic cookie may be some type of display identifier. I don't know. (I
wasn't smart enough to get into MIT. ;) )

Since Manjaro is based on bleeding edge Arch, it may be something new
they added to your system. If it uses Wayland instead of X11, AutoKey
won't be happy.

I'm not familiar with pacman, or whatever package manager you use, but
it must have a history option so you can review what it did when. My apt
GUI has one on its main toolbar. That can be really useful when weird
things like this start happening.

TL;DR: If you want talk to someone who actually knows what they're
talking about ;) , take this question over to Gitter.
https://gitter.im/autokey/autokey

And, whatever you do, don't feed you computer magic cookies!

Joe
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Joe

unread,
Dec 20, 2018, 2:04:32 PM12/20/18
to autoke...@googlegroups.com
Took a spin on duckduckgo and came up with a few things to try.

If any of them work, you'll still have to fix the problem more
permanently later.

Quit AutoKey, then from a terminal,

export DISPLAY=:0.0 ## You may have to use a different value if your
system is weird.
autokey-gtk

and see if it is any happier.

You can also try

rm ~/.Xauthority

and see if that helps.

I did a search on

Can't connect to display ":0.0": b'Invalid MIT-MAGIC-COOKIE-1 key

and found this:

https://www.linuxquestions.org/questions/debian-26/xlib-invalid-mit-magic-cookie-1-key-278821/

It's pretty old, but that's where I got the ideas mentioned above.

Way older:

https://lists.debian.org/debian-user/1998/09/msg00113.html

> > Since your prompt shows a "#" I assume you try this as root. From the
> > error I also assume that you have logged in as another user.
> >
> > The reason you get this error is because user B is not allowed to
> > open windows on a display controlled by user A. If user A wants to
> > allow this, he can type 'xhost +localhost' to allow everyone on
> > localhost to open windows.
> >
(The above is just top see if it works. It's not something to do on an
ongoing basis.)

You're not trying to run your GUI as root, are you?
That's hard to do right and normally shouldn't be done at all.

Are there any VMs being used,  etc.?

Joe


On 12/20/18 12:14 PM, Johnny Rosenberg wrote:

Johnny Rosenberg

unread,
Dec 20, 2018, 3:33:18 PM12/20/18
to autoke...@googlegroups.com
Den tors 20 dec. 2018 kl 20:04 skrev Joe <jos...@main.nc.us>:
Took a spin on duckduckgo and came up with a few things to try.

If any of them work, you'll still have to fix the problem more
permanently later.

Quit AutoKey, then from a terminal,

export DISPLAY=:0.0 ## You may have to use a different value if your
system is weird.

The values was already :0.0
 
autokey-gtk

and see if it is any happier.

It didn't. I also tried a few other values, no luck.

You can also try

rm ~/.Xauthority

No luck there either, now I also got an segmentation fault, but I'm not sure it was related to this.
 

and see if that helps.

I did a search on

Can't connect to display ":0.0": b'Invalid MIT-MAGIC-COOKIE-1 key

and found this:

https://www.linuxquestions.org/questions/debian-26/xlib-invalid-mit-magic-cookie-1-key-278821/

It's pretty old, but that's where I got the ideas mentioned above.

Way older:

https://lists.debian.org/debian-user/1998/09/msg00113.html

> > Since your prompt shows a "#" I assume you try this as root. From the
> > error I also assume that you have logged in as another user.
> >
> > The reason you get this error is because user B is not allowed to
> > open windows on a display controlled by user A. If user A wants to
> > allow this, he can type 'xhost +localhost' to allow everyone on
> > localhost to open windows.
> >
(The above is just top see if it works. It's not something to do on an
ongoing basis.)

You're not trying to run your GUI as root, are you?

Not that I know of. I didn't change anything in that matter since I installed Manjaro from scratch maybe a year or more ago.
 
That's hard to do right and normally shouldn't be done at all.

I don't think I do that.

Are there any VMs being used,  etc.?

No.

I finally gave up and restarted my computer and now it works again. That's funny, because this was not the first restart I did.

Here's the whole story (I think):
My wife started the computer and logged in to her account. Even though I added her account when I originally installed Manjaro, she only started to use it a few days ago. I found that strange things may happen if she leaves the computer for a while until the lock screen feature kicks in. If I then log in to my account, some things seems to work funny.
This was what happened today, so then I logged out again, logged in to her account just to log her out properly and then logged in again.
This didn't help, so I shut down the computer entirely, powered it off until nothing lights inside the tower (otherwise I will only have one screen when I start up again, for some reason…).
Then I started it up again, but the problem still persisted. Autokey just wouldn't start. So I wrote here.

But now, as I said, I did the very same restart process and now it works, so something was probably not starting up properly last time, because I also noticed that I couldn't open hunar, menulibre, pamac-manager nor xfce4-taskmanager. So I basically had to restart to be able to investigate what was going on. I wanted to see if I had Wayland installed, but I couldn't open pamac-manager (graphical user interface for pacman, kind of; I'm still not comfortable using pacman in a terminal)

But this time, AutoKey started without any problems. I'm not sure what went wrong earlier and it seems like we will not know for a while. Maybe it's the login and screen lock thing that still is a little shaky. Next time I will just ask my wife to logout properly when she's done. If this happens again anyway, then at least I know that the screen lock thing didn't have anything to do with it…


Kind regards

Johnny Rosenberg



Joe


On 12/20/18 12:14 PM, Johnny Rosenberg wrote:
> Can't connect to display ":0.0": b'Invalid MIT-MAGIC-COOKIE-1 key

--
You received this message because you are subscribed to the Google Groups "autokey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autokey-user...@googlegroups.com.

Joe

unread,
Dec 20, 2018, 5:33:45 PM12/20/18
to autoke...@googlegroups.com
Very glad it's working again, but not so much that we don't know why.

Inline.

Joe

On 12/20/18 3:33 PM, Johnny Rosenberg wrote:
> Den tors 20 dec. 2018 kl 20:04 skrev Joe <jos...@main.nc.us
> <mailto:jos...@main.nc.us>>:
>
> Took a spin on duckduckgo and came up with a few things to try.
>
> If any of them work, you'll still have to fix the problem more
> permanently later.
>
> Quit AutoKey, then from a terminal,
>
> export DISPLAY=:0.0 ## You may have to use a different value if your
> system is weird.
>
>
> The values was already :0.0
That was what I expected, but we had to be sure.
>  
>
> autokey-gtk
>
> and see if it is any happier.
>
>
> It didn't. I also tried a few other values, no luck.
>
>
> You can also try
>
> rm ~/.Xauthority
>
>
> No luck there either, now I also got an segmentation fault, but I'm
> not sure it was related to this.
Usually, when files like this disappear, the app that uses them
recreates a fresh copy.
>  
>
>
> and see if that helps.
>
> I did a search on
>
> Can't connect to display ":0.0": b'Invalid MIT-MAGIC-COOKIE-1 key
>
> and found this:
>
> https://www.linuxquestions.org/questions/debian-26/xlib-invalid-mit-magic-cookie-1-key-278821/
>
> It's pretty old, but that's where I got the ideas mentioned above.
>
> Way older:
>
> https://lists.debian.org/debian-user/1998/09/msg00113.html
>
> > > Since your prompt shows a "#" I assume you try this as root.
> From the
> > > error I also assume that you have logged in as another user.
> > >
> > > The reason you get this error is because user B is not allowed to
> > > open windows on a display controlled by user A. If user A wants to
> > > allow this, he can type 'xhost +localhost' to allow everyone on
> > > localhost to open windows.
> > >
> (The above is just top see if it works. It's not something to do on an
> ongoing basis.)
>
> You're not trying to run your GUI as root, are you?
>
>
> Not that I know of. I didn't change anything in that matter since I
> installed Manjaro from scratch maybe a year or more ago.
You would know. It's not something that happens by itself. It would
probably be a huge security hole if it did.
>  
>
> That's hard to do right and normally shouldn't be done at all.
>
>
> I don't think I do that.
Nope.
>
>
> Are there any VMs being used,  etc.?
>
>
> No.
I'm just trying to find anybody besides "you" who could be claiming
ownership of your display device.
>
> I finally gave up and restarted my computer and now it works again.
> That's funny, because this was not the first restart I did.
>
> Here's the whole story (I think):
> My wife started the computer and logged in to her account. Even though
> I added her account when I originally installed Manjaro, she only
> started to use it a few days ago. I found that strange things may
> happen if she leaves the computer for a while until the lock screen
> feature kicks in. If I then log in to my account, some things seems to
> work funny.
I had two users on one of my previous notebooks. That's Linux's heritage
to be able to do that right. But, that was on the CLI when GUIs didn't
exist. AFAICT, running multiple GUI users is way more trouble than it's
worth with the price of good computers being so low - unless it's a
supercomputer or a server.
> This was what happened today, so then I logged out again, logged in to
> her account just to log her out properly and then logged in again.
> This didn't help, so I shut down the computer entirely, powered it off
> until nothing lights inside the tower (otherwise I will only have one
> screen when I start up again, for some reason…).

That got my attention - what's that about "have one screen when I start
up again"? Do you have more than one physical display unit attached to
your computer?

Maybe if your wife switched the computer display to the secondary
monitor, but didn't log out and then you came along trying to use the
primary monitor or something like that.

I occasionally plug in a couple HDMI monitors (at different locations)
and getting that to work right involves playing around in system
settings every time although kscreen (part of KDE) is now much better at
doing things right by itself than it was when it was new in 16.04.
Moving the sound around takes some fiddling too. There's still not a
scenario feature like there is on modern AV receivers  or on Logitec
Harmony remote controls. Things can still get pretty messed up if you
have both screens on and shut the lid on the notebook. Sometimes it
comes back OK when you open the lid again and sometimes it's a mess.

> Then I started it up again, but the problem still persisted. Autokey
> just wouldn't start. So I wrote here.
>
> But now, as I said, I did the very same restart process and now it
> works, so something was probably not starting up properly last time,
> because I also noticed that I couldn't open hunar, menulibre,
> pamac-manager nor xfce4-taskmanager. So I basically had to restart to
> be able to investigate what was going on. I wanted to see if I had
> Wayland installed, but I couldn't open pamac-manager (graphical user
> interface for pacman, kind of; I'm still not comfortable using pacman
> in a terminal)
>
Rebooting (and shutting down, even more so) stops a lot of things like
daemons and services which run independently from user sessions. Many
"persistent" settings tend to go back to defaults and various cached
things go away.

As an apt user, I can verify that my GUI front end (muon) is very nice
and works great, but as soon as anything goes wrong, there's no
substitute for going in and using apt on the CLI and sometimes, dpkg,
the next level down from apt. If you're not comfortable with pacman and
whatever's under that, make yourself a dual boot or a VM and go break
things!

If muon hangs or crashes during an update, it leaves a bunch of lock
files locked. There is no way out of that without running special
commands on the CLI. I wrote a script to do it once I figured it out.
It's not entirely obvious. My howto/apt directory has 26 howtos just
about package management that I wrote over a number of years and
tribulations.

> But this time, AutoKey started without any problems. I'm not sure what
> went wrong earlier and it seems like we will not know for a while.
> Maybe it's the login and screen lock thing that still is a little
> shaky. Next time I will just ask my wife to logout properly when she's
> done. If this happens again anyway, then at least I know that the
> screen lock thing didn't have anything to do with it…

I'm superstitious. I don't use hibernation either. In the beginning, it
was because WiFi never came back, but now I just prefer a clean shutdown
with nothing "pending" when I startup again.

Having stuff run by anacron is bad enough, and I don't currently have
anything of mine in there. Anacron looks at crontab for scheduled jobs
that didn't run when they were supposed to (like if the notebook was
off) and then runs them a little while after startup. Depending on what
those things are, it can be a non-event or a backup that requires not
using the computer until it's done.

>
>
> Kind regards
>
> Johnny Rosenberg
>
>
>
> Joe
>
>
> On 12/20/18 12:14 PM, Johnny Rosenberg wrote:
> > Can't connect to display ":0.0": b'Invalid MIT-MAGIC-COOKIE-1 key
>
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to autokey-user...@googlegroups.com
> <mailto:autokey-users%2Bunsu...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
Reply all
Reply to author
Forward
0 new messages