Error: Environment import failed: errno = 22

Hi,

Sometimes uboot fails at power on with “## Error: Environment import failed: errno = 22”.

Sometimes it is enough to just switch off the power and then on again and uboot will startup successfully and load the OS image as expected but other times one needs to run the commands:

env default -a
saveenv
reset

to work around the problem.

What do I do to avoid getting errno 22?

thanks
Jerker

Hi @jerrymek !

Could you please give us more information about your setup?

  • Which exact Verdin iMX8M Mini module are you using? Please share its full name with the version.
  • Which carrier board are you using? If it is one from Toradex, share its name and verison.
  • Which BSP version are you using?
    • Share also the Linux kernel version,
    • And U-boot version.

Best regards,

Hi Henrique,

SOM: Toradex Verdin iMX8M Mini Quad 2GB Wi-Fi / BT IT V1.1B

UBOOT:

  • ATF 835a8f6
  • U-Boot 2020.04-5.5.0-devel+git.81bc8894031d

LINUX:
Linux version 5.4.154-5.5.0-devel+git.9f04e0d3d560 (oe-user@oe-host) (gcc version 9.3.0 (GCC)) #1 SMP PREEMPT Fri Nov 26 15:33:03 UTC 2021

The carrier board is of our own design.

I have logfiles of the failed boot and recovery procedure. Please let me know where to send them.

Please let me know if you need more information.

brdgs

Hi @jerrymek !

You can either share the logs here or if you find it more appropriate, you can send them to support@toradex.com. Please don’t forget to refer to this thread if you send via email :slight_smile:

Best regards,

Hi henrique.tx,

have you received the logs I sent you via the support mail account?

brdgs
jerrymek

Hi @jerrymek !

Yes, we received the logs. Thanks for sending them.

Seems like there is some problem during the normal boot process during U-boot and it tries to reach for network to proceed.

From t7-failed-boot-4.txt file, I see a uncommong text: Verdin-iMX8MM_OST7.

Do you know what this is about?

Best regards,

Hi henrque.tx,

It is our os image.

Brdgs

Hi henrique.tx
Our OS image is based on an older version of Toradex Linux.

TDX Wayland with XWayland 5.5.0-devel-20221028114623+build.0 (dunfell) verdin-imx8mm ttymxc0
Verdin-iMX8MM_OST7

What are the latest updates done to Toradex Linux?
Any updates that might help solve our problem?

brdgs

Hi again Henrique,
I’ve sent you yet another logfile through support@toradex.com were we can see the badly formatted environment variables after a failed boot attempt.
What can cause this kind of problem?
brdgs

Hi @jerrymek !

As a hardware sanity check, could you please install a Toradex Reference Minimal Image from BSP 5.7.0 on this exact same module and see if the same issue occurs?

Let us know the result.

Best regards,

Hi Henrique,
I have updated the OS image on the SoM (v1.1D) from Dunfell 5.5.0 to 5.7.1.
I haven’t sofar been able to trigger the problem.
I’ll swap SoM to v1.1B and repeat the tests.
Have Nice Weekend!
Jerker

Hi Henrique,

First thing that happened this morning when I started the new SoM with was that uboot failed with error 22 again. The U-boot version is:
U-Boot 2020.04-5.7.1-devel+git.33bb8e968332 (Jul 06 2022 - 12:21:53 +0000)

The complete log of the uboot failure:

U-Boot SPL 2020.04-5.7.1-devel+git.33bb8e968332 (Jul 06 2022 - 12:21:53 +0000)
DDRINFO: start DRAM init
DDRINFO: DRAM rate 3000MTS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
Trying to boot from MMC1
NOTICE:  BL31: v2.2(release):toradex_imx_5.4.70_2.3.0-g2fa8c6349e
NOTICE:  BL31: Built : 12:30:42, May 17 2022


U-Boot 2020.04-5.7.1-devel+git.33bb8e968332 (Jul 06 2022 - 12:21:53 +0000)

CPU:   i.MX8MMQ rev1.0 1600 MHz (running at 1200 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 29C
Reset cause: POR
DRAM:  2 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... OK
Fail to setup video link
In:    serial
Out:   serial
Err:   serial
Model: Toradex Verdin iMX8M Mini Quad 2GB Wi-Fi / BT IT V1.1D, Serial# 07091757
get_tdx_eeprom: cannot find EEPROM by node
MISSING TORADEX CARRIER CONFIG BLOCKS
get_tdx_eeprom: cannot find EEPROM by node

 BuildInfo:
  - ATF 2fa8c63
  - U-Boot 2020.04-5.7.1-devel+git.33bb8e968332

flash target is MMC:0
Net:   eth0: ethernet@30be0000
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot:  0
MMC: no card present
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
2902 bytes read in 17 ms (166 KiB/s)
## Executing script at 47000000
Loading DeviceTree: imx8mm-verdin-wifi-dev.dtb
63555 bytes read in 19 ms (3.2 MiB/s)
## Error: Environment import failed: errno = 22
Booting from mmc failed!
SCRIPT FAILED: continuing...
63555 bytes read in 20 ms (3 MiB/s)
starting USB...
Bus usb@32e40000: Port not available.
Bus usb@32e50000: USB EHCI 1.00
scanning bus usb@32e50000 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

Device 0: unknown device
ethernet@30be0000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
Could not initialize PHY ethernet@30be0000
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
BOOTP broadcast 8
BOOTP broadcast 9
BOOTP broadcast 10
BOOTP broadcast 11
BOOTP broadcast 12
BOOTP broadcast 13
BOOTP broadcast 14
BOOTP broadcast 15
BOOTP broadcast 16
BOOTP broadcast 17

Retry time exceeded; starting again
ethernet@30be0000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
Could not initialize PHY ethernet@30be0000
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
BOOTP broadcast 8
BOOTP broadcast 9
BOOTP broadcast 10
BOOTP broadcast 11
BOOTP broadcast 12
BOOTP broadcast 13
BOOTP broadcast 14
BOOTP broadcast 15
BOOTP broadcast 16
BOOTP broadcast 17

Retry time exceeded; starting again
Verdin iMX8MM #

Brdgs

Hi Henrique,

To which interface is the mmc connected?

Is there a setting in the Device Three that must not be changed?

brgds

Hi @jerrymek !

Is this log from your own image or from one of Toradex’s Reference images?
Also, you have the following line on your logs:

MISSING TORADEX CARRIER CONFIG BLOCKS

There’s two ways on how to re-write the config block on the module. One way would be to load the Toradex Easy Installer on it and this should then prompt you to enter all the details.

Alternatively, you could also stop in U-Boot and enter the command cfgblock create and then follow the instructions there.

After you did one of the procedures let us know if this changes the behavior of the setup.

Best Regards
Kevin

Hi Kevin,

It is our own image. I did an upgrade of the kernel from 5.5.0 to 5.7.1.

Regarding the “MISSING TORADEX CARRIER CONFIG BLOCKS”:

Verdin iMX8MM # cfgblock create
A valid Toradex config block is present, still recreate? [y/N]

How do I handle that? Shall I still reconfigure the config block?

best regards

ps
I did the reconfiguration and found the same printout in the subsequent boot:
“Model: Toradex Verdin iMX8M Mini Quad 2GB Wi-Fi / BT IT V1.1D, Serial# 07091757
get_tdx_eeprom: cannot find EEPROM by node
MISSING TORADEX CARRIER CONFIG BLOCKS
get_tdx_eeprom: cannot find EEPROM by node”

brdgs

Hi @jerrymek !

As you have your own carrier board, seems like you didn’t add the carrier board EEPROM that is present on Toradex’ carrier boards. But this shouldn’t be an issue.

Focusing on the other error, which seems to be more intriguing, I searched for the error message `Environment import failed" in the U-boot source code, I found this: common.c « env - u-boot-toradex.git - U-Boot bootloader for Apalis and Colibri modules

...
void env_set_default(const char *s, int flags)
{
	if (sizeof(default_environment) > ENV_SIZE) {
		puts("*** Error - default environment is too large\n\n");
		return;
	}

	if (s) {
		if ((flags & H_INTERACTIVE) == 0) {
			printf("*** Warning - %s, "
				"using default environment\n\n", s);
		} else {
			puts(s);
		}
	} else {
		debug("Using default environment\n");
	}

	if (himport_r(&env_htab, (char *)default_environment,
			sizeof(default_environment), '\0', flags, 0,
			0, NULL) == 0)
		pr_err("## Error: Environment import failed: errno = %d\n",
		       errno);

	gd->flags |= GD_FLG_ENV_READY;
	gd->flags |= GD_FLG_ENV_DEFAULT;
}
...

To me, seems like u-boot isn’t able to retrieve the default environment variables, which is rather strange.

Could you please confirm that you installed one of the precompiled Toradex Reference Images? From your previous messages, it is not crystal clear that you are using one of Toradex’s prebuilt reference images.

Best regards,

Hi Henrique,

that is because the environment variables are distorted for some reason, see attached logfile: t7-failed-boot-c.txt (70.8 KB)

error 22 means invalid argument. I assume that when u-boot tries to read a broken variable and tries to make a function call with a parameter that then is broken due to broken env variable the faulty argument is detected nd error handling is performed, or what do you think?

The real problem is that the startup problem is rare and we don’t know how to reproduce it.
It ususally happens when you start the carrier board (and the SoM) first time in the morning. If you then restart the board it starts up fine.
In very rare occasions it happens if you turn it off and try again after some hour.

I’ve loaded the minimal refernce image successfully on the SoM and now I will try to provoke the startup problem.
Have a nice weekend!
J

Hi @jerrymek!

Seems reasonable. But it is really strange. I asked internally about your issue. Hopefully, someone can help us to better understand what can be going on.

This makes it harder to find out the cause. :confused:
An important question here: are you facing this issue with only this specific module or you could face the same issue with other modules?

Ok! Let us know how it goes.

Best regards,