Sorry, user nvidia is not allowed to execute as root on ubuntu

I have a problem executing commands with sudo after attempting to modify the /etc/sudoers file. I can 't access it anymore but it looks like that:

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root    ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
sudo   ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d

Running any commands with sudo, first it asks me for a password and then it says
Sorry, user nvidia is not allowed to execute as root on ubuntu.

Any solution to that without flashing?

How about create new user.

I tried that and when I run a command with sudo it says
nvidia2 is not in the sudoers file. This incident will be reported.

Don’t know what happen to your system.
I just verify by using nvidia as user without problem.

Did you use visudo (or sudoedit) to change this file? It is the only allowed method of doing this. Security is rather tight on that file, and if you modified it in any other way, then most likely sudo will be disabled (perhaps even for all users if there had been more than one admin user on the system).

If you did edit this such that sudo is disabled, and you have no other root access, then you likely can clone, maybe fix the clone using some of the original content in “Linux_for_Tegra/rootfs/” (after adding your user with “sudo ./apply_binaries.sh” first), and then flashing again. If that is what you want to do, then be sure to mention your exact release and if this is the dev kit versus a third party carrier board.

Yes I did modify it using sudoedit.
I was trying to avoid flashing the Jetson, especially for the reason that I can’t flash it using my personal computer with Ubuntu 22. I think the easiet way is to flash it, I don’t really need to save what is already on it.

So something in the setup for sudoers must be failing. I don’t think you can get away without flashing, but you can clone first, fix the clone, and then flash with the fixed clone (takes a lot of time and disk space…the clones are huge).

Regarding the host PC, the “driver package” is what actually performs the flash. JetPack is the GUI front end, SDK Manager is the smart network part of JetPack. It is JetPack/SDKM which won’t run on an Ubuntu 22 host PC…at least not in combination with that particular release of driver package (the Drive software…which is quite different automobile software…can run on Ubuntu 22, but it uses a different driver package). The GUI is why you cannot use Ubuntu 22 with the TX2. In fact, you should downgrade to Ubuntu 18 for that combination.

If you were to flash on command line only (which means manually downloading and setting things up), then you could probably flash your TX2 with an Ubuntu 22 host PC. I don’t have Fedora anymore, but in the past I’ve flashed on command line from Fedora. The actual driver package does not check for requirements, and will gladly flash, although results are not always what you want. As an example, in the past when we were still using Ubuntu 16 and Ubuntu 18 came out, the defaults of mkfs.ext4 was slightly different between Ubuntu 16 and Ubuntu 18; the boot content for the TX2 was not yet adapted (at that time) for those newer defaults (related to 64-bit options), and would fail to boot, but the flash otherwise worked. One could still use the “too new” (back then) host PC if one were to manually adjust the default ext4 parameters.

So far as I know though, even Ubuntu 22 host PCs will work on command line for the more recent L4T R32.x (which is the maximum release version that a TX2 can use). You’d just have to do things manually. Unless you are an expert though I think you will find an Ubuntu 18 host PC is a lot less frustrating for TX2 work.

If you need information on command line flash, then just ask. You would need command line anyway to clone and repair the clone, followed by flashing such that you reuse the rootfs image.

1 Like

I’m trying to flash the jetson using commands line but I get an output saying Available on ubuntu18.04, ubuntu20.04

JETSON_TX2_TARGETS --flash all
No update is available.
Authenticating with NVIDIA server...
Login succeeded.
Loading user information...
User information loaded successfully.
Loading server data...
Server data loaded successfully.

 * Available on ubuntu18.04, ubuntu20.04. For available versions run sdkmanager --query.

From this command line suggested by the sdkmanager after asking some questions about the target machine, etc:

sdkmanager --cli install --logintype devzone --product Jetson --host --targetos Linux --version 5.1.2 --target

And when I run sdkmanager --query it confirms that I need ubuntu 20.04 or 18.04:

Authenticating with NVIDIA server...
Login succeeded.
Loading user information...
User information loaded successfully.
Loading server data...
Server data loaded successfully.
Available options are:

JetPack 5.1.2
sdkmanager --cli install --logintype devzone --product Jetson --version 5.1.2 --targetos Linux --host --target JETSON_AGX_XAVIER_TARGETS --flash all --additionalsdk 'DeepStream 6.3'
 * Available on host OS: ubuntu18.04, ubuntu20.04
sdkmanager --cli install --logintype devzone --product Jetson --version 5.1.2 --targetos Linux --host --target JETSON_XAVIER_NX_TARGETS --flash all --additionalsdk 'DeepStream 6.3'
 * Available on host OS: ubuntu18.04, ubuntu20.04
sdkmanager --cli install --logintype devzone --product Jetson --version 5.1.2 --targetos Linux --host --target JETSON_AGX_ORIN_TARGETS --flash all --additionalsdk 'DeepStream 6.3'
 * Available on host OS: ubuntu18.04, ubuntu20.04
sdkmanager --cli install --logintype devzone --product Jetson --version 5.1.2 --targetos Linux --host --target JETSON_ORIN_NX_TARGETS --flash all --additionalsdk 'DeepStream 6.3'
 * Available on host OS: ubuntu18.04, ubuntu20.04
sdkmanager --cli install --logintype devzone --product Jetson --version 5.1.2 --targetos Linux --host --target JETSON_ORIN_NANO_TARGETS --flash all --additionalsdk 'DeepStream 6.3'
 * Available on host OS: ubuntu18.04, ubuntu20.04

JetPack 5.1.1 (rev. 1)
sdkmanager --cli install --logintype devzone --product Jetson --version 5.1.1 --targetos Linux --host --target JETSON_AGX_XAVIER_TARGETS --flash all --additionalsdk 'DeepStream 6.2'
 * Available on host OS: ubuntu18.04, ubuntu20.04
sdkmanager --cli install --logintype devzone --product Jetson --version 5.1.1 --targetos Linux --host --target JETSON_XAVIER_NX_TARGETS --flash all --additionalsdk 'DeepStream 6.2'
 * Available on host OS: ubuntu18.04, ubuntu20.04
sdkmanager --cli install --logintype devzone --product Jetson --version 5.1.1 --targetos Linux --host --target JETSON_AGX_ORIN_TARGETS --flash all --additionalsdk 'DeepStream 6.2'
 * Available on host OS: ubuntu18.04, ubuntu20.04
sdkmanager --cli install --logintype devzone --product Jetson --version 5.1.1 --targetos Linux --host --target JETSON_ORIN_NX_TARGETS --flash all --additionalsdk 'DeepStream 6.2'
 * Available on host OS: ubuntu18.04, ubuntu20.04
sdkmanager --cli install --logintype devzone --product Jetson --version 5.1.1 --targetos Linux --host --target JETSON_ORIN_NANO_TARGETS --flash all --additionalsdk 'DeepStream 6.2'
 * Available on host OS: ubuntu18.04, ubuntu20.04

JetPack 5.1 (rev. 1)
sdkmanager --cli install --logintype devzone --product Jetson --version 5.1 --targetos Linux --host --target JETSON_AGX_XAVIER_TARGETS --flash all --additionalsdk 'DeepStream 6.2'
 * Available on host OS: ubuntu18.04, ubuntu20.04
sdkmanager --cli install --logintype devzone --product Jetson --version 5.1 --targetos Linux --host --target JETSON_XAVIER_NX_TARGETS --flash all --additionalsdk 'DeepStream 6.2'
 * Available on host OS: ubuntu18.04, ubuntu20.04
sdkmanager --cli install --logintype devzone --product Jetson --version 5.1 --targetos Linux --host --target JETSON_AGX_ORIN_TARGETS --flash all --additionalsdk 'DeepStream 6.2'
 * Available on host OS: ubuntu18.04, ubuntu20.04

JetPack 5.0.2 (rev. 2)
sdkmanager --cli install --logintype devzone --product Jetson --version 5.0.2 --targetos Linux --host --target JETSON_AGX_XAVIER_TARGETS --flash all --additionalsdk 'DeepStream 6.1.1'
 * Available on host OS: ubuntu18.04, ubuntu20.04
sdkmanager --cli install --logintype devzone --product Jetson --version 5.0.2 --targetos Linux --host --target JETSON_XAVIER_NX_TARGETS --flash all --additionalsdk 'DeepStream 6.1.1'
 * Available on host OS: ubuntu18.04, ubuntu20.04
sdkmanager --cli install --logintype devzone --product Jetson --version 5.0.2 --targetos Linux --host --target JETSON_AGX_ORIN_TARGETS --flash all --additionalsdk 'DeepStream 6.1.1'
 * Available on host OS: ubuntu18.04, ubuntu20.04

JetPack 5.0.2 Runtime (rev. 2)
sdkmanager --cli install --logintype devzone --product Jetson --version Runtime_5.0.2 --targetos Linux --host --target JETSON_AGX_XAVIER_TARGETS --flash all
 * Available on host OS: ubuntu18.04, ubuntu20.04
sdkmanager --cli install --logintype devzone --product Jetson --version Runtime_5.0.2 --targetos Linux --host --target JETSON_XAVIER_NX_TARGETS --flash all
 * Available on host OS: ubuntu18.04, ubuntu20.04
sdkmanager --cli install --logintype devzone --product Jetson --version Runtime_5.0.2 --targetos Linux --host --target JETSON_AGX_ORIN_TARGETS --flash all
 * Available on host OS: ubuntu18.04, ubuntu20.04

JetPack 4.6.4
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.4 --targetos Linux --host --target JETSON_AGX_XAVIER_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.4 --targetos Linux --host --target JETSON_XAVIER_NX_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.4 --targetos Linux --host --target JETSON_TX2_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.4 --targetos Linux --host --target JETSON_TX1_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.4 --targetos Linux --host --target JETSON_NANO_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04

JetPack 4.6.3
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.3 --targetos Linux --host --target JETSON_AGX_XAVIER_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.3 --targetos Linux --host --target JETSON_XAVIER_NX_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.3 --targetos Linux --host --target JETSON_TX2_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.3 --targetos Linux --host --target JETSON_TX1_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.3 --targetos Linux --host --target JETSON_NANO_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04

JetPack 4.6.2
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.2 --targetos Linux --host --target JETSON_AGX_XAVIER_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.2 --targetos Linux --host --target JETSON_XAVIER_NX_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.2 --targetos Linux --host --target JETSON_TX2_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.2 --targetos Linux --host --target JETSON_TX1_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04
sdkmanager --cli install --logintype devzone --product Jetson --version 4.6.2 --targetos Linux --host --target JETSON_NANO_TARGETS --flash all --additionalsdk 'DeepStream 6.0.1'
 * Available on host OS: ubuntu16.04, ubuntu18.04


Query completed.

Create a USB bootable drive and boot the jetson and mount your emmc partition and do the corrections

1 Like

To manually flash you would need to manually install some content on the host PC without the use of sdkmanager. It would perhaps be easier to install Ubuntu 18, although that also might not be practical for many cases (if you can, consider adding another disk to the PC and installing Ubuntu 18 to that for multi-boot)

However, if you do wish to flash on command line, this implies:

  • Downloading the “driver package” and “sample rootfs” for your exact L4T release (L4T is what actually gets flashed, which is Ubuntu plus NVIDIA drivers, and JetPack/SDKM are front end utilities used to perform the flash through the “driver package”).
  • Unpacking the driver package as a regular user.
  • Unpacking the sample rootfs in the new “Linux_for_Tegra/rootfs/” which was created by unpacking the driver package, using root authority (using “sudo”).
  • Adding the drivers to that content via “sudo ./apply_binaries.sh” from the “Linux_for_Tegra/” directory.
  • Optionally, and recommended for your case, running “sudo ./tools/l4t_create_default_user.sh” to pre-create the first boot login. You would use the exact account name which is supposed work on your current install. This would give you the files you need to repair the original.
  • At this point you could:
    • Flash and recreate with your account repaired, but it would lose existing customization.
    • Clone the original rootfs, and use the content of the now updated “Linux_for_Tegra/rootfs/” to perhaps repair sudo; then flash using the repaired clone.
  • Important: You must use the same L4T release that is on the existing rootfs if you wish to repair.
  • The list of L4T releases is at here.
  • Normally SDKM will do this for you, but your host PC release does not allow it in this combination.

One would clone on command line, and if this is an ordinary TX2 dev kit, the clone would be with the Jetson in recovery mode, and go something like this:sudo ./flash.sh
sudo ./flash.sh -r -k APP -G my_backup.img jetson-tx2 mmcblk0p1

This would produce a “raw” image, “my_backup.img.raw”, plus it would produce a “sparse” image, “my_backup.img”. Both of these are very large files, but the “raw” image is the exact byte size of the partition, and the “sparse” image is around the size of the content actually stored (as the partition fills the sparse size approaches the raw size; in that case you’d get two files which are each the size of the partition).

If your partition is 14 GB, and if the content you have is 8 GB, then this alone will produce 22 GB on the host PC.

Both can be used to flash, but the smaller sparse image is faster. Unfortunately, you cannot use loopback with a sparse image. I personally delete the sparse image. Just a copy of the raw image can take an hour to move from one location to another if it is on different media, and you might want to have a pristine copy plus a working copy until you know it is going to work. If you get one that works, then you could save it as backup, and maybe compress it with “bzip2 -9” (which can itself take a couple of hours to complete on large files).

If your raw file is “my_backup.img.raw”, then you could cover it with loopback like this:
sudo losetup --show ./my_backup.img.raw
(assumes you are in the directory containing your working copy of my_backup.img.raw)

If it turns out that the name of the loop device is “/dev/loop0” (it might have a different number), then you could mount it like this on the host PC’s “/mnt” directory (any empty directory works):
sudo mount -o loop /dev/loop0 /mnt

Alternately, you can mount directly and tell the mount command to create the loop device:
sudo mount -o loop ./my_backup.img.raw /mnt

You can always monitor “dmesg --follow” on the host PC and regardless of whether you use “losetup” or “mount -o loop” it would tell you the loop device name that was created. There are a limited number of loopback devices available, so you can detached a loop device, or detach all non-busy loop devices. Example, when done with the work:
sudo losetup -D
(see “man losetup”)
sudo ./flash.sh
From there, wherever you mounted the loopback, e.g., assuming “/mnt”, you can see and access your entire rootfs in “/mnt”. Example: “cd /mnt; ls`”.

Now if you know what files were altered on the Jetson, and if you have the correctly set up sample rootfs which has added your user, then the “/mnt/etc/sudoers” (or other related files) should be the original you started with. If you preserve permissions correctly (remember that this is a special kind of file), then you can probably copy it to the loopback mounted clone to fix the previous error.

Then you could flash again while reusing that corrected clone.

If you were to “just flash”, without the clone, it would go like this:
sudo ./flash.sh jetson-tx2 mmcblk0p1

To instead flash reusing the existing image (which you must set up to be the unmounted corrected clone);
sudo ./flash.sh -R jetson-tx2 mmcblk0p1

Any binary image which is placed at “Linux_for_Tegra/bootloader/”, *and renamed to “system.img” will be flashed. If you flash “normally”, then a default “bootloader/system.img” is created before the flash. The “-R” argument says to not overwrite the system.img.

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