How to flashing Jetson TX2 and setup network correctly?

Just got my Nvidia Jetson TX2 today, and mess up the file system.
So I decided to flashing TX2 by the following instruction

  1. Download "L4T Sample Root File System "
    http://developer.nvidia.com/embedded/dlc/l4t-sample-root-filesystem-27-1

  2. Download "L4T Jetson TX2 Driver Package "
    http://developer.nvidia.com/embedded/dlc/l4t-jetson-tx2-driver-package-27-1

  3. tar xpf Tegra186_Linux_R27.1.0_aarch64.tbz2

  4. cd Linux_for_Tegra/rootfs

  5. tar xpf …/…/Tegra_Linux_Sample-Root-Filesystem_R27.1.0_aarch64.tbz2

  6. cd …

  7. sudo ./apply_binaries.sh

Connect TX2 to host pc by USB cable.

  1. sudo ./flash.sh jetson-tx2 mmcblk0p1

HERE COMES THE PROBLEM

After I logging in by username:“ubuntu” or “nvidia” and type “sudo”, it prompt:

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

This error stop me from restart my network by “sudo systemctl restart ifup@eth0”.

But the command ls -l /usr/bin/sudo gives
-rwsr-xr-x 1 ubuntu ubuntu 128480 May 4 2016 /usr/bin/sudo

which means the current user “ubuntu” is root user.

################
If I don’t type sudo: “systemctl restart ifup@eth0”

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart ‘ifup@eth0.service’.
Multiple identities can be used for authentication:

  1. , (ubuntu)
  2. , (nvidia)
    Choose identity to authenticate as (1-2): Failed to restart ifup@eth0.service: Connection timed out
    See system logs and ‘systemctl status ifup@eth0.service’ for details.

This step was incorrect and causes the issue:

5. tar xpf ../../Tegra_Linux_Sample-Root-Filesystem_R27.1.0_aarch64.tbz2

The tar command must use “sudo” (plus the destination must be a native Linux file system type, e.g., if using a windows VM on NTFS it would fail the same way). You’ll need to delete the rootfs content, use tar again to unpack sample rootfs (using sudo), sudo apply_binaries.sh, and then you can flash again.

Thanks @linuxdev it works.

So the correct steps to flashing TX2 will be:

  1. Download "L4T Sample Root File System http://developer.nvidia.com/embedded/dlc/l4t-sample-root-filesystem-27-1 "
  2. Download "Jetson TX2 Driver Package http://developer.nvidia.com/embedded/dlc/l4t-jetson-tx2-driver-package-27-1 "
sudo tar xpf Tegra186_Linux_R27.1.0_aarch64.tbz2
cd Linux_for_Tegra/rootfs
sudo tar xpf ../../Tegra_Linux_Sample-Root-Filesystem_R27.1.0_aarch64.tbz2
cd ..
. sudo ./apply_binaries.sh

#Connect TX2 to host pc by USB cable. Boot to recovery mode.

sudo ./flash.sh jetson-tx2 mmcblk0p1