HELP! I accidentally changed usergroup out of root and now I can't sudo

Just as the topic, When I was installing something, the tutorial let me to add my user to dialog group using this command:
sudo usermod -a -G dialout $ USER
After doing that an error came out and I found theres no “-a” in showed options so I deleted “-a” and did the command succesfully.
After a reboot,I found I can’t login anymore and I cannot use sudo command in CUI neither.
I finally realized this must be a permission problem and the delete of option “-a” caused this usergroup replacement.

I really don’t want to reflash it. Rebuilding work space is so annoying…If there’s someway to enter grub revovery mode…It will be very helpful if someone can give me some advice! Thank you!

Yeah. Without -a it removes all other groups except the one you specify. The command is not my favorite either. It may be easiest to backup and reflash. You can probably still ssh in to backup your files. I’d recommend WinSCP if you use Windows or the file explorer in Gnome if you prefer Linux. Don’t hesitate to ask if you need help with the ssh settings.

Edit: There is no grub or single user / recover mode on Tegra. The best you can do is backup your stuff using ssh or with, I think.

Thank you for your quick response! I guess flash is the only way then…now I learned a big lesson: always check meanings before do any sudo command…

1 Like

That is very good advice :)

Please ask if you have any trouble recovering your files.

Don’t forget that you can clone first, and perhaps edit the clone, then flash the clone (takes a long time and lots of disk space, but can save grief).

Thank you. In fact there’s not so many files than I thought so that wasn’t a big problem. Now I have re-flashed it with the newest jetpack. Rebuilding workspace is very annoying but the biggest problem is that I found I can’t use xrdp any more. (forced shutdown while login) Same issue also happened to my jetson TX2 too. I checked xrdp log files and followed the instruction of add xrdp user to ssl-c**something to get rid of error. Now there’s no error message but nothing get better. I know this problem is nothing with this topic but do you have any suggestions of any xrdp solutions?
P.S. I’m not sure but I think my Xavier get more lag compare to before. Maybe the newest jetpack caused this?

Thank you for reply. Never think of that before. Will the clone have all packages and user settings? Xrdp not working anymore after a re-flash with the newest jetpack now. Maybe making a clone after I rebuilt workspace and fixed the xrdp will be a good option to prevent next crash?

Sorry. I don’t use xrdp. If I have to run a simple graphical app remotely, I use ssh -X

If I need to develop remotely, I use the ssh capabilities of vscode.

If I need to stream video remotely, I send just the encoded streams with GStreamer.

I haven’t had a use for streaming the whole desktop as I’m not aware of any solution that uses the hardware encoders and doing it all in software slows things down too much. Some other people might have better suggestions.

If you flash using a clone, then you get the full install including any package updates, customization, so on.

I see that. The reason I wanna use a remote desktop is my jetson is attadched on a drone so it will be convenient if I can control it remotely with a whole desktop. I will try ssh command if I can’t fix the ssh problem. Thank you again.

I’m sorry if this is stupid but I just wonder would a clone includes user group settings? If I clone after I kicked my self out of root group this wrong setting will not be cloned right?

You are correct that the clone will include those user/group settings. However, keep in mind that the PC is its own Linux operating system…this serves as a rescue system with chroot. The difference is that you are working on the chroot on the PC’s disk and not on the Jetson’s eMMC, but then copying it back to the Jetson after fixing it. This method of rescue includes a backup in case things go wrong.

So you mean I can edit the clone in my main PC and flash with it after fixing, right? That sounds intresting. Would try it next time I did another mistake. Thank you!

Yes, you can edit a clone. The trick is that a clone provides two files, the first of which is a “sparse” file with filename extension “.img”. The second file is the “raw” image, with a “.img.raw” filename extension. I throw away the sparse “.img” and only keep the larger (huge size) “.img.raw” clone.

Sparse files can be flashed, but cannot be edited or examined (open source sparse tools do not work on this). The raw image is the bit-for-bit exact copy of the entire root filesystem, and thus it can be loopback mounted as if it were a real hard disk. Then you can examine files and edit files. Provided you know what to edit this implies you can fix anything from the host PC, and then flash the modified clone back on. I recommend working on a copy of the raw clone, but do keep in mind a single file copy takes a lot of time (the file is around 30GB in size…it could take you an hour to copy that once, and it consumes a lot of disk space).

A loopback mounted clone can also be used for the user space libraries in cross compiles. Plus a clone is a great backup mechanism; when loopback mounted on a host it can be updated via rsync from the Jetson if you like rsync backups.