As the title, I moved the /etc folder to /home under ubuntu 16.04 on TX2 by mistake. And now I can’t enter the ubuntu system. Also I can’t enter the command line, Ctrl+ Alt+ F1/F2/p are useless.
So how can I repair the system.
Can you SSH in and move it that way? Perhaps not, as /etc contains the startup scripts for the system services.
If traditional methods fail, you may need to backup the disk image to host PC, then mount the image on the host and perform the edits, then re-flash the edited image to your Jetson. Although given the state of your system, it is probably more reliable to backup your files from image and then re-flash with vanilla JetPack-L4T like duanbingnan suggested.
With the Jetson in recovery mode and the micro-B USB connected, the host will see the Jetson from:
lstx2='lsusb -d 0955:7c18'
Your host will need free space larger than the entire file system on the Jetson. From wherever you clone you can check via “df -H .” (the “.” is important).
You will get a “.img” file (I throw this away) and a “.img.raw” file (I keep this). You could do this:
sudo -s
mount -o loop backup.img.raw /mnt
cd /mnt/home
mv ./etc ../
cd -
umount /mnt
exit
Copy the edited raw file to the “bootloader/system.img” location (be careful with the original…although copies of a 30GB file can be difficult to keep around).
You might need to look at the exact size of your clone before restoring. I think normally the “-S” size parameter should be ignored during flash with the “-r” (“reuse image”) option, but my latest test actually required setting this to match the clone file size. My system was flashed originally with “-S 29318MiB”, so the exact file size from the clone is “29318 * 1024 * 1024 = 30742151168” bytes. I did a restore with a log file via:
After that I use “bzip -9” on my clone file in a separate location from the system.img file. Note that a flash using this full sized file takes much longer than the sparse original “.raw” file, but the sparse file can never be edited…the raw file is interchangeable and can be viewed or edited.
Yes, but the need to use a serial console may depend on the existing extlinux.conf…it depends on current setup. It wouldn’t hurt to try.
I sometimes copy a clone to the SD card for testing. Things will be simplified if you still have a “bootloader/system.img.raw” from a previous flash. Do you still have this in your “Linux_for_Tegra/bootloader/” directory?