How to successfully update Jetson TK1 to Ubuntu 16.04

Hey Hey linuxdev long time no talk. I am at work and not connected to DISPLAY 0 so I will check glxinfo when I get home tonight. So far everything is running well.

Here is xorg log:

[    12.406] (II) LoadModule: "glx"
[    12.410] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[    12.719] (II) Module glx: vendor="NVIDIA Corporation"
[    12.719]    compiled for 4.0.2, module version = 1.0.0
[    12.719]    Module class: X.Org Server Extension
[    12.719] (II) NVIDIA GLX Module  21.5  Release Build  (integ_stage_rel)  (b6
[    12.719] Loading extension GLX
[    12.719] (II) LoadModule: "nvidia"
[    12.720] (II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
[    12.764] (II) Module nvidia: vendor="NVIDIA Corporation"
[    12.764]    compiled for 4.0.2, module version = 1.0.0
[    12.764]    Module class: X.Org Video Driver
[    12.789] (II) NVIDIA dlloader X Driver  21.5  Release Build  (integ_stage_r6
[    12.789] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs

Speaking of CUDA any idea if we are ever going to get an updated CUDA for TK1?

TK1 is only receiving maintenance releases. Unless it is a bug fix I wouldn’t expect anything (R21.7 just came out).

Hi @Linux4all, did Cuda worked with your method?

Yes cuda does work and installs fine through the latest TK1 Jetpack:

ubuntu@tegra-ubuntu:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2014 NVIDIA Corporation
Built on Tue_Feb_17_22:53:16_CST_2015
Cuda compilation tools, release 6.5, V6.5.45

Just installed using your method and everything seems to be working as expected! Thank you for this tutorial.

The CUDA examples at the ‘home’ folder did run OK.

I’m going to test more and report here any findings!

Now remember when compiling anything with nvcc you will have to use the older gcc 4.8 vs gcc 5 in 16.04.

sudo apt-get install gcc-4.8 g++-4.8 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8;

When completed, you must change to the gcc you want to work with by default. Type in your terminal:
sudo update-alternatives --config gcc

To verify if it worked. Just type in your terminal
gcc -v

I had to build opencv from sources and cuda 6.5 only supports gcc 4.8 (NVIDIA possible to update Cuda for TK1?)

After upgrade to Ubuntu 16.04 what happens to boot procedure?
Is it always based on upstart?

Boot procedure remains the same afaik. I have been running 16.04 and have had zero issue thus far. Only thing I am missing is TensorRT ;) (arm64 only atm).

NVIDIA much appreciation for the Sticky!

Thank you so much for this! Worked great for me.

You are most welcome thank you for the thank you!

I am now working on upgrading tk1 to kernel 4.19 and I have successfully gotten nouveau and mesa built with instructions from NVIDIA’s git here: https://github.com/NVIDIA/tegra-nouveau-rootfs

I can boot 16.04 with kernel 4.19 just by using those instructions and pushing the mesa build and kernel to tk1 and installing the patched mesa on current 16.04 and I do get a graphical desktop but I am still working out some bugs. I will post another how to for that very soon. My goal is to get 18.04 working with mesa but for now this 16.04 guide will suffice for almost all dev work needed on tk1.

Hi @Linux4all, thank you so much for this.

Could you share with us the procedure to update the kernel?

Sure ZEF let me get together a how-to later on today/tonight and I will link it at the bottom of the 1st post. There are some bugs like xorg/x11 freezes up so I am going to try no proprietary NVIDIA libs/drivers and use patched mesa and nouveau/drm alone this time around and see if I can work out the xorg issue before posting.

To make the procedure even easier I will link an APP image for flashing through nvflash :)

I followed this on my TK1 and things went mostly OK - except that the login screen (I do see it briefly) is almost immediately followed by a black screen where I can see nothing but my mouse cursor. (After a minute or two, I see a “Connection Established” for my ethernet, as well)

Any suggestions? Also, I’d love to find that kernel update procedure…

It’s very crucial that you issue this command BEFORE the dist-upgrade:

sudo apt-mark hold xserver-xorg-core

and after the upgrade installing gnome flashback should bring up the login screen after reboot.

sudo apt-get install gnome-session-flashback

You may have to reflash 14.04 and start the procedure again.

As for the 4.19 kernel I still have not gotten the bugs with X11 worked out enough. I will have some time this week to create the topic so others can help with the tweaks.

I followed the ordering you listed pretty closely, and definitely both help xserver-xorg-core and installed gnome-session-flashback after the reboot. The login screen comes up briefly, but is then overlaid with a black screen. I’ll probably mess around with this a bit, as I have another OS (NetBSD) installed on another partition of the internal flash that I’ll have to back up before re-flashing. If it comes to that, though, I’ll do it.

OK, cool - honestly, I hadn’t noticed how recently this was posted; I kind-of assumed it was months ago. ;) Thanks for the response!

These instructions DO NOT work!
They cause the device to freeze during the sudo do-release-upgrade because it takes too much resources. This was tried on a newly flashed device 3 times, every time failing.
Where can I find a ready ubuntu 16.04 image to flash on the device?

There is no officially supported 16.04 image. Support for the 32-bit platform “addition of features” ended (maintenance releases may exist). See:
https://devtalk.nvidia.com/default/topic/1029983/jetson-tk1/eol-for-nvidia-jetson-tk1-developer-kit/

L4T R21.7 was a maintenance release (Ubuntu 14.04) and not a feature release, and is an example of a release which occurred after feature addition ended. If there is another release this will be maintenance only, and will not support Ubuntu 16.04.

I’ve never tried to upgrade to 16.04. I don’t know if the resource which is running low is RAM or eMMC. If it is eMMC, then perhaps it was flashed without taking advantage of the maximum rootfs size. I do command line flashes like this to get the full eMMC used:

sudo ./flash.sh <u><b>-S 14580MiB</b></u> jetson-tk1 mmcblk0p1

The “14580MiB” is a raw partition size (times 1024^2), prior to overhead from formatting. However, if you run “df -H /” on the newly flashed TK1 (or even on one previously flashed), then you should see the partition size show as “Size” of “15G”. If you see less than “15G”, then probably you’ve used a default value which can be increased.

I would be surprised if the required resource which is failing is RAM, but if it is, then you might be able to add a swap partition on an SD card during the upgrade.

I managed to update a TK1 (DJI Manifold) to 16.04 following this procedure, but I have no power to my USB devices after the update.

lsusb is empty

Any ideas for follow-up steps?

Below is my grep of dmesg.

ubuntu@tegra-ubuntu:~$ dmesg | grep usb
[    0.000000] Kernel command line: console=ttyS0,115200n8 console=tty1 no_console_suspend=1 lp0_vec=2064@0xf46ff000 mem=2015M@2048M memtype=255 ddr_die=2048M@2048M section=256M pmuboard=0x0177:0x0000:0x02:0x43:0x00 tsec=32M@3913M otf_key=c75e5bb91eb3bd947560357b64422f85 usbcore.old_scheme_first=1 core_edp_mv=1150 core_edp_ma=4000 tegraid=40.1.1.0.0 debug_uartport=lsport,3 power_supply=Adapter audio_codec=rt5640 modem_id=0 android.kerneltype=normal fbcon=map:1 commchip_id=0 usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0 touch_id=0@0 board_info=0x0177:0x0000:0x02:0x43:0x00 root=/dev/mmcblk0p1 rw rootwait tegraboot=sdmmc gpt
[    0.531983] usbcore: registered new interface driver usbfs
[    0.532047] usbcore: registered new interface driver hub
[    0.532161] usbcore: registered new device driver usb
[    0.660063] usb0-vbus: 5000 mV 
[    0.660361] usb1-usb2-vbus: 5000 mV 
[    4.145021] usbcore: registered new interface driver asix
[    4.145065] usbcore: registered new interface driver ax88179_178a
[    4.145111] usbcore: registered new interface driver cdc_ether
[    4.145166] usbcore: registered new interface driver smsc95xx
[    4.145206] usbcore: registered new interface driver cdc_subset
[    4.145274] usbcore: registered new interface driver cdc_ncm
[    4.145781] tegra_xusb_read_usb_calib: usb_calib0 = 0x02858389
[    4.146272] usbcore: registered new interface driver usb-storage
[    4.146384] usbcore: registered new interface driver usbserial
[    4.146420] usbcore: registered new interface driver option
[    4.146453] usbserial: USB Serial support registered for GSM modem (1-port)
[    4.146487] usbcore: registered new interface driver pl2303
[    4.146517] usbserial: USB Serial support registered for pl2303
[    4.152139] tegra-udc tegra-udc.0: usb_bat_chg regulator not registered: USB charging will not be enabled
[    4.163950] usbcore: registered new interface driver uvcvideo
[    5.204885] usbcore: registered new interface driver usbhid
[    5.215388] usbhid: USB HID core driver
[    5.325541] usbcore: registered new interface driver snd-usb-audio
[    8.093459] usb1-usb2-vbus: incomplete constraints, leaving on
[    8.102815] usb0-vbus: incomplete constraints, leaving on
[   11.231416] tegra-xhci tegra-xhci: failed to init firmware from filesystem: tegra_xusb_firmware

A custom board requires a custom device tree. I don’t know if the update overwrote any of the device tree settings, but my guess is that the Ubuntu mechanism doesn’t touch the tree. On the other hand, the USB driver might have been replaced with a non-Tegra version and incapable of functioning, but that is speculation.

A newer kernel might require the device tree to change. In that case you are out of luck unless you know what the hardware differences are and kernel version differences.

FYI, when flashing a Jetson TK1 dev kit on command line you’d use the driver package plus sample rootfs. The sample rootfs in this case is just Ubuntu 14.04 without the NVIDIA-specific drivers. When doing the command line flash it would go like this…see URL and adjust:
https://devtalk.nvidia.com/default/topic/982779/jetson-tk1/how-to-perform-a-correct-fresh-ubuntu-install-on-jetson-tk1/post/5040584/#5040584

In particular, the part which is of interest for you is what the “sudo ./apply_binaries.sh” step does. This unpacks the NVIDIA-specific hardware accelerated drivers and libraries into the “rootfs/” subdirectory, and then the flash creates the image from that “rootfs/” directory and a few bootloader edits.

If you get the “driver” package (L4T downloads are free, though you might need to create a second login…the version to get would depend what was previously on the system, and I can’t even guess what is on a DJI Manifold), and don’t unpack the sample rootfs, but do run the “apply_binaries.sh” step, then the “rootfs/” subdirectory will contain the unpacked binaries. Or you can create an empty temp directory somewhere, and name that as the unpack location via the "-r " argument. Example:

sudo -s
mkdir /tmp/rootfs
./apply_binaries.sh -r /tmp/rootfs
# explore or copy or move the tree in "/tmp/rootfs/".
exit

When a Jetson has L4T on it you can run this command to check if all of those files are valid:

sha1sum -c /etc/nv_tegra_release

Does this command work for you? Does it show all files ok? If not, then perhaps unpacking those files from “/” of your TK1 would put a file back in place which is missing. I won’t even guess though at which files might be missing, but you could report here if anything specific is gone. There is no official support for this method of upgrade, nor for that version of Ubuntu, so there is a lot of guessing to live with.