Imagine my surprise when I could not sudo! Wait, what?
First the back story: I had to reboot my linux notebook this morning because it had locked up. I went back to Ubuntu for a working desktop linux machine because I was having trouble with Debian and a second monitor and I was in a hurry. It would lock up once in a few weeks on Debian, but it locked up three times yesterday. Anyway, went to check if this time maybe it logged something and suddenly my terminal tells me that I am not in the sudoers file. Wait. What? How can that be?
First clue was that I did “id” and found that I was really only in one group (video). I knew for a fact that could not be right. So that was causing it (no membership in the sudo group) but how? To find that out I needed to get my root priveledges back.
New Ubuntu boot screens are for the masses, not for geeks, so they took out the GRUB menu. You need to press “shift” during boot to get that to pop up. In GRUB you can select to boot in recovery mode, and then drop to a root shell, and then remount with
mount -o remount,rw /
And then edit the /etc/group file. Reboot. OK, now I am back.
Was I Hacked?
I was actually afraid for a moment that I had been insidiously hacked. Nope. Just my own ignorance. I had shot myself in the foot with a command and it was not until a reboot that I found it. Because, after all, you only re-read your group memberships after you log out and back in (or reboot).
What Did I Do (Wrong)?
I had been playing with “v4l2-ctl” to adjust my camera settings in meetings. Works like a charm, and far more reliable than apps on the Mac. But to run it you need to be a member of the video group. So I had added myself to the video group but I didn’t really want to reboot, so I just did a quick command and then “sudo - gherlein” to reload my session without logging out and back in. What was the command?
usermod -G gherlein video
Vanilla right? Easy. The experienced admins out there just winced. They spotted it right away. Me? Nope. Running too fast, not ninja-level on my SysAdmin commands anymore I guess. What I just told the system to do was to add me to the video group AND ONLY THAT GROUP. What I SHOULD have done was:
usermod -aG gherlein video
which does an APPEND that group, maintining all other memberships. One letter, and I managed to lock myself out of admin rights on my own computer.
Aside from “cargo cult programming” advice of making certain you know what every command does when you do it as root, the big lesson I am reminded of is that with Linux you can almost always fix it. You can boot back to a mode where with skills (and the sometimes help of a Google search) you can restore your computer to working. So don’t panic! Love Linux!
Back to the Freezing
Now that I had sudo rights again I could actually look at syslog. Nothing at all useful in the logs
Jun 17 21:18:10 alien dbus-daemon: [system] Successfully activated service 'org.freedesktop.nm_dispatcher ' Jun 17 21:18:10 alien systemd: Started Network Manager Script Dispatcher Service. Jun 17 21:18:20 alien systemd: NetworkManager-dispatcher.service: Deactivated successfully. Jun 18 05:15:44 alien systemd-modules-load: Inserted module 'lp' Jun 18 05:15:44 alien systemd-modules-load: Inserted module 'ppdev' Jun 18 05:15:44 alien systemd-modules-load: Inserted module 'parport_pc' Jun 18 05:15:44 alien systemd-modules-load: Inserted module 'msr' Jun 18 05:15:44 alien systemd-modules-load: Inserted module 'ipmi_devintf' Jun 18 05:15:44 alien systemd: Starting Flush Journal to Persistent Storage...
Smells like a hardware problem. Definitely happens more often now that I am using this same machine as a desktop. Ran the hardware tests and they came up clean, so it does not seem to be a RAM problem. I read that sometimes an SSD failure can manifest like this (but that seems weird) but really?
I’m betting it’s the GPU. Playing video in the browser seems to be the thing that I am doing now that I was not doing before, so I disabled hardware acceleration in Chrome. I also removed a lot of the Chrome extensions I had installed. If I did not remember using it, out. Chrome is easily the most demanding thing I run all the time so let’s unload things it does not need.
So I’ll let you know. I would really like to make this machine work as my working desktop. My new job (oops, not announcing that) shipped me a new MBP 16" M1 that should be a screamer, so I may end up using that mostly.
As I was editing that last paragraph my system froze again. And of course I had not saved my work. I was preparing to be pissed (and really disappointed) but in line with the theme above I did a quick search. Lo and behold, you can recover unsaved files from VS Code.. So gentle reader, you are reading this because someone smart made a way to keep work saved.
Of course, I still don’t know what’s causing my notebook to freeze up. More troubleshooting is needed. But there’s a farmers market to go to, flank steak to grill, and good friends to pour some bubbly for. Fixing this computer may just have to wait!
It locked up AGAIN but this time I saw the main LCD screen go nuts right before it froze. So it’s DEFINITELY something with the GPU. A bit of googling and found this that said to downgrade the NVidia drivers (and found …) AND IT LOCKED UP.
So I purged all Nvidia drivers and reinstalled. For the observant reader wondering why I am keeping a buggy proprietary driver, it’s because the external HDMI port is only supported using the Nvidia driver for some reason.
Still trying. But it’s getting more than annoying to have my working machine lock up every few minutes. It’s reminding me of the old days on Linux (and I don’t have time for that shit today).