I could manage to have an useful output using strace. I basically did two tests:
- System start-up -> standalone application execution -> run the snap (this will work, as well as the afterwards calls)
- System start-up -> run the snap directly (fail, subsequent calls to the standalone app or the snap will also fail)
I examined the logs looking for any nvidia/cuda related information. At the beginning, both contain the same:
PID access("/sys/module/nvidia/version", F_OK) = -1 ENOENT (No such file or directory)
...
PID futex(0xb659a1d4, FUTEX_WAKE_PRIVATE, 2147483647) = 0
PID open("/dev/shm/cuda_injection_path_shm", O_RDWR|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
PID open("/home/ubuntu/snap/my-snap/x1/.nv/nvidia-application-profile-globals-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
PID open("/home/ubuntu/snap/my-snap/x1/.nv/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
PID open("/home/ubuntu/snap/my-snap/x1/.nv/nvidia-application-profiles-rc.d", O_RDONLY) = -1 ENOENT (No such file or directory)
PID open("/etc/nvidia/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
PID open("/etc/nvidia/nvidia-application-profiles-rc.d/", O_RDONLY) = -1 ENOENT (No such file or directory)
PID open("/usr/share/nvidia/nvidia-application-profiles-21.4-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
PID open("/usr/share/nvidia/nvidia-application-profiles-rc", O_RDONLY) = -1 ENOENT (No such file or directory)
PID geteuid32() = 1000
PID open("/tmp/nvidia-mps/control", O_WRONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
However, later, there’s a slight difference when accessing to the board:
Running the snap after executing the standalone application
5890 stat64("/usr/bin/nvidia-modprobe", 0xbeb00e80) = -1 ENOENT (No such file or directory)
5890 open("/proc/driver/nvidia/params", O_RDONLY) = -1 ENOENT (No such file or directory)
5890 stat64("/dev/nvidiactl", 0xbeb00d48) = -1 ENOENT (No such file or directory)
5890 mknod("/dev/nvidiactl", S_IFCHR|0666, makedev(195, 255)) = -1 EACCES (Permission denied)
5890 geteuid32() = 1000
5890 stat64("/usr/bin/nvidia-modprobe", 0xbeb00e80) = -1 ENOENT (No such file or directory)
5890 open("/dev/nvidiactl", O_RDWR|O_LARGEFILE) = -1 ENOENT (No such file or directory)
5890 open("/dev/nvhost-as-gpu", O_RDWR) = 11
5890 close(11) = 0
5890 open("/dev/nvmap", O_RDWR|O_DSYNC|O_CLOEXEC) = 11
5890 open("/dev/nvhost-as-gpu", O_RDWR|O_DSYNC) = 12
5890 ioctl(12, _IOC(_IOC_READ|_IOC_WRITE, 0x41, 0x2, 0x18), 0xbeb00fc0) = 0
5890 open("/dev/nvhost-prof-gpu", O_RDWR) = 13
5890 open("/sys/devices/platform/host1x/gk20a.0/ptimer_scale_factor", O_RDONLY) = 14
5890 fstat64(14, {st_dev=makedev(0, 11), st_ino=7356, st_mode=S_IFREG|0444, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=0, st_size=4096, st_atime=1529388093 /* 2018-06-19T15:01:33.222825993+0900 */, st_atime_nsec=222825993, st_mtime=1529388093 /* 2018-06-19T15:01:33.222825993+0900 */, st_mtime_nsec=222825993, st_ctime=1529388093 /* 2018-06-19T15:01:33.222825993+0900 */, st_ctime_nsec=222825993}) = 0
5890 read(14, "2.604166\n", 4096) = 9
5890 close(14) = 0
5890 sysinfo({uptime=241, loads=[28256, 19104, 8192], totalram=2034458624, freeram=1112154112, sharedram=0, bufferram=80490496, totalswap=0, freeswap=0, procs=186, totalhigh=1271922688, freehigh=485691392, mem_unit=1}) = 0
5890 ioctl(12, _IOC(_IOC_READ|_IOC_WRITE, 0x41, 0x2, 0x18), 0xbeb01030) = 0
5890 sysinfo({uptime=241, loads=[28256, 19104, 8192], totalram=2034458624, freeram=1112154112, sharedram=0, bufferram=80490496, totalswap=0, freeswap=0, procs=186, totalhigh=1271922688, freehigh=485691392, mem_unit=1}) = 0
5890 sysinfo({uptime=241, loads=[28256, 19104, 8192], totalram=2034458624, freeram=1112154112, sharedram=0, bufferram=80490496, totalswap=0, freeswap=0, procs=186, totalhigh=1271922688, freehigh=485691392, mem_unit=1}) = 0
5890 sysinfo({uptime=241, loads=[28256, 19104, 8192], totalram=2034458624, freeram=1112154112, sharedram=0, bufferram=80490496, totalswap=0, freeswap=0, procs=186, totalhigh=1271922688, freehigh=485691392, mem_unit=1}) = 0
5890 sysinfo({uptime=241, loads=[28256, 19104, 8192], totalram=2034458624, freeram=1112154112, sharedram=0, bufferram=80490496, totalswap=0, freeswap=0, procs=186, totalhigh=1271922688, freehigh=485691392, mem_unit=1}) = 0
5890 open("/sys/kernel/tegra_gpu/gpu_available_rates", O_RDONLY) = 14
From this point, there are some accesses more to /sys/kernel/tegra_gpu
. Those accesses are not seen in the next test.
Running the snap directly
1957 stat64("/usr/bin/nvidia-modprobe", 0xbee73e80) = -1 ENOENT (No such file or directory)
1957 open("/proc/driver/nvidia/params", O_RDONLY) = -1 ENOENT (No such file or directory)
1957 stat64("/dev/nvidiactl", 0xbee73d48) = -1 ENOENT (No such file or directory)
1957 mknod("/dev/nvidiactl", S_IFCHR|0666, makedev(195, 255)) = -1 EACCES (Permission denied)
1957 geteuid32() = 1000
1957 stat64("/usr/bin/nvidia-modprobe", 0xbee73e80) = -1 ENOENT (No such file or directory)
1957 open("/dev/nvidiactl", O_RDWR|O_LARGEFILE) = -1 ENOENT (No such file or directory)
1957 open("/dev/nvhost-as-gpu", O_RDWR) = 10
1957 close(10) = 0
1957 open("/dev/nvmap", O_RDWR|O_DSYNC|O_CLOEXEC) = 10
1957 open("/dev/nvhost-as-gpu", O_RDWR|O_DSYNC) = 12
1957 ioctl(12, _IOC(_IOC_READ|_IOC_WRITE, 0x41, 0x2, 0x18), 0xbee73fc0) = -1 ENOENT (No such file or directory)
1957 ioctl(12, _IOC(_IOC_READ|_IOC_WRITE, 0x41, 0x3, 0x10), 0xbee73f28) = -1 EINVAL (Invalid argument)
1957 close(10) = 0
1957 close(-1) = -1 EBADF (Bad file descriptor)
1957 close(12) = 0
As pointed before, there’s no access to /sys/kernel/tegra_gpu
. Also, /dev/nvhost-prof-gpu
and other devices don’t appear here.
Please, let me know if you need something else.