Crouton: startx fails with repeated Invalid MIT-MAGIC-COOKIE-1

Created on 5 Jun 2013  ·  15Comments  ·  Source: dnschneid/crouton

Steps I took:

  1. created a base x11 chroot
    sudo sh -e ~/Downloads/crouton -t x11
  2. entered the chroot
    sudo enter-chroot
  3. installed mate-desktop from
    http://wiki.mate-desktop.org/download
  4. Created a .xinitrc file in the chroot user home folder with the command to launch mate
    echo "exec mate-session" > ~/.xinitrc
  5. tried to launch x
    startx

It tries to launch, switches to the third tty to run X but nothing shows up. After switching back to ChromeOS there is a repeating line in the X server output.
Invalid MIT-MAGIC-COOKIE-1 keyInvalid MIT-MAGIC-COOKIE-1 key..

Not sure if I am missing anything or is something just isn't working.

bug

Most helpful comment

I googled this error and found some possible fixes:

1 - enter 'rm ~/.Xauthority' - http://slopjong.de/2011/06/14/invalid-mit-magic-cookie-1-key/
2 - enter 'xhost local:root' - http://easytofu.com/05062011150909-mit-magic-cookie-cannot-open-display-error
2 - a few combinations of the above and others - http://www.linuxquestions.org/questions/debian-26/xlib-invalid-mit-magic-cookie-1-key-278821/

Hopefully one or some combination above will get you all fixed up ;-)

All 15 comments

I googled this error and found some possible fixes:

1 - enter 'rm ~/.Xauthority' - http://slopjong.de/2011/06/14/invalid-mit-magic-cookie-1-key/
2 - enter 'xhost local:root' - http://easytofu.com/05062011150909-mit-magic-cookie-cannot-open-display-error
2 - a few combinations of the above and others - http://www.linuxquestions.org/questions/debian-26/xlib-invalid-mit-magic-cookie-1-key-278821/

Hopefully one or some combination above will get you all fixed up ;-)

I never managed to get startx to work, but I honestly didn't try very hard either. Use xinit if you don't feel like debugging it. Otherwise, as far as getting startx working (which really should happen at some point), it seems like startx is either ignoring the display number passed to it (and thus failing to connect to :0, or it is some issue with .Xauthority.

Ahh thanks. Just running xinit worked great. Read my ~/.xinitrc and started mate. I was under the impression that startx did exactly that but with a few extra features. Thanks for all the great work.

Didn't mean to mark it s closed. Still need to figure out why startx fails. :)

Agreed.

Try replacing /usr/local/bin/xinit with the following and see if startx behaves properly:

#!/bin/sh -e
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Filters the xinit command, fixing the display and removing xauth.
# Also adds the -- to the command line and references the global xserverrc 
# if it isn't already there.
# By putting this in /usr/local/bin, PATH will prefer it and scripts that
# call xinit will automagically work.

croutonwm='/usr/local/bin/croutonwm'
if [ -x "$croutonwm" ]; then
    . "$croutonwm"
fi

xserverrc='/etc/X11/xinit/xserverrc'
dash='--'
disp=''
n=$#
while [ ! "$n" = 0 ]; do
    arg="$1"
    n="$((n-1))"
    shift
    if [ -z "$disp" -a ! "${arg#":"}" = "$arg" ]; then
        disp="$arg"
        continue
    elif [ "$arg" = '-auth' ]; then
        if [ ! "$n" = 0 ]; then
            n="$((n-1))"
            shift
        fi
        continue
    elif [ -n "$dash" -a "$arg" = '--' ]; then
        dash=
        # Check if there's a xserverrc specified.
        if [ ! "${1#/}" = "$1" ]; then
            xserverrc=''
        fi
    fi
    set -- "$@" "$arg"
done

disp=0
while [ -f "/tmp/.X$disp-lock" ]; do
    disp=$((disp+1))
done

exec /usr/bin/xinit /usr/local/bin/croutonxinitrc-wrapper "$@" $dash $xserverrc ":$disp"

Also in the startx branch.

Great, now startx is working for me as well (without the startx branch). This is strange.

I did Xinit and the in the windows typed startx , afterward there was a message to remove a directory which I did with rm command, restarted the comp and all worked fine.

For what it's worth, startx still doesn't seem to work?

I'm also trying to run Mate, and it works if I start it with sudo xinit but then, of course, I'm logged in as root - which is not what I want. When I try to run xinit without sudo, I get this: https://gist.github.com/JoshMcCullough/b04f321a5ecc8bc28994

Any ideas?

Reboot and try again without sudo.

I believe startx has been working for a while now so closing this issue, please reopen if it's still an issue.

@DennisLfromGA Wow I had completely forgotten about this. Haven't even had my Chromebook for a year or two. Glad it's closed!

I know, there seems to be a bunch of these that have been fixed and are still hanging around. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anonymouseprogrammer picture anonymouseprogrammer  ·  4Comments

kiorpesc picture kiorpesc  ·  4Comments

killshot13 picture killshot13  ·  3Comments

jbaum98 picture jbaum98  ·  4Comments

jvschiavo picture jvschiavo  ·  4Comments