Unfortunetly, sudo is needed to change virtual terminal before launching Kodi because, on the Raspberry Pi 4 only, it does not start if X (a desktop environment like LXDE) is running in the same virtual terminal Kodi is started. That is due to the GBM/DRM window rendering that Kodi needs to be compiled with for it to work on the Pi4. You can check the fixes in /usr/bin/kodi script. @gkreidl that is a different thing from the fixes needed in the past, launching from a virtual console won't work.
I think the best solution to avoid asking for sudo password if you set it, is to add a sudoers.d option for it, something like creating a file, for example /etc/sudoers.d/020_kodi with:
Code: Select all
Cmnd_Alias KODI_VT = /bin/fgconsole, /bin/chvt *
%video ALL = (root) NOPASSWD: KODI_VT
I think I am going to add it to the Kodi packages to do it automatically when it is installed. Also the drm udev rule needed.
If you find a better alternative to do this please tell me and I will add it.