/etc/resolv.conf

I’ve updated to the latest firmware (R13) and rolled legato back to 19.11.2, all seems to be good there. Unfortunately, this seems to break something and means I can no longer have write access to /etc/resolv.conf, meaning I cannot set my nameserver. I’m not going to hardcore IP addresses in this, and I also do not want to unsandbox the application for security concerns. What are the alternatives?

.adef file looks like this

requires:{
dir:{
[rw] /etc/resolv.conf /etc/resolv.con
}
}

And this is the error

error: Cannot set access permission of: /etc/resolv.conf

The simple way is creating a unsandboxed app to do the job, your sandboxed app can communicate with the unsandboxed app by IPC.

BTW, can you just set like this ?
requires:
{
file:
{

    /etc/resolv.conf /etc/
  
}

}

I have also tried to build and run the app in unsandboxed mode. It will not compile and throws the same error.

After trying with your recommendation it will compile but not run. Logged is these lines:

Sep 24 12:30:22 swi-mdm9x28-wp user.err Legato: =ERR= | supervisor[15023]/supervisor T=main | app.c CreateDirLink() 1954 | '/etc/resolv.conf' is not a directory.

Sep 24 12:30:22 swi-mdm9x28-wp user.err Legato: =ERR= | supervisor[15023]/supervisor T=main | app.c CreateDirLink() 2013 | Failed to create link at '/etc/resolv.conf' in app 'data_app'.

When changed to:

requires:{
    	dir:{
    		/etc /etc
    		/sbin /sbin/
    		/home/root /home/root
    	}
}

The application compiled and ran, but would not open/write to the files. Logged these lines:

Sep 24 15:20:25 swi-mdm9x28-wp user.info Legato:  INFO | supervisor[1046]/supervisor T=main | app.c CreateDirLink() 2008 | Created directory link '/etc' to '/legato/systems/current/appsWriteable/data_app/etc'.
Sep 24 15:20:25 swi-mdm9x28-wp user.info Legato:  INFO | supervisor[1046]/supervisor T=main | app.c CreateDirLink() 2008 | Created directory link '/home/root' to '/legato/systems/current/appsWriteable/data_app/home/root'.
Sep 24 15:20:25 swi-mdm9x28-wp user.info Legato:  INFO | supervisor[1046]/supervisor T=main | app.c CreateDirLink() 2008 | Created directory link '/sbin' to '/legato/systems/current/appsWriteable/data_app/sbin'.
Sep 24 15:20:28 swi-mdm9x28-wp user.info Legato:  INFO | data_app[14392]/cellular T=main | cellular.c _cellular_COMPONENT_INIT() 255 | Could not set default gateway to: xxx.xx.xxx.xxx, command returned 32512
Sep 24 15:20:28 swi-mdm9x28-wp user.info Legato:  INFO | data_app[14392]/cellular T=main | cellular.c _cellular_COMPONENT_INIT() 264 | Could not open file

You should use
requires:
{
file:
{

Not directory…

Still fails, no matter what. Either fails to compile due to the inclusion of [rwx], throwing the “Cannot set access permissions of: …”
OR
if [rwx] is removed and preceeded by nothing, then the app fails to get proper permissions to access the file, and can’t read/write anything.

Found the problem.
The inclusion of

requires:{
	file:{
	}
}

in the .cdef file seemed to have some effect. Once removed from the .cdef file, and [rwx] was removed from the beginning of the files in the .adef, it allowed them to compile and run properly.
Unfortunately sandboxing still had to be disabled for this, but it’s working for now.

Good, at least it can be run