systemd / systemd/systemd

we should probably initialize $HOME for system services without User= to the same value with User=root

Open
#10,915 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pid1 RFE 🎁
Dominant language
C
Stars
16.7k
Forks
4.7k
Avg merge
1d 6h
Merged PRs (30d)
140

Description

I made systemd unit which have ExexStart=script.sh
script.sh contains

#!bin/bash
printenv

Then I started my service and vie it's status
I see the output of printenv with all environment vars. But there was no HOME variable, for example? But why?

I think, that it have to work another way:
systemd starts scripts as root user. In the script first line is shebang and it follows us to re-run script, like bash script.sh. Before running script bash will set HOME variable.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported unit with ExecStart=script.sh and the script's printenv output, then read the service environment handling described by the issue. The change is complete when the expected HOME behavior for root services without User= is defined and covered by an appropriate systemd test.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, linux
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.