# How to bundle multiple apps in a single file with no system image

**URL:** <https://forum.legato.io/t/how-to-bundle-multiple-apps-in-a-single-file-with-no-system-image/6312>\
**Category:** Legato Application Framework\
**Created:** [October 7, 2022, 9:08am UTC](https://forum.legato.io/t/how-to-bundle-multiple-apps-in-a-single-file-with-no-system-image/6312 "2022-10-07T09:08:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ken.sumrall](https://avatars.discourse-cdn.com/v4/letter/k/3be4f8/32.png) [@ken.sumrall](https://forum.legato.io/u/ken.sumrall)\
**Post date:** [October 7, 2022, 9:08am UTC](https://forum.legato.io/t/how-to-bundle-multiple-apps-in-a-single-file-with-no-system-image/6312/1 "2022-10-07T09:08:19Z")

</div>

Our code consists of 5 apps that communicate with each other via shared memory. We currently do updates by sending down 5 .update files, each one made with mkapp. We’d like to have just one file that contains the 5 apps.

I tried specifying the 5 programs in the “executable” section of the adef file, and also specifying those same programs in the “processes-\>run” section of the adef file. That worked, but it looks like a single app to the Legato system. I am unable to use “app stop” to stop just one component of our system.

I tried using mksys, and that did provide 5 separate apps, but it also included a system image which makes the file 40 times bigger!

Is there a way to build a .update file which contains 5 separate apps, and no system image?

Thanks!

Ken

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [October 7, 2022, 9:46am UTC](https://forum.legato.io/t/how-to-bundle-multiple-apps-in-a-single-file-with-no-system-image/6312/2 "2022-10-07T09:46:22Z")

</div>

you can combine those 5 apps into one legato app, just like what you did to specify 5 programs in the “executable” section of the adef file, but also specify “start: manual” to manually start the application.

After that you can run each component by “app runProc”  
e.g.  
app runProc hello1 hello1 --exe=hello1 &  
app runProc hello1 hello2 --exe=hello1 &

To stop the component, you can find out the pid and kill the process.

```auto

root@swi-mdm9x28-wp:~# app runProc hello1 hello1 --exe=hello1 &
root@swi-mdm9x28-wp:~# ps aux | grep hello
root 4439 0.1 0.6 3156 1036 pts/0 S 08:14 0:00 app runProc hello1 hello1 --exe=hello1
root 4440 0.1 0.6 3048 1072 ? S 08:14 0:00 hello1
root 4524 0.0 0.3 2324 516 pts/0 S+ 08:14 0:00 grep hello
root@swi-mdm9x28-wp:~# app runProc hello1 hello2 --exe=hello1 &
root@swi-mdm9x28-wp:~# ps aux | grep hello
root 4439 0.0 0.6 3156 1036 pts/0 S 08:14 0:00 app runProc hello1 hello1 --exe=hello1
root 4440 0.0 0.6 3048 1072 ? S 08:14 0:00 hello1
root 4532 0.3 0.6 3156 1036 pts/0 S 08:15 0:00 app runProc hello1 hello2 --exe=hello1
root 4533 0.3 0.6 3048 1076 ? S 08:15 0:00 hello2
root 4555 0.0 0.3 2324 516 pts/0 S+ 08:15 0:00 grep hello
root@swi-mdm9x28-wp:~# kill 4533
[2]+ Done app runProc hello1 hello2 --exe=hello1

root@swi-mdm9x28-wp:~# ps aux | grep hello
root 4439 0.0 0.6 3156 1036 pts/0 S 08:14 0:00 app runProc hello1 hello1 --exe=hello1
root 4440 0.0 0.6 3048 1072 ? S 08:14 0:00 hello1
root 4850 0.0 0.3 2324 516 pts/0 S+ 08:15 0:00 grep hello

root@swi-mdm9x28-wp:~# app status
[running] atAirVantage
[running] atQmiLinker
[running] atService
[running] audioService
[running] avcService
[running] cellNetService
[running] dataConnectionService
[running] fwupdateService
[running] gpioService
[running] modemService
[running] portService
[running] positioningService
[running] powerMgr
[running] qmiAirVantage
[running] secStore
[stopped] smsInboxService
[stopped] spiService
[stopped] tools
[stopped] voiceCallService
[stopped] wifi
[stopped] wifiApTest
[stopped] wifiClientTest
[running] wifiService
[stopped] wifiWebAp
[stopped] atServerIntegrationTest
[running] hello1

```

---

<div class="post-metadata">

**Author:** ![ken.sumrall](https://avatars.discourse-cdn.com/v4/letter/k/3be4f8/32.png) [@ken.sumrall](https://forum.legato.io/u/ken.sumrall)\
**Post date:** [October 10, 2022, 6:14pm UTC](https://forum.legato.io/t/how-to-bundle-multiple-apps-in-a-single-file-with-no-system-image/6312/3 "2022-10-10T18:14:48Z")

</div>

Thanks for the reply. I tried using app runProc on my system, but it doesn’t exist. Is it a new feature in the R15 release? We haven’t moved to that yet.

Also, the start:manual step is not what we want. Unless your’e suggesting start:manual when doing a debugging build? But we were hoping for a way to do this for debugging on a production system. We also specify faultAction: restartApp for the processes, so I’m guessing if I kill them, they will just restart.

Our dream would be something like the output of mksys, but without the system update part. But my testing seems to indicate that is not possible.

Let me know if you have any other nuggets of information to share.

Thanks!.

Ken

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [October 10, 2022, 11:51pm UTC](https://forum.legato.io/t/how-to-bundle-multiple-apps-in-a-single-file-with-no-system-image/6312/4 "2022-10-10T23:51:48Z")

</div>

“app runProc” is basic command in legato

> **[app - Legato Docs](https://docs.legato.io/latest/toolsTarget_app.html)**
>
> legato™ is an open source Linux-based embedded platform designed to simplify connected IoT application development

Btw, for your original trial, have you tried the kill the pid of your 5 components? Can it be stopped?

In my test, I don’t see problem to just kill one component:

```auto

root@swi-mdm9x28-wp:~# ps aux | grep hello
apphell+ 2373 0.0 0.6 3048 1068 ? S 08:04 0:00 hello1
apphell+ 2374 0.0 0.6 3048 1060 ? S 08:04 0:00 hello2
root 2611 0.0 0.3 2324 516 pts/0 S+ 08:04 0:00 grep hello
root@swi-mdm9x28-wp:~# killall hello2
root@swi-mdm9x28-wp:~# ps aux | grep hello
apphell+ 2373 0.0 0.6 3048 1068 ? S 08:04 0:00 hello1
root 2788 0.0 0.3 2324 516 pts/0 S+ 08:05 0:00 grep hello
root@swi-mdm9x28-wp:~# app status
[running] atAirVantage
[running] atQmiLinker
[running] atService
[running] audioService
[running] avcService
[running] cellNetService
[running] dataConnectionService
[running] fwupdateService
[running] gpioService
[running] modemService
[running] portService
[running] positioningService
[running] powerMgr
[running] qmiAirVantage
[running] secStore
[stopped] smsInboxService
[stopped] spiService
[stopped] tools
[stopped] voiceCallService
[stopped] wifi
[stopped] wifiApTest
[stopped] wifiClientTest
[running] wifiService
[stopped] wifiWebAp
[stopped] atServerIntegrationTest
[running] hello1

```

Here is my .adef file:

```auto

//start: manual
executables:
{
	hello1 = ( hello1Component )
	hello2 = ( hello1Component )
}

processes:
{
	envVars:
	{
		LE_LOG_LEVEL = DEBUG
	}

	run:
	{
		( hello1 )
		( hello2)
	}

	maxCoreDumpFileBytes: 512K
	maxFileBytes: 512K
	
	
	//faultAction: reboot
	faultAction: restartApp 
}

version: 1.0.0
maxFileSystemBytes: 512K

sandboxed: true

```

---

<div class="post-metadata">

**Author:** ![mike.brearton](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@mike.brearton](https://forum.legato.io/u/mike.brearton)\
**Post date:** [April 25, 2023, 10:28pm UTC](https://forum.legato.io/t/how-to-bundle-multiple-apps-in-a-single-file-with-no-system-image/6312/5 "2023-04-25T22:28:44Z")

</div>

Hi Ken, did you find a solution? We have 4 apps to deploy; and would like to deploy as a set (without the system image).  
I have been trying to see if AirVantage might support this somehow; but no joy yet. “Workflow” shows “Install Application” step-types in the manual… that appeared promising; but that step isn’t available when I login.  
Regards, Mike

---

<div class="post-metadata">

**Author:** ![ken.sumrall](https://avatars.discourse-cdn.com/v4/letter/k/3be4f8/32.png) [@ken.sumrall](https://forum.legato.io/u/ken.sumrall)\
**Post date:** [April 25, 2023, 11:54pm UTC](https://forum.legato.io/t/how-to-bundle-multiple-apps-in-a-single-file-with-no-system-image/6312/6 "2023-04-25T23:54:36Z")

</div>

Mike,

We ended up going with a single .adef file that listed all 5 of our apps, in both the “executables” section and the “processes-\>run” section. We also changed the faultAction: flag from “restartApp” to “restart”. That way, if one of the 5 executables crashes, it just restarts that process, not all 5 processes.

After some internal discussion, we decided we really liked the fact that all 5 executables get installed and restarted as a unit. It really simplified deployment and versioning of our software. The only downsides are we can no longer just stop one of the processes, which we would sometimes do when debugging a problem. If we kill the executable with the kill command, it will get just restarted, so we now have to to “app stop \<app\_name\>” to stop all 5 processes when debugging certain problems. But that’s not a issue for us. We just need to remember to use a different command now when we need to stop our app.

That other downside is we cannot update just one of the executables via AirVantage. We have to send down the entire combined app, even is only one executable is different. But it does make building a release easier, and there is much less of a chance of installing different releases of the 5 executables in our app.

---

<div class="post-metadata">

**Author:** ![mike.brearton](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@mike.brearton](https://forum.legato.io/u/mike.brearton)\
**Post date:** [April 26, 2023, 1:54am UTC](https://forum.legato.io/t/how-to-bundle-multiple-apps-in-a-single-file-with-no-system-image/6312/7 "2023-04-26T01:54:47Z")

</div>

Pros and cons to both.  
We can’t do single ADEF, because one of the “control” app is set to reboot-if-fail… last ditch attempt to recover. The other 3 send the “control” app heartbeats; they only have restartApp behaviour… and are optional… and etc…  
Pity. The rest of Legato is wonderfully architected, so this seems to be a rare oversight.
