I was trying to modify the /etc/group
file, and accidentally cleared its contents. Now, I can't even use sudo
anymore, and I don't know what else is broken. How can I fix this?
Asked
Active
Viewed 2,463 times
4

Hitechcomputergeek
- 1,163
- 2
- 11
- 18
1 Answers
4
Piecing together information from the Internet, I learned that the system apparently backs up some files, including /etc/group
, to /var/backups/[filename].bak
. Sure enough, I booted to a live USB, mounted my HD, cd'd to /media/ubuntu/[hard drive]
, and ran:
sudo cp var/backups/group.bak etc/group
Then, when I rebooted, my system was good to go. Additionally, you can also boot the system to a root shell. (I've seen how, but I can never quite remember how.) Then, once you've mounted your rootfs as rw and all that, you'd use:
cp /var/backups/group.bak /etc/group
Another option would be to check if /etc/group-
(note the dash) does exist. If it does you can inspect it and copy it back to /etc/group
.

Artur Meinild
- 26,018

Hitechcomputergeek
- 1,163
- 2
- 11
- 18
-
Why the hell does it want me to wait two days before I can accept my own answer? That's just stupid. – Hitechcomputergeek Oct 07 '15 at 03:47
-
It's an auto-mechanism set for all questions in case a 'better answer comes along'. A question must be open for a few day, I assume, unless closed my a moderator. – Dooley_labs Oct 07 '15 at 03:49
-
@Rinzwind How would accepting your own answer be abused? It's not like you get rep from your own answer or anything. – Hitechcomputergeek Oct 07 '15 at 14:57
-
This will explain it better: http://meta.stackexchange.com/questions/6044/why-must-i-wait-2-days-before-accepting-my-own-answer And here is the abuse I was talking about: http://meta.stackexchange.com/questions/6044/why-must-i-wait-2-days-before-accepting-my-own-answer#comment17369_9690 You indeed get no rep BUT you do attract upvotes for having accepted answers all over the place. – Rinzwind Oct 07 '15 at 15:08
-
@Rinzwind I see now, that makes sense. – Hitechcomputergeek Oct 08 '15 at 01:53