Flashed TX2 and sudo failed

Following this instruction page

[url]http://docs.nvidia.com/jetpack-l4t/index.html#developertools/mobile/jetpack/l4t/3.0/jetpack_l4t_install.htm[/url]

I flashed TX2 successfully, but when I try to use sudo, it gives:
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

Should I simply flash again with these steps:

[url]https://devtalk.nvidia.com/default/topic/1012364/jetson-tx2/how-to-flashing-jetson-tx2-and-setup-network-correctly-/[/url]

Or is there something wrong using [url]https://developer.nvidia.com/embedded/downloads?#?dn=jetpack-for-l4t-3-0[/url]

Assuming you flashed on command lineā€¦

When preparing for flash you must use sudo in any unpack of the sample rootfs. You must also use sudo in the apply_binaries.sh step. Additionally, the file system on the host where system images are generated must be a native Linux typeā€¦VFAT and NTFS are guaranteed to fail (see ā€œdf -H -Tā€ to view file system types and free space).

Hi S3,

Please check your ā€œsudoā€ permission.

chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo

Let us know your update. Thanks!

Thank you linuxdev and carolyuu.

I did use sudo on the second step in this instruction:
[url]http://docs.nvidia.com/jetpack-l4t/index.html#developertools/mobile/jetpack/l4t/3.0/jetpack_l4t_install.htm[/url]
with
sudo ./JetPack-L4T-3.0-linux-x64.run
The host PC is native Linux, running Ubuntu 16.04.2 LTS

carolyuu, checking ā€œsudoā€ permission gives this message:
chown: changing ownership of ā€˜/usr/bin/sudoā€™: Operation not permitted
I am not sure how (if I can) switch to a root user?

Thanks,
S3

On your Linux_for_Tegra directory of the host there will be subdirectory ā€œrootfs/usr/bin/ā€. Use ā€œls -lā€ of sudo and see what the original sudo permissions were prior to flash. If this is not ā€œ-rwsr-xr-x. 1 root rootā€ then this was a cause.

In most variants of Linux, thereā€™s some way to intercept the boot loader, and boot in ā€œsingleā€ mode. (Typically, by adding the word ā€œsingleā€ to the kernel command line.)
Once you do, you will be placed in a text-mode shell with root privileges.
There, you should be able to change the permissions back for the sudo binary.

Some of systemd does not function correctly on L4T, e.g., multi-user.target cannot be achieved via ā€œsudo systemctl isolate multi-user.targetā€. Iā€™m not sure how one would reach single user mode on L4T even if desktop Ubuntu can do this (and since root account is locked on desktop Ubuntu and I donā€™t have a desktop Ubuntu Iā€™m not even sure how that works).

Butā€¦if sudo has the wrong permissions, then the cause was likely due to how the file system was unpacked and updatedā€¦in this case there will be many files which are incorrect and sudo will only be the tip of the iceberg. It is extremely probable that fixing this one issue will only lead to finding out that manually fixing permissions is extremely difficult.

Wow.
Such terrible.
Very sad.

OP already said they fat-fingered that one, and accidentally dropped permissions on sudo.
(That one, and accidentally screwing up the syntax of /etc/sudoers, are the classic burns UNIX sysadmins must experience at least once to become experienced!)
However, I would expect a new flash from a new download/install/build of Jetpack to recover everything correctly.

linuxdev,
According to your point, I checked the original permissions using ā€œls -lā€, they are ā€œ-rwxrwxrwx 1 root rootā€. Is this the problem?
I also tried this [url]https://devtalk.nvidia.com/default/topic/1012364/jetson-tx2/how-to-flashing-jetson-tx2-and-setup-network-correctly-/[/url] and properly unpacked them, but still get the same problem.

Any suggestions?

Thanks!

That is a problem. It means the sample rootfs was likely not unpacked by root (only root can preserve sudo permissions). There are many other files which would also have failed, you just found the first thing most people run into when sample rootfs is unpacked incorrectly (similar issues with not using sudo during apply_binaries.sh). On JetPack you should use your regular user, and then it prompts for passwordā€¦but with command line you just have to use sudo directly for rootfs and apply_binaries.sh.

If you fix just one permission there will probably be hundreds of other issues youā€™ll find over timeā€¦flashing again is probably required. Delete the rootfs directory content, unpack again with sudo, and apply_binaries.sh with sudo. Flash should then work. The other parts of the installation software do not require sudo.

Extra note: Make sure you are not using a non-Linux file system type, e.g., if you use a thumb drive you have to reformat before using itā€¦VFAT and NTFS wonā€™t work, ext4 does. Check with ā€œdf -H -Tā€.

Another option is that the file system youā€™re unpacking on has the ā€œnosuidā€ option set.

If itā€™s a default EXT4 file system/disk local to the host, this is less likely, but if you use some kind of virtual shared drive, external disk, or NFS mount, itā€™s possible that this bit is set and is getting in the way.

1 Like