Change the power mode without sudo

Hello,

Background: I’ve accidentally removed sudo access from all users on my xavier nx. I do not have physical access to the board so I am unable to fix this via recovery mode. I can do just about everything I need to do on the board without sudo, except changing the power mode using nvpmodel.

Question: Is there any way to change the power mode without sudo?

Thanks,
John

try this
/sbin/nvpmodel -m 2 # 2 or your any power mode

On my system (Jetpack 4.6) nvpmodel is located at:
/usr/sbin/nvpmodel

When I attempt to run this without sudo I get a whole list of ‘Error opening…’ and ‘failed to write’ errors

Hi jr.b,

Are you using the devkit or custom board for Xavier NX?

Please share the result of the following command on your board.

$ cat /etc/nv_tegra_release

How did you do this on your board?

Could you run sudo su on your board at this moment?

Hi Kevin,

Thanks for the reply. Here is the output:

# R32 (release), REVISION: 6.1, GCID: 27863751, BOARD: t186ref, EABI: aarch64, DATE: Mon Jul 26 19:36:31 UTC 2021

I tried to add a group tag, using usermod -G (leaving off the -a), which stripped my admin user of the sudo group tag. I didn’t notice the omission and have since rebooted, which in further desktop testing seems to be what applies the changes.

I cannot run sudo anything, once I enter my password I get:

Sorry, user admin is not allow to execute ‘/bin/su’ as root on field-unit.

Sorry, and I forgot to mention that I am using the devkit

I could not reproduce this behavior on the devkit.
Could you share the full command you run to strip your permission?

Could you check if the following command work for your case?

$ sudo usermod -aG sudo <your_username>

Sure:

sudo usermod -G newgrp <your_username>
sudo reboot

… new boot …

sudo /usr/sbin/nvpmodel -m 2
Sorry, user <your_username> is not allowed to execute ‘/usr/sbin/nvpmodel’ as root on .

I cannot run any commmands with sudo, so “sudo usermod” will not work.

Is there any other way to change the power mode?

It seems you would need sudo permission to configure the power mode.

Are you using Xavier NX devkit with SD module?
If so, could you put the SD card to the host and try to access /etc/sudoers?
It seems it is a remote device so that you need someone helping you to do this…

I am using the emmc module.

Unfortunately it is not possible to access the unit. Is there any way without sudo to change which cpu cores are active? I cannot edit /boot/extlinux/extlinux.conf without sudo

We would suggest you could re-flash the board to fix the permission issue since there’re many operations need the sudo permission.

To configure the CPU cores, you would need to modify the nvpmodel.conf.
Could you access the desktop GUI of your board? Maybe you could configure different power mode through GUI (upper right corner of your desktop).

This is incorrect:
sudo usermod -G newgrp <your_username>

What that does is to replace your group with that. You also need the “-a” option to append. This would append the new group instead of replacing with it:
sudo usermod -aG newgrp <your_username>

Ok, so just to be sure, there is no way to change the power mode or the active cpu cores without sudo?

I do not have the desktop enabled on the unit.

I am painfully aware of this now, since the typo is how I lost sudo access

I won’t guarantee it, and this is a security risk, but you might make this work by setting the file to suid root. I say “might” because that command embeds other commands within it. One description of this:
https://www.cbtnuggets.com/blog/technology/system-admin/linux-file-permissions-understanding-setuid-setgid-and-the-sticky-bit

Something which comments on this as a security risk:
https://securiumsolutions.com/privilege-escalation-with-suid-in-linux/

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