Failure to install grub on AGX xavier

I am trying to install GRUB on the AGX Xavier using the newest release.

I am following the instructions from this documentation page ( Bootloader > UEFI adaptation > Grub support ) which I have previously successfully followed on the Orin NX, however when I have to install grub I get the following kernel panic.

Do you have any information as to what might be the problem?

lruffati@ubuntu:~$ sudo grub-install --bootloader-id=Ubuntu --efi-directory=/opt/nvidia/esp --target=arm64-efi
Installing for arm64-efi platform.
[  554.297459] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[  554.297703] Mem abort info:
[  554.297777]   ESR = 0x86000004
[  554.297860]   EC = 0x21: IABT (current EL), IL = 32 bits
[  554.297984]   SET = 0, FnV = 0
[  554.298056]   EA = 0, S1PTW = 0
[  554.298134] user pgtable: 4k pages, 48-bit VAs, pgdp=000000012a03e000
[  554.298279] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000
[  554.298449] Internal error: Oops: 86000004 [#1] PREEMPT SMP
[  554.298579] Modules linked in: fuse lzo_rle lzo_compress zram ramoops reed_solomon snd_soc_tegra186_asrc snd_soc_tegra186_arad snd_soc_te
gra186_dspk snd_soc_tegra210_ope snd_soc_tegra210_mvc snd_soc_tegra210_amx snd_soc_tegra210_iqc snd_soc_tegra210_dmic snd_soc_tegra210_afc s
nd_soc_tegra210_adx snd_soc_tegra210_mixer snd_soc_tegra210_admaif snd_soc_tegra210_i2s snd_soc_tegra_pcm snd_soc_tegra210_sfc loop aes_ce_b
lk crypto_simd cryptd aes_ce_cipher ghash_ce sha2_ce sha256_arm64 sha1_ce ucsi_ccg snd_soc_tegra210_adsp typec_ucsi snd_soc_tegra_machine_dr
iver snd_soc_rt5659 snd_soc_tegra_utils input_leds snd_soc_spdif_tx snd_soc_simple_card_utils typec snd_soc_rl6231 max77620_thermal snd_soc_
tegra210_ahub nct1008 snd_hda_codec_hdmi nvadsp tegra_bpmp_thermal ahci bluedroid_pm libahci tegra210_adma userspace_alert snd_hda_tegra snd
_hda_codec libata snd_hda_core spi_tegra114 binfmt_misc ina3221 pwm_fan nvgpu nvmap ip_tables x_tables [last unloaded: mtd]
[  554.334935] CPU: 2 PID: 3340 Comm: grub-install Tainted: G           O      5.10.120-tegra #1
[  554.343591] Hardware name: Unknown Jetson-AGX/Jetson-AGX, BIOS 4.1-33958178 08/01/2023
[  554.351733] pstate: 00400009 (nzcv daif +PAN -UAO -TCO BTYPE=--)
[  554.358028] pc : 0x0
[  554.360155] lr : efivar_entry_set_get_size+0xe0/0x210
[  554.365377] sp : ffff80003229bca0
[  554.368794] x29: ffff80003229bca0 x28: 0000000000000078
[  554.374561] x27: ffff627dfe48f400 x26: ffffca4d80a2a000
[  554.380074] x25: 0000000000000007 x24: ffff80003229bd5b
[  554.385329] x23: ffffca4d80a2a248 x22: ffffca4d80822810
[  554.391098] x21: ffff80003229bd60 x20: 0000000000000000
[  554.396353] x19: ffff627dfe48f000 x18: 0000000000000000
[  554.402036] x17: 0000000000000000 x16: 0000000000000000
[  554.407548] x15: 0000aaaacaa48b54 x14: 005c004900460045
[  554.412972] x13: 005c003604040202 x12: 129152c26236b58e
[  554.418227] x11: 0000000000000009 x10: ffff627dda8e3800
[  554.423826] x9 : 0000000000000008 x8 : ffffca4d7fc6f8c0
[  554.429160] x7 : ffff000000000000 x6 : 0000000000000001
[  554.434240] x5 : 0000000000000000 x4 : ffff627dda8e3c80
[  554.439924] x3 : 0000000000000078 x2 : 0000000000000007
[  554.445266] x1 : ffff627dfe48f400 x0 : ffff627dfe48f000
[  554.450599] Call trace:
[  554.453050]  0x0
[  554.454910]  efivarfs_file_write+0xb4/0x180
[  554.458658]  vfs_write+0xc4/0x390
[  554.462150]  ksys_write+0x7c/0x110
[  554.465562]  __arm64_sys_write+0x28/0x40
[  554.469072]  el0_svc_common.constprop.0+0x80/0x1d0
[  554.474139]  do_el0_svc+0x38/0xb0
[  554.477568]  el0_svc+0x1c/0x30
[  554.480524]  el0_sync_handler+0xa8/0xb0
[  554.484031]  el0_sync+0x16c/0x180
[  554.487475] Code: bad PC value
[  554.490683] ---[ end trace 9529a62d0f64cd48 ]---
[  554.505099] Kernel panic - not syncing: Oops: Fatal exception
[  554.505257] SMP: stopping secondary CPUs
[  554.505381] Kernel Offset: 0x4a4d6e8b0000 from 0xffff800010000000
[  554.510452] PHYS_OFFSET: 0xffff9d8340000000
[  554.514653] CPU features: 0x18240002,03802a30
[  554.519022] Memory Limit: none
[  554.529085] ---[ end Kernel panic - not syncing: Oops: Fatal exception ]---

Hi lorenzo.ruffati,

Are you using the devkit or custom board for AGX Xavier?
What’s the Jetpack version in use? (JP5.1.2-R35.4.1?)

Do you run this command on AGX Xavier or your host PC?

Please share the full workflow you run and the result.

devkit or custom board for AGX Xavier

I am using the devkit
It is freshly flashed from the sdkmanager using the latest version available

Do you run this command on AGX Xavier or your host PC?

They are executed on the agx xavier, I connect to it through the serial over usb port functionality

I’ve verified the workflow, it should work.
Since the name from your console is “@ ubuntu”…

Please share the full command and result at your side for further check.

Since the name from your console is “@ ubuntu”…
That’s the name the sdk manager flashes, I could not set it

I’m attaching three files, the zip is the result of “export logs” on the sdk manager after the process completes

The _reflashing.log is the log of the serial connection from the moment I restarted it in reset mode up to doing an “apt update; apt upgrade; reboot” on the flashed system

The _grub.log is the log of the serial connection from after the reboot up to the kernel panic

SDKM_logs_JetPack_5.1.2_Linux_for_Jetson_AGX_Xavier_modules_2023-11-28_12-08-35.zip (223.8 KB)
agx_xavier_reflashing.log (396.2 KB)
agx_xavier_grub.log (12.5 KB)

Are you using the AGX Xavier devkit with booting from NVMe?

lruffati@ubuntu:~$ # e[Ke[Kasudo mount -o remount,rw /sys/firmware/efi/efivars # e[Ke[Ke[K
lruffati@ubuntu:~$ sudo mount -o remount,rw /sys/firmware/efi/efivars

Do you run above 2 commands?

Yes, I am looking to boot from the nvme drive

I did run the remount command, as you can see running grub install without remounting the efivars crashes as well (I ran the command as in the guide before remounting, you can find it in the log just above the snippet you quoted)

I’ve checked this with internal that AGX Xavier isn’t a compliant platform, runtime variables aren’t supported.
There’s no qspi and variables are on same media as os so that uefi can’t update them while in os.

Could you please go into more detail as to what you mean by this? Are the UEFI variables stored in the emmc/nvme storage? Are they in one of the partitions on disk? Is there a way to set the UEFI variables during the flashing process?

Yes, correct.

What’s your use case for this? You could configure them in source.

In which of the partitions, if any specifically?

I have a twofold interest in not accidentally erasing them and also being able to add the grub entry (or other entries) during the flashing process, since it can’t be added from within the OS

uefi_variables partition.
It stores uefi variable like boot options.
Grub won’t work on AGX Xavier as it doesn’t have runtime variables support.