Problem sandboxing bluetoothServices

I want to add bluetooth to an existing app and am using bluetoothServices as a starting point. As downloaded it is unsandboxed. I can change it to sandboxed and add the following to .adef to get the libraries:

requires:
{
	dir:
	{
		/lib                 /lib
		/usr/lib          /usr/lib
	}
}

However startup fails with this message. Any ideas on what needs to be done? Thanks.

Jul 23 16:07:16 swi-mdm9x28-wp user.err Legato: =ERR= | bluetoothServices[11233] | bluetoothServices: error while loading shared libraries: libComponent_bluetoothServicesComponent.so: cannot open shared object file: No such file or directory

probably it cannot find the following library:

lib:
{
    // pkg-config --libs glib-2.0 gio-2.0 gio-unix-2.0
    gio-2.0
    gobject-2.0
    glib-2.0
}

In fact before I added the “requires” section quoted above I would get a message about a missing libgio:

Jul 24 10:04:53 swi-mdm9x28-wp user.err Legato: =ERR= | bluetoothServices[2518] | bluetoothServices: error while loading shared libraries: libgio-2.0.so.0: cannot open shared object file: No such file or directory

After adding the “requires” section that goes away and I now get the strange message about libComponent_bluetoothServicesComponent.so.

Do you mean if unsandboxed for the bluetoothservice, everything is fine?
Any reason you need to sandbox it?

Do you find the libComponent_bluetoothServicesComponent.so in your platform when unsandboxed?

It’s OK unsandboxed. That is the original download.

I am adding bluetooth functions to an existing sandboxed application. If I make the new application unsandboxed it will run but I have to make changes to directory names because the actual directories have to be used. I would prefer to run the new application sandboxed for this reason, also I think an unsandoxed application is a greater security risk.

You should not import the whole “dir”, otherwise you will overwrite other library.

Instead, you can do the following in bluetoothServices.adef:


requires:
{
dir:
{

//	/lib  /lib
	/usr/lib          /usr/lib


}

file:
{

/lib/libBrokenLocale-2.27.so /lib/
/lib/libBrokenLocale.so.1 /lib/
/lib/libanl-2.27.so /lib/
/lib/libanl.so.1 /lib/
/lib/libattr.so.1 /lib/
/lib/libattr.so.1.1.0 /lib/
/lib/libblkid.so.1 /lib/
/lib/libblkid.so.1.1.0 /lib/
/lib/libc-2.27.so /lib/
/lib/libc.so.6 /lib/
/lib/libcap.so.2 /lib/
/lib/libcap.so.2.25 /lib/
/lib/libcrypt-2.27.so /lib/
/lib/libcrypt.so.1 /lib/
/lib/libdl-2.27.so /lib/
/lib/libdl.so.2 /lib/
/lib/libgcc_s.so.1 /lib/
/lib/libm-2.27.so /lib/
/lib/libm.so.6 /lib/
/lib/libmount.so.1 /lib/
/lib/libmount.so.1.1.0 /lib/
/lib/libncurses.so.5 /lib/
/lib/libncurses.so.5.9 /lib/
/lib/libnsl-2.27.so /lib/
/lib/libnsl.so.1 /lib/
/lib/libnss_compat-2.27.so /lib/
/lib/libnss_compat.so.2 /lib/
/lib/libnss_dns-2.27.so /lib/
/lib/libnss_dns.so.2 /lib/
/lib/libnss_files-2.27.so /lib/
/lib/libnss_files.so.2 /lib/
/lib/libpthread-2.27.so /lib/
/lib/libpthread.so.0 /lib/
/lib/libresolv-2.27.so /lib/
/lib/libresolv.so.2 /lib/
/lib/librt-2.27.so /lib/
/lib/librt.so.1 /lib/
/lib/libtinfo.so.5 /lib/
/lib/libtinfo.so.5.9 /lib/
/lib/libudev.so.1 /lib/
/lib/libudev.so.1.6.3 /lib/
/lib/libutil-2.27.so /lib/
/lib/libutil.so.1 /lib/
/lib/libuuid.so.1 /lib/
/lib/libuuid.so.1.3.0 /lib/
/lib/libz.so.1 /lib/
/lib/libz.so.1.2.11 /lib/

}

}


Thanks for the suggestion. Using the “requires” section above and building bluetoothServices allows it to run sandboxed without any library problem. However bluetooth does not work, I think due to a permission issue. I tried updating /etc/dbus-1/system.d/bluetooth.conf to give appBluetoothServices access but it appears this does not work. Perhaps a SMACK permission issue?

probably you need to check logread and see if this is SMACK issue. I cannot test for you as I am using MangOH red board.