IMX6ULL Autorun takes ages to start

So once the unit is turned on i need to start my application automatically.

I have created a service

[Unit]
Description=myapp service, runs the program
After=multi-user.target

[Service]
Type=simple
ExecStart=/home/root/myapp

[Install]
WantedBy=multi-user.target

to run my app and i have done systemctl enable <service_name>.service which worked successfully.

Now when i turn on the module EVENTUALLY it executes

Here are some timings

(Time in seconds from power on)

10 : Kernel starts and splash screen is shown (expected operation)

25 : Screen goes blank - at this point i see

[ OK ] Started Login Service.

[ 14.987911] Bluetooth: BNEP (Ethernet Emulation) ver 1.3

[ 14.994753] Bluetooth: BNEP filters: protocol multicast

[ 15.036494] Bluetooth: BNEP socket layer initialized

[FAILED] Failed to start Load default USB gadget schema g1.schema.

30 : Screen displays a white screen with what looks like the login after (Do i need to disable this somehow in menuconfig ?)

37 : login appears on the console

109 : The application runs

Q. Do i need to get it to auto login ?
Q. Why does it take so long to run

Dear @adrian,

For the error, “Failed to start Load default USB gadget schema g1.schema” , there is a fix already in the commuity mentioned. Not sure if it will work for BSP 3, but you can try to check that. https://www.toradex.com/community/questions/4607/linux-gadget-on-imx7.html

I have a couple of questions:

  • Does the module vootup to desktop if you don’t enable in the service?
  • What exact reference image is your image based upon?

Furthermore, to benchmark systemd there is systemd-analyze which might be helpful:
https://wiki.archlinux.org/index.php/Improving_performance/Boot_process

Normally,there should not be any issue, so could you please check your service again?

Best Regards,

Janani

Hello,

The module boots up to the console (No GUI desktop)

I expect my service is only run once everything has completed installing.

I wonder if there is something i can change in my service to make it start straight away as soon a s login appears

Hello @adrian,

How long does it take to boot up to the desktop (without your service)? If the boot -up is faster and as usual, I wonder if it could be something with your app service?

What exact reference image is your image based upon?

Best Regards,
Janani

If i login via the terminal the app starts straight away.

Is it waiting for a login timeout to expire ? then starting without any external login ?

Hello,
I dont quite understand what you mean by “login via terminal”. Could you please be more specific?

login via terminal … i have a serial port connected to the terminal output.

The unit boots up and then ends at

imx6ull login

As soon as i type ROOT the app starts

I now wonder if without typing anything, the login times out and then my program runs

So the line in the service i was missing is

Before=getty.target

so the full service looks like this

[Unit]
Description=myapp service, runs the program
After=multi-user.target
Before=getty.target
 
[Service]
Type=simple
ExecStart=/home/root/myapp
 
[Install]
WantedBy=multi-user.target

Hello @adrian ,

So, this line added to your application now fixes the issue?

Best Regards,
Janani

Yes, as soon as the splash screen clears my service runs immediately and my app starts

Hello @adrian ,

That’s perfect! Thank you for your reply