Output from 'groups' is suddently different to /etc/group

R. Diez rdiezmail-ubuntu at yahoo.de
Fri Jul 20 09:35:18 UTC 2018


Hi all:

I am actually using Kubuntu 16.04.4, but I believe this question has to 
do with the Ubuntu base, therefore I am asking in this mailing list.

I have been using this system for years without problems. I wanted to 
run another Linux in a virtual machine, so I installed VirtualBox, and I 
saw severe memory leaks in Xorg which brought the system down. So I 
decided to try virt-manager instead.

Up installation, it did not work, I had to install additional libvirt 
and Qemu packages, until it did work. I had done it before on another 
system, at that time an Xubuntu 16.04.4. I noticed at the time that 
installing those packages added groups 'libvirtd' and 'kvm' to /etc/group .

I found it unfortunate that the installer (Synaptic) did not warn me 
that I had to log out and in again. I expected that everything would 
work straight away, but my user account was not immediately a member of 
those groups. I guess that this is a limitation of the underlying Debian 
APT system. In any case, I did realise, and after a system restart, 
everything worked properly. Unfortunately, I do not have access to that 
Xubuntu system anymore.

I repeated the same on my Kubuntu system, and everything worked the 
same. But after a couple of days, I noticed problems everywhere. The 
reason is that my user account was only member of 1 group (with the same 
username), and was not a member of any of the other usual groups. That 
is what I mean:


$ groups
rdiez

$ groups $USER
rdiez : rdiez adm tty dialout cdrom sudo dip plugdev fuse lpadmin 
sambashare wireshark libvirtd

If I go through "su", group membership is fine again:

$ su - "$USER"
$ groups
rdiez adm tty dialout cdrom sudo dip plugdev fuse lpadmin sambashare 
wireshark libvirtd


This discrepancy is apparently nothing surprising, for it is described here:

https://superuser.com/questions/294650/why-is-the-output-from-groups-different-from-groups-user-if-im-currently-log

https://serverfault.com/questions/339983/output-of-groups-different-then-id

However, I did not have this problem before, and it is becoming a pain.

I do not know if KVM/Qemu is the really the cause (it is only a 
suspicion), or it is something else, like the latest system updates.

I guess that the login manager / SystemD / whatever is not handling 
group membership correctly, even though "su" can. I would like to know 
how I can "debug" my system to restore it to the previous state, where 
my account was member of all groups right from the start.


Please copy me on all the answers, for I am not subscribed to this 
mailing list.

Thanks in advance,
   rdiez





More information about the ubuntu-users mailing list