Output from 'groups' is suddently different to /etc/group
On Fri, Jul 20, 2018 at 11:37 AM R. Diez via ubuntu-users
<ubuntu-users at lists.ubuntu.com> wrote:
> 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
> $ 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:
> 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.
Everything's handling group membership correctly.
If you're logged in when you're added to a group, you must either log
out and log back in or use "newgrp" to add that group to your
effective list of groups.
I don't think that a dpkg- or rpm-based distro's post-install scripts
can add a group to an already-logged-in user's effective list of
groups. It has to be done within that user's session.
> Please copy me on all the answers, for I am not subscribed to this
> mailing list.