Calling cm at boot time


I wanted to use cm info fsn, or cm data info in init.d files but I get the following error:

root: No UART mapped to CONSOLE

Is there any solution to solve this problem?


Hi Alain,
You cannot issue Legato commands prior to Legato starting up at S44.

Hello Chris,

Ok but I’m starting at S90, through rc5.d so I’m supposed to execute cm after legato starting up no?

Here is the syslog. The last lines is where I execute cm:


Any idea please?


Hi Alain,
Can you try S90 in rcS.d? Are you certain your changes are being called properly? I don’t think rc5.d is being called.

Hi Chris,
I verified how our yocto image is built:

install -d ${D}${sysconfdir}/init.d
install -d ${D}${sysconfdir}/rcS.d
install -d ${D}${sysconfdir}/rc1.d
install -d ${D}${sysconfdir}/rc2.d
install -d ${D}${sysconfdir}/rc3.d
install -d ${D}${sysconfdir}/rc4.d
install -d ${D}${sysconfdir}/rc5.d

install -m 0544 ${WORKDIR}/        			${D}${sysconfdir}/init.d/blackbox

ln -sf ../init.d/blackbox        ${D}${sysconfdir}/rcS.d/S90blackbox
ln -sf ../init.d/blackbox        ${D}${sysconfdir}/rc1.d/K90run-script
ln -sf ../init.d/blackbox        ${D}${sysconfdir}/rc2.d/K90run-script
ln -sf ../init.d/blackbox        ${D}${sysconfdir}/rc3.d/K90run-script
ln -sf ../init.d/blackbox        ${D}${sysconfdir}/rc4.d/K90run-script
ln -sf ../init.d/blackbox        ${D}${sysconfdir}/rc5.d/S90run-script

Do you agree with that?

And according to the log I provided in a previous post, cm command is performed after Legato started up.


Still blocked on that topic!:frowning_face:

Hi Alain,
When you added your startup script, did you manually edit the filesystem on your FX30? Or, did you rebuilt your root file system, with the startup script added?

If you manually run your script, does it function properly?


I added the startup script at build time, I didn’t added it from the FX30 shell.

And if I start it manually from FX30 shell it works.

But according to the logs, I really get an error executing cm at boot time at S90 level.

running cm once the system is fully started is ok. But it’s really not convenient for my purpose.

Hi Albo,
Are you certain your cm calls are failing? I’ve been able to execute Legato commands from startup scripts without an issue.
The message “No UART mapped to CONSOLE” that you originally reported is completely unrelated to the cm calls. Is this still an issue? If so, this is caused because you haven’t configured the UART. Try: AT!MAPUART=16,1 followed by a reboot.

So here is what I tried:

To begin, this what my /etc/rcS.d/90blackbox contains:

# update-rc.d   Update the links in /etc/rc[0-9S].d/
# (c) 2003, 2004 Phil Blundell <>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.

DESC="Proxy Askco"

test -f $DAEMON || exit 0

set -e

case "$1" in
        logger -s "starting $DESC: $NAME... "
        sed -i "s/#SER_NUM/$(cm info fsn)/" /etc/askco.json
        logger -s "sed done."
        # TODO enable start at boot
        logger -s "done."
        logger -s -n "stopping $DESC: $NAME... "
        start-stop-daemon -K -x $DAEMON
        logger -s "done."
        echo -n "blackbox "
        start-stop-daemon -q -K -t -x $DAEMON
        logger -s "restarting $DESC: $NAME... "
        $0 stop
        $0 start
        logger -s "done."
        logger -s "reloading $DESC: $NAME... "
        killall -HUP $(basename ${DAEMON})
        logger -s "done."
        echo "Usage: $0 {start|stop|status|restart|reload}"
        exit 1

exit 0

if I look at the log, I can see lot of ‘kernel’ messages, followed by lot of ‘legato’ messages and mine:

2018-08-22T16:19:12.096698+00:00 (none) Legato:  INFO | posDaemon[538]/swiQmi T=main | swiQmi.c StartService() 107 | qmi_client_get_service_list rc=0, numServices=2
2018-08-22T16:19:12.464774+00:00 (none) root: starting Proxy Askco: blackbox... 
2018-08-22T16:19:12.553344+00:00 (none) root: sed done
2018-08-22T16:19:12.596805+00:00 (none) root: done.
2018-08-22T16:19:12.611607+00:00 (none) Legato:  INFO | modemDaemon[536]/swiQmi T=main | swiQmi.c InitService() 367 | Init QMI service QMI_SERVICE_DMS (2)
2018-08-22T16:19:12.616308+00:00 (none) Legato:  INFO | modemDaemon[536]/swiQmi T=main | swiQmi.c PrintServiceDetails() 343 | Service.2: library_version.6 idl_version.1 service_id.0x2 idl_minor_version.35

and in my target file sed replaces #SER_NUM by an empty string so cm returned nothing when invoked.

if I execute ‘/etc/rcS.d/S90blackbox start’, from ssh, that works perfectly.

So you are right, I don’t see any UART error message anymore so it seems that was caused by something else not related to cm.

Anyway, at level S90 something is still missing to cm.

Hi Albo,
Could you try a different Legato command? Something simple, like “app status” or just “cm”. I’m wondering if there’s perhaps a race condition with the radio module starting up, so the information like fsn or radio data can’t be read yet.

So I added the following line:

app status > /tmp/app.log

/tmp/app.log is created but empty.

Maybe these commands work but do not output anything if there are not started from shell?