Hue service does not start after a fresh installation or upgrade

Condition

Hue service fails during startup with the following error after a fresh installation or after performing an upgrade:
File "/cs/cloudera/opt/cloudera/parcels/CDH-7.1.8-1.cdh7.1.8.p0.30990532/lib/hue/build/env/lib/python3.8/site-packages/gunicorn/util.py", line 173, in chown
    os.chown(path, uid, gid)
PermissionError: [Errno 1] Operation not permitted: '/tmp/wgunicorn-qfm_jlch'

Cause

This happens because the Hue process user and group specified in the Hue configuration in Cloudera Manager are different than the default information present in the hue.ini file.

Solution

  1. Log in to Cloudera Manager as an Administrator.
  2. Go to Clusters > Hue > Configuration > Hue Service Advanced Configuration Snippet (Safety Valve) for hue_safety_valve.ini and update the values of server_user and server_group properties as follows:
    [desktop]
    server_user=[***CUSTOM-HUE-USER***]
    server_group=[***CUSTOM-HUE-GROUP***]
  3. Click Save Changes.
  4. Restart the Hue service.