Skip to content

Termux widget presumably does not start background processes #142

@freebrowser1

Description

@freebrowser1

Problem description
Starting a novnc daemon (https://github.com/novnc/noVNC) to act as a server for web VNC works flawlessly when started from Termux itself, but not in a Termux widget task.
In a terminal it shows output :

 /data/data/com.termux/files/home/novnc/utils/novnc_proxy --vnc localhost:5901
Warning: could not find self.pem
Using local websockify at /data/data/com.termux/files/home/novnc/utils/websockify/run
Starting webserver and WebSockets proxy on port 6080
/data/data/com.termux/files/home/novnc/utils/websockify/websockify/websocket.py:31: UserWarning: no 'numpy' module, HyBi protocol will be slower
  warnings.warn("no 'numpy' module, HyBi protocol will be slower")
WebSocket server settings:
  - Listen on :6080
  - Web server. Web root: /data/data/com.termux/files/home/novnc
  - No SSL/TLS support (no cert file)
  - proxying from :6080 to localhost:5901


Navigate to this URL:

    http://localhost:6080/vnc.html?host=localhost&port=6080

Press Ctrl-C to exit

and indeed works as a web frontend for a VNC server on port 5901.

Steps to reproduce
Create a script in .shortcuts/tasks/novnc.sh which is supposed to be for background processes according to https://github.com/termux/termux-widget?tab=readme-ov-file#Creating-And-Modifying-Scripts and make it executable.

  • Contents
termux-fix-shebang 
PREFIX=/data/data/com.termux/files/usr
cd /data/data/com.termux/files/home
/data/data/com.termux/files/home/novnc/utils/novnc_proxy --vnc localhost:5901
  • Refresh the termux-widget and click on tasks/novnc.sh.

Expected behavior
Background process should run, the ps -ef should show something like python3 -m websockify --web /data/data/com.termux/files/home/novnc 6080 localhost:5901, just like it were started from terminal.

Additional information
No python3 process is started. I tried with an & behind it and with nohup before it and an & behind, indeed logging to nohup.out. However, doing the same in the widget script does not result in any running process or nohup.out.
Here the logcat output for this script.

06-02 16:18:55.998 19830 19830 W m.termux.widget: type=1400 audit(0.0:135589): avc:  granted  { execute } for  name="novnc.sh" dev="dm-60" ino=409659 scontext=u:r:untrusted_app_27:s0:c22>
06-02 16:18:55.998 19830 19830 W m.termux.widget: type=1400 audit(0.0:135590): avc:  granted  { execute } for  name="novnc.sh" dev="dm-60" ino=409659 scontext=u:r:untrusted_app_27:s0:c22>
06-02 16:18:56.028 19830 19830 D VRI[Toast]: hardware acceleration = true, forceHwAccelerated = false
06-02 16:18:56.030 21175 21175 W com.termux: type=1400 audit(0.0:135591): avc:  granted  { execute } for  name="novnc.sh" dev="dm-60" ino=409659 scontext=u:r:untrusted_app_27:s0:c229,c25>
06-02 16:18:56.030 21175 21175 W com.termux: type=1400 audit(0.0:135592): avc:  granted  { execute_no_trans } for  path="/data/data/com.termux/files/home/.shortcuts/tasks/novnc.sh" dev=">
06-02 16:18:56.030 21175 21175 W com.termux: type=1400 audit(0.0:135593): avc:  granted  { execute } for  name="bash" dev="dm-60" ino=361039 scontext=u:r:untrusted_app_27:s0:c229,c256,c5>
06-02 16:18:56.030 21175 21175 W novnc.sh: type=1400 audit(0.0:135594): avc:  granted  { execute } for  path="/data/data/com.termux/files/usr/bin/bash" dev="dm-60" ino=361039 scontext=u:>
06-02 16:18:56.036 19830 19830 D InputTransport: Create ARC handle: 0x772068a490
06-02 16:18:56.036 19830 19830 D InputEventReceiver: Input log is disabled in InputEventReceiver.
06-02 16:18:56.036 19830 19830 D InputTransport: Input log is disabled in InputChannel.
06-02 16:18:56.034 21175 21175 I novnc.sh: type=1400 audit(0.0:135595): avc:  denied  { search } for  name="tests" dev="dm-60" ino=106 scontext=u:r:untrusted_app_27:s0:c229,c256,c512,c76>
  • Termux application version: 0.118.2
  • Android OS version: 14
  • Device model: Nothing 2a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions