Help Center/ Huawei Cloud EulerOS/ FAQs/ How Do I Prevent the nohup Background Process from Being Killed After a VNC Session Ends?
Updated on 2026-04-02 GMT+08:00

How Do I Prevent the nohup Background Process from Being Killed After a VNC Session Ends?

Symptom

The nohup background process started in a VNC session is automatically killed by the system after the VNC session ends (for example, after you run exit to log out or a login times out).

Possible Cause

For security purposes, the upstream community modified the getty service and deleted KillMode=process. As a result, all processes are killed after the VNC login session ends. For details, see community submissions.

Solution

You can modify the getty settings to retain the nohup background process.

  1. Run vim /usr/lib/systemd/system/getty\@.service to modify the getty service unit.
  2. Add KillMode=process to the [Service] section, and save the file.

  3. Run systemctl daemon-reload to reload services.
  4. Run systemctl restart getty@`basename $(tty)` to restart the getty service.

    Restarting the getty service will exit the current session.