Rawhide: selinux: "Unable to get valid context for <username>"

Richard W.M. Jones rjones at redhat.com
Sun Jun 19 16:59:43 UTC 2011

On Sun, Jun 19, 2011 at 06:42:34PM +0200, Jim Meyering wrote:
> Richard W.M. Jones wrote:
> > Anyone seeing this error?  Unless I boot with enforcing=0, I see
> > this error when I try to log in as any user:
> >
> >   Unable to get valid context for <username>
> >
> > It seems like it's just started happening, since I upgraded something
> > within the last 1-2 weeks.
> Hi Rich,
> I'm using 3.0-0.rc3.git5.1.fc16.x86_64 in enforcing mode (of course ;-)
> and don't see any problem when logging in via ssh:
>     h$ ssh r date
>     Sun Jun 19 18:34:32 CEST 2011
>     h$ ssh r
>     Last login: Sun Jun 19 18:33:11 2011 from
>     r$                                                                          :
> Everything is up to date, at least wrt whatever mirror I'm using.
> My shell on that system is zsh;  but I got the same result when
> temporarily switching it to bash.

I was still seeing it, even after just updating everything and
rebooting the VM:

$ ssh
Unable to get valid context for rjones
Last login: Sun Jun 19 17:46:29 2011 from
Connection to closed.

However I then touched /.autorelabel using guestfish:

# guestfish -i --rw -d FedoraRawhidex64 touch /.autorelabel

(it turns out I've written about this before, but had forgotten, see

And that fixed it!  However I don't know why ...


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org

More information about the devel mailing list