Deleted my groups file somehow, how do I get them back?

So this is embarrassing... I seem to have deleted my user groups while I was trying to get evdev passthrough to work with my virtual machine. I actually had a working setup until I tried to add sound for my virtual machine. I also somehow deleted my user from the sudoers file, but managed to get that back. I have no idea how this all happened. Maybe it has to do with the fact that it's 4am and I've been trying to get things to work for a while. Too much time spent on the screen.

I have checked KUser and it's showing blank under groups. I have navigated to /etc and checked what the "groups" file contains. It's blank. However "groups-" file seems to have all the correct groups. I read that one can restore groups from that file. However the instructions aren't very clear. Or I'm just too tired and stupid to understand.

If there are any logs or files I need to post, I'll gladly post them if somebody tells me how to do it.

Restore from a snapshot. You can browse the files.

It's like Garuda includes snapshots for a reason... :joy:

3 Likes

I was eyeing those, but the last snapshot is from yesterday, which is kinda old considering I've done a lot on the system since then. :sweat_smile: Thought better to ask if it's possible to just restore that one file instead.

Have you been adding a load of groups?

You can see how the files differ with e.g. diff :

$ sudo diff /etc/group /etc/group-
1c1
< root:x:0:brltty,root
---
> root:x:0:root
6c6
< tty:x:5:brltty
---
> tty:x:5:
14c14
< uucp:x:14:brltty
---
> uucp:x:14:
27c27
< audio:x:92:brltty,mpd
---
> audio:x:92:mpd
32c32
< input:x:97:brltty
---
> input:x:97:
84,85d83
< brlapi:x:971:brltty
< brltty:x:970:

No idea why there’s a difference, I guess I could look in the Arch wiki. :man_shrugging:

On mine, I could probably just copy group- over to group and things would work. No idea what your situation looks like, though. You probably want to compare your group- to group from a snapshot.

Here is the output for sudo diff /etc/group /etc/group-:

0a1,84
> root:x:0:brltty,root
> sys:x:3:bin,miikka
> mem:x:8:
> ftp:x:11:
> mail:x:12:
> log:x:19:
> smmsp:x:25:
> proc:x:26:polkitd
> games:x:50:
> lock:x:54:
> network:x:90:miikka
> floppy:x:94:
> scanner:x:96:miikka,guest
> power:x:98:miikka
> adm:x:999:daemon
> wheel:*:998:transmission,sonarr,radarr,plex,miikka,lidarr
> kmem:x:997:
> tty:x:5:brltty
> utmp:x:996:
> audio:x:995:brltty
> disk:x:994:
> input:x:993:brltty,miikka,evdev
> kvm:*:992:miikka,guest
> lp:x:991:cups,miikka,guest
> optical:x:990:
> render:x:989:
> storage:x:988:
> uucp:x:987:brltty
> video:x:986:sddm,miikka
> users:x:985:
> systemd-journal:x:984:
> rfkill:x:983:
> bin:x:1:daemon
> daemon:x:2:bin
> http:x:33:
> nobody:x:65534:
> dbus:x:81:
> systemd-journal-remote:x:982:
> systemd-network:x:981:
> systemd-resolve:x:980:
> systemd-timesync:x:979:
> systemd-coredump:x:978:
> uuidd:x:68:
> locate:x:21:
> avahi:x:977:
> git:x:976:
> polkitd:x:102:
> rpc:x:32:
> tss:x:975:
> realtime:x:974:miikka
> sambashare:x:973:miikka
> cups:x:972:miikka
> prelockd:x:971:
> memavaild:x:970:
> plugdev:x:969:miikka
> adbusers:x:968:
> brlapi:x:967:brltty
> ntp:x:87:
> named:x:40:
> colord:x:966:
> dnsmasq:x:965:
> geoclue:x:964:
> nm-openconnect:x:963:
> nm-openvpn:x:962:
> ldap:x:439:
> openvpn:x:961:
> rtkit:x:133:
> sddm:x:960:
> stunnel:x:16:
> usbmux:x:140:
> autologin:x:1000:miikka
> miikka:*:1001:transmission,sonarr,radarr,plex,miikka,lidarr
> nvidia-persistenced:x:143:
> guest:x:1002:
> libvirt:x:959:miikka,guest
> brltty:x:958:
> saned:x:957:
> transmission:*:169:transmission,sonarr,radarr,plex,miikka,lidarr
> plex:*:956:transmission,sonarr,radarr,plex,miikka,lidarr
> sonarr:x:955:
> radarr:*:954:transmission,radarr,plex,miikka
> lidarr:*:953:transmission,miikka,lidarr
> jackett:x:952:
> evdev:x:951:

I'm not sure what I should be looking at.

You deleted your /etc/group so it's saying that the entire contents of /etc/group- is different.

If you don't want to think about this just copy the file across. If it doesn't work you can restore the working snapshot, or use a live installer environment to fix the install later.

5 Likes

OK, I'll try this, fingers crossed. Thanks for the help so far.

1 Like

This worked. I think I'll create a snapshot now, before I break anything else. :joy:

2 Likes

You have been trying hard to destroy your system.
I am very sure you are going to break it very soon, if you treat your system with this type of irresponsibility.
If you or others wonder why I am so sure, check the wheel group.

3 Likes

What's wrong with wheel?

My system has been running fine now since I recovered the groups from groups- file. Even got my virtual machine to work with GPU passthrough. It feels super snappy compared to my old one on Endeavour.

1 Like

That’s great, but is not proof that all are fine.
Don’t listen to me, I am just a lunatic, just escaped from the asylum. :crazy_face:

6 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.