# cannot delete selinux login, missing selinux user

## aleiphoenix

Hi, I'm new to selinux and have a problem.

I tried to add a selinux login and user by

```

$ semanage user -a -R "staff_r sysadm_r" aleiphoenix

$ semanage login -a -s aleiphoenix aleiphoenix

```

When I realized that I don't need a new selinux user, staff_u will be just good, I delete the selinux user first

```

$ semanage user -D aleiphoenix

```

Then, change login - user mapping 

```

semanage login -m -s staff_u aleiphoenix

```

Got

```

libsemanage.dbase_llist_query: could not query record value

/usr/lib/python-exec/python2.7/semanage: Could not query user for aleiphoenix

```

Guess the missing selinux user cause this problem. So I tried to add selinux user back

```

semanage user -a -R "staff_r sysadm_r" aleiphoenix

```

But got

```

libsemanage.validate_handler: selinux user aleiphoenix does not exist (No such file or directory).

libsemanage.validate_handler: seuser mapping [aleiphoenix -> aleiphoenix] is invalid (No such file or directory).

libsemanage.dbase_llist_iterate: could not iterate over records (No such file or directory).

/usr/lib/python-exec/python2.7/semanage: Could not commit semanage transaction

```

the output of selinux user -l and selinux login -l

```

$ semanage login -l

Login Name                SELinux User             

__default__               user_u                   

aleiphoenix               aleiphoenix              

root                      root                     

system_u                  system_u

$ semanage user -l

SELinux User    SELinux Roles

root            staff_r sysadm_r

staff_u         staff_r sysadm_r

sysadm_u        sysadm_r

system_u        system_r

unconfined_u    unconfined_r

user_u          user_r

```

Now it seems the new selinux login `aleiphoenix` is totally dead, How can I delete it ?

Thanks.

----------

## GODLiKE

I have exactly the same problem, were you able to solve it?

----------

## Sven Vermeulen

The good news is that newer SELinux utilities seem to have a fail-safe for this situation:

```

~$ semanage user -D test_u

libsemanage.lookup_seuser: test_u is being used by test login record (Invalid argument).

OSError: Invalid argument

```

Bad news is that this doesn't help you out right now.

Try editing the /etc/selinux/strict/seusers file. If you remove the entry for the login you want to modify (syntax is "login":"SELinux user") then it should go towards the default entry. A policy rebuild might be needed to have it loaded though (semodule -B does that for you).

----------

## GODLiKE

After borking many times my SELinux installation I think I fixed it. Try editing you seusers file under /etc/selinux (and /etc/selinux/SELINUXTYPE) and removing the offending mapping.

----------

