Jetson AGX Xavier error invoke-rc.d

I am having difficulty in flashing the Jetson AGX Xavier using SDK Manager 1.5.1.7814 on a Ubuntu 18.04 host. I get the following error:
target_image: invoke-rc.d: could not determine current runlevel

The output from the terminal is:

14:26:16 INFO: File System and OS - target_image: Processing triggers for libc-bin (2.27-3ubuntu1.3) ...
14:26:17 INFO: File System and OS - target_image: Removing QEMU binary from rootfs
14:26:17 INFO: File System and OS - target_image: Removing stashed Debian packages from rootfs
14:26:17 INFO: File System and OS - target_image: Disable the ondemand service by changing the runlevels to 'K'
14:26:17 INFO: File System and OS - target_image: Success!
14:26:17 INFO: File System and OS - target_image: /media/xavier/nvidia_image/JetPack_4.5.1_Linux_JETSON_AGX_XAVIER_TARGETS/Linux_for_Tegra/rootfs /media/xavier/nvidia_image/JetPack_4.5.1_Linux_JETSON_AGX_XAVIER_TARGETS/Linux_for_Tegra
14:26:18 INFO: File System and OS - target_image: (Reading database ... 159062 files and directories currently installed.)
14:26:18 INFO: File System and OS - target_image: Removing dnsmasq (2.79-1ubuntu0.2) ...
14:26:18 ERROR: File System and OS - target_image: invoke-rc.d: could not determine current runlevel
14:26:19 INFO: File System and OS - target_image: * Stopping DNS forwarder and DHCP server dnsmasq
14:26:19 INFO: File System and OS - target_image: * (not running)
14:26:20 INFO: File System and OS - target_image: Purging configuration files for dnsmasq (2.79-1ubuntu0.2) ...
14:26:22 INFO: File System and OS - target_image: Processing triggers for systemd (237-3ubuntu10.43) ...
14:26:22 INFO: File System and OS - target_image: /media/xavier/nvidia_image/JetPack_4.5.1_Linux_JETSON_AGX_XAVIER_TARGETS/Linux_for_Tegra
14:26:22 INFO: File System and OS - target_image: command finished successfully
14:26:22 SUMMARY: File System and OS - target_image: Install completed successfully.
14:26:22 INFO: Start to check if only one device connected...
14:26:22 DEBUG: running command < true >
14:26:22 INFO: command finished successfully
14:26:22 DEBUG: running command < [ `lsusb | grep -c "0955:"` -ne 1 ] >
14:26:23 DEBUG: command terminated with error
14:26:23 INFO: Only one NVIDIA device detected, as expected.
14:26:23 INFO: Start to check if in device recovery mode...
14:26:23 DEBUG: running command < true >
14:26:23 INFO: command finished successfully
14:26:23 DEBUG: running command < lsusb | grep 0955:7020 >
14:26:23 DEBUG: command terminated with error
14:26:23 INFO: Jetson device is in recovery mode.
14:26:23 INFO: Start to check if the right device connected...
14:26:23 DEBUG: running command < true >
14:26:23 INFO: command finished successfully
14:26:23 DEBUG: running command < lsusb | grep -E '0955:7019|0955:7819' >
14:26:23 INFO: Bus 001 Device 005: ID 0955:7019 NVidia Corp.
14:26:23 INFO: command finished successfully
14:26:23 INFO: Verified, 0955:7019 or 0955:7819 detected in recovery mode.
14:26:24 DEBUG: running command < true >
14:26:24 INFO: command finished successfully
14:26:24 DEBUG: Device Mode Host Setup in Flash - flash: using adapter to install NV_DEVICE_MODE_SETUP_IMAGE_COMP@JETSON_AGX_XAVIER_TARGETS to /media/xavier/nvidia_image/JetPack_4.5.1_Linux_JETSON_AGX_XAVIER_TARGETS
14:26:24 INFO: Device Mode Host Setup in Flash - flash: exec_command: /tmp/tmp_NV_DEVICE_MODE_SETUP_IMAGE_COMP.sh
14:26:24 INFO: Device Mode Host Setup in Flash - flash: Found route default wlp59s0, setting up device mode
14:26:24 INFO: Device Mode Host Setup in Flash - flash: net.ipv4.ip_forward = 1
14:26:24 INFO: Device Mode Host Setup in Flash - flash: command finished successfully
14:26:24 SUMMARY: Device Mode Host Setup in Flash - flash: Install completed successfully.
14:26:24 DEBUG: running command < true >
14:26:24 INFO: command finished successfully
14:26:24 DEBUG: Flash Jetson AGX Xavier 16GB/32GB - flash: using adapter to install NV_L4T_FLASH_XAVIER_WITH_OS_IMAGE_COMP@JETSON_AGX_XAVIER_TARGETS to /media/xavier/nvidia_image/JetPack_4.5.1_Linux_JETSON_AGX_XAVIER_TARGETS
14:26:24 INFO: Flash Jetson AGX Xavier 16GB/32GB - flash: *** Checking ONLINE mode ... OK.
14:26:24 INFO: Flash Jetson AGX Xavier 16GB/32GB - flash: *** Checking target board connection ... 1 connections found.
14:26:30 INFO: Flash Jetson AGX Xavier 16GB/32GB - flash: Put the target board in RCM mode and retry.
14:26:30 ERROR: Flash Jetson AGX Xavier 16GB/32GB - flash: command terminated with error
14:26:32 SUMMARY: NVIDIA Nsight Systems - target: Depends on failed component

Would be very grateful if you could advise on how to fix this.
Thanks,
Naveen

It looks like the error is something else.

Could you manually put your xavier to recovery mode and use flash.sh to do the flash work directly? Want to see what kind of error will be reported by flash.sh.

You can refer to the “flash problem” of below page.
https://elinux.org/Jetson/General_debug

Hi WayneWWW,
Thanks for your reply. After putting into recovery mode, executed
sudo ./flash.sh jetson-xavier mmcblk0p1

It got stuck after approximately 7 mins. See the following log.

[   9.8409 ] Packing sdram param for instance[0]
[   9.9997 ] Packing sdram param for instance[1]
[  10.0001 ] Packing sdram param for instance[2]
[  10.0009 ] Packing sdram param for instance[3]
[  10.0010 ] Packing sdram param for instance[4]
[  10.0010 ] Packing sdram param for instance[5]
[  10.0010 ] Packing sdram param for instance[6]
[  10.0010 ] Packing sdram param for instance[7]
[  10.0010 ] Packing sdram param for instance[8]
[  10.0010 ] Packing sdram param for instance[9]
[  10.0010 ] Packing sdram param for instance[10]
[  10.0010 ] Packing sdram param for instance[11]
[  10.0010 ] Packing sdram param for instance[12]
[  10.0011 ] Packing sdram param for instance[13]
[  10.0011 ] Packing sdram param for instance[14]
[  10.0011 ] Packing sdram param for instance[15]
[  10.0011 ] 
[  10.0014 ] Reading ramcode from backup chip_info.bin file
[  10.0017 ] RAMCODE Read from Device: 2

[  10.0018 ] Disabled BPMP dtb trim, using default dtb
[  10.0018 ] 
[  10.0041 ] tegrahost_v2 --chip 0x19 --align mem_rcm.bct
[  10.0060 ] 
[  10.0080 ] tegrahost_v2 --chip 0x19 0 --magicid MEMB --ratchet_blob ratchet_blob.bin --appendsigheader mem_rcm.bct zerosbk
[  10.0099 ] adding BCH for mem_rcm.bct
[  10.0136 ] 
[  10.0161 ] tegrasign_v2 --key None --list mem_rcm_sigheader.bct_list.xml --pubkeyhash pub_key.key
[  10.0178 ] Assuming zero filled SBK key
[  10.0184 ] 
[  10.0213 ] tegrahost_v2 --chip 0x19 0 --updatesigheader mem_rcm_sigheader.bct.encrypt mem_rcm_sigheader.bct.hash zerosbk
[  10.0250 ] 
[  10.0252 ] Copying signatures
[  10.0271 ] tegrahost_v2 --chip 0x19 0 --partitionlayout flash.xml.bin --updatesig images_list_signed.xml
[  14.6902 ] 
[  14.6904 ] Boot Rom communication
[  14.6923 ] tegrarcm_v2 --chip 0x19 0 --rcm rcm_list_signed.xml
[  14.6941 ] BootRom is not running
[  19.9437 ] 
[  20.9466 ] tegrarcm_v2 --isapplet

Thanks.
Best regards,
Naveen

HI Naveen,

Does your host ever flash other jetson device before? If not, do you have other jetson devices that can test now?

If all the devices not able to get flashed, then it is probably the host side issue. Otherwise it is device side problem.

Please also connect a micro usb cable to the micro usb port on your xavier devkit.

Use minicom to open /dev/ttyUSB3 on your host. This console should print out some log when flash.sh starts to run, please share the logs so that we can find out why it gets stuck.