Hosting legato on Debian

If you want to install Legato and run the full framework on a PC that is running a pre-existing Linux distro intended for desktop or servers, the problem is that Legato tries to manage user accounts, cgroups, and SMACK settings. This could potentially interfere with your OS distro for several reasons. Linux isn’t designed to have multiple security modules (LSMs) running at the same time. So, if you have AppArmor or SELinux running, you’ll have to rebuild your kernel to enable SMACK instead, but chances are good that your distro is trying to use one of those other LSMs and will get confused when it becomes unavailable. Also, if your system is configuring cgroups, there’s a potential for a conflict with Legato. (Legato will add and remove user accounts and groups for apps, but it shouldn’t remove any of the users and groups you already have in place, so that part should actually be okay.)

The main parts that are problematic are the Supervisor, the “startLegato” program, and the Update Daemon. If you want to do some testing of Legato programs, you can do that by starting the Service Directory and Log Control Daemon and then you should be able to run programs built with mkexe, mkapp, or mksys with the ‘-t localhost’ option. But, you can’t start and stop whole apps, or create/destroy sandboxes, because the Supervisor implements that part. The Config Tree daemon works, but it tries to use the directory /legato/systems/current/config to store its data, and that probably doesn’t exist on your system. The Watchdog daemon and Update Daemon require APIs provided by the Supervisor, so they won’t work without the Supervisor.

We do use the Service Directory, Log Control Daemon, and Config Tree for automated testing of many features on “localhost”, though, so if that’s all you want to do, that should work just fine.

@CoRfr, I’m definitely very interested in that documentation on the ‘virt’ target. :wink:

I haven’t tried it, but it seems to me that it should be possible to set up your own Linux distro (using the Yocto Project) for a PC, but as @CoRfr said, it’s not going to be easy. You’d need to

  • ensure that your kernel has cgroups and SMACK enabled
  • have at least one writeable file system partition, accessible through /mnt/flash (it doesn’t have to actually be a flash file system, though)
  • mount smackfs at /legato/smack
  • copy build/localhost/system/staging to /legato/systems/current/bin (as root)
  • for each app folder under build/localhost/system/app, (as root)
    • copy the app’s ‘staging’ folder contents to /legato/apps/, where is the app.MD5 value from the info.properties file inside the app’s staging directory.
  • create a file /legato/systems/current/status containing just the word “good”
  • set the security.SMACK64EXEC label of the supervisor

Then, to start it up, just run /legato/systems/current/bin/supervisor (as root).

…But, as I said, I haven’t tried it, so there could be something I missed.

(And, for those who aren’t already watching it, see also: http://forum.legato.io/t/legato-on-generic-linux)