Forgot Password

Hello, my name is Matthew, and I have a Jetson tx1 that I have forgotten the password to. I can login because I have auto login setup but I have no way of ssh-ing and installing software with terminal. I know that the password is 5 letters long and probably all lowercase. I am looking for an easy way of changing it without messing with the data on the robot. Can anyone help.

Without a password you can’t use sudo for attaining root permissions. Without this, you cannot change passwords or alter files which would change a password. In order to edit this without losing the system you must clone the root partition, loopback mount it on another Linux host, edit there, and then flash telling the software to “reuse” the image via the edited clone. This would put everything back on the system exactly as it was except for your edits.

For information on cloning see this (and keep in mind cloning takes a very long time and a lot of disk space):
http://elinux.org/Jetson/Cloning

Be very sure that once you have your clone and it is named as “bootloader/system.img” that you do not overwrite this if it is your only copy. These files are huge (15GB or so) so you may have a temptation to keep only one copy under the name the flash.sh software uses…the very first time you flash without the “-r” option you will overwrite this backup.

When you do flash with the “-r” option you will want to use the same version of L4T as the clone is from. Listings of L4T JetPack ersions are here (JetPack can download and run the driver package, I’m not certain how this works for “reusing” an image):
https://developer.nvidia.com/embedded/jetpack-archive

The historic TK1 L4T listings are:
https://developer.nvidia.com/linux-tegra-r215
https://developer.nvidia.com/linux-tegra-r214
https://developer.nvidia.com/linux-tegra-r213
https://developer.nvidia.com/linux-tegra-rel-21
https://developer.nvidia.com/linux-tegra-rel-19

The topic of which files to edit is a purely Linux (and specifically Ubuntu) topic, but generally speaking unless you’ve added other accounts you would probably back up the loopback mounted version of files by this name pattern:

ls /etc/*passwd*
ls /etc/*shadow*
ls /etc/*group*

…this list exceeds what you would probably need, but if you have made extensive changes then perhaps you would need all of these to restore. In a simple case perhaps you only need file “/etc/passwd”.

You can get the unmodified version from the sample rootfs which would have been added to “rootfs/etc/”. Simply copy the original passwd file over to the loopback mounted version via “sudo” on your host, then umount the loopback image, and flash with this image being reused. Everything will become what it was before, except this will have the original “ubuntu/ubuntu” name/password login.

I ended up just reflashing the jetson and now it works

I traced linuxdev’s all steps many times, however I cannot login as nvidia nor ubuntu.
(ofcource, I expected the password nvidia for nvidia, ubuntu for ubuntu)

Is there another way to reload the passwords to the initial state?
Not same as mdsflyboy, reflashing tx2 cause no change…

Could anybody help me and my TX2?

During flash, if you fail to use sudo during unpack of the sample rootfs this may also occur. If you use JetPack it’ll ask for your password…this is why…if you use command line, then you must manually remember to use sudo for:

  1. Unpack sample rootfs.
  2. Apply_binaries.sh.
  3. Actual flash.

Was this flashed via JetPack or via command line?

The other thing to know is that if the file system type the flash runs from is not a native Linux type you will always get a similar problem. An example is that if you use an external USB drive formatted with a Windows style partition (type NTFS); another example is that SD cards are normally formatted type VFAT…if you flashed from one of these without first reformatting it you won’t have correct permissions and parts of the system will fail. Some VMs try to use the host’s underlying file system…these too will always fail.

This is true regardless of whether it is a TK1, TX1, or TX2. This reply should be in the TX2 forum, but in this case it doesn’t matter because those details are the same. What will differ are some of the details of creating a clone and which software driver and sample rootfs you use (JetPack is a front end and can download for any of these).

You might want to start a new thread in the TX2 forum and start with exact details of which software you used to flash (such as using JetPack3.1, command line, so on):
https://devtalk.nvidia.com/default/board/188/jetson-tx2/

Thank you for your comment, linuxdev. I was all day out, and back now…

My TX2’s history was more complex than I wrote.

step1. I installed JetPack3.1 -> completed
step2. I wrote program using cv::VideoCapture(), cv::cvtColor() and cv::imshow() -> compiled, worked well.
step3. I installed OpenCV3.3.0 -> completed
step4. program above became not compiled
step5. I gave up OpenCV3.3.0 and decide reflash TX2 (hoping back to ocv2.4.13)
step6. reflashing stopped because apt-get mismatch, then I stop flashing by ^C

After steps above, any retry ended up in vain…

I tried for example,
sudo ./flash.sh -r -k APP -G system.img jetson-tx2 mmcblk0p1 sudo mount -o loop system.img.raw /mnt/loop
sudo cp rootfs/etc/passwd /mnt/loop/etc/passwd sudo umount /mnt/loop
$ sudo ./flash.sh -r jetson-tx2 mmcblk0p1

or in above example, I changed a line in /mnt/loop/etc/passwd

nvidia:x:1001:1001:,:/home/nvidia:/bin/bash
to
nvidia::1001:1001:,:/home/nvidia:/bin/bash (…removing x)

In this try, I got logged in with no passwd, but no sudo action, no passwd changing allowed.
I guess if anybody give me a /etc/shadow, it might be a help. (putting it into /mnt/loop/etc/shadow)

I assume you placed a copy of your edited clone into the “bootloader/” subdirectory with name “system.img” prior to flash.

The copy from the sample rootfs’ “etc/passwd” would have been correct, but another copy would have been required in addition to this of the “etc/shadow” file as well. The two files work together as a pair where “passwd” is publicly visible, but only user root can see “shadow”. The version in “passwd” does not contain the actual hashed password…the version in “shadow” with the long line of “nonsense” characters contains the actual password in a one-way hash. It is this hashed content with nonsense characters which would restore the nvidia user to password “nvidia”, or the ubuntu password to “ubuntu”.

Make sure you’ve copied the “rootfs/etc/passwd” and “rootfs/etc/shadow” files both into the clone, copied the clone to “bootloader/system.img”, and then flash again with the “-r” version of the flash command. You’ll probably find it works after this.

Incidentally, there is one related file to check permissions on. This is the actual “sudo” executable. Normally this would be the “rootfs/usr/bin/sudo” file when flashing from the rootfs, but if you had your clone mounted by loopback on “/mnt”, then it would be “/mnt/usr/bin/sudo”. Permissions on this, determined via “ls -l /whereever/usr/sbin”, would show as:

-rw<b>s</b>r-xr-x. 1 root root 111784 May 29  2017 sudo

…that “s” character is the SUID bit and is extremely important. If that is missing then there are probably bigger issues to worry about.

linuxdev, thank you for your reply.

Make sure you’ve copied the “rootfs/etc/passwd” and “rootfs/etc/shadow” files both into the clone, copied the clone to “bootloader/system.img”, and then flash again with the “-r” version of the flash command. You’ll probably find it works after this.

Yeah, I think so too, but I could not find a shadow file in rootfs/etc directory.

BTW, I got another TX2 today, this is a virgin (not yet installed any)
I’ll try generating /etc/shadow by pwconv on the new one, coping it to bootloader/system.img, flashing the old one.

I’ll report you later.
Thank you.

If there was no shadow file I’d consider two possibilities:

  1. Your host didn’t have the disk space somewhere and it never made it into the sample rootfs unpack because of this.
  2. You didn’t use sudo during unpack of sample rootfs. If you used JetPack this wouldn’t be an issue, but sometimes people forget sudo in manual command line flash.

I retried things from very first step… following “NVIDIA TEGRA LINUX DRIVER PACKAGE QUICK START GUIDE”.
All things went well.

I didn’t recognize the difference between “flashing OS directly” and “flashing OS as a step in Jetpack”.

Thank you.

The difference is that JetPack downloads driver package plus sample rootfs automatically and unpacks the sample rootfs, then runs the apply_binaries.sh step for you…and asks for root password when needed. The end result is the same regardless of manually flashing or using JetPack (this assumes you are not installing extra packages…this is where JetPack adds functionality).