[OE-core] Yocto systemd service have different enviornment than the root

JH jupiter.hce at gmail.com
Sat Feb 22 12:11:28 UTC 2020


Hi,

Where is the systemd service environment set from?

Here is the systemd service env:

SHLVL=1
JOURNAL_STREAM=8:30355
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
INVOCATION_ID=fbd7ba8782544a828902301423a98196
LANG=C
PWD=/

How can I set up systemd service to use the root environment set up by
/etc/profile? It is not neccesary to set up in my.service file, it can
set up in a shell script my.sh called by service file:

ExecStart=/usr/bin/my.sh


Here is the root environment I login to it, set up in /etc/profile:

# env
USER=root
SYSTEMD_PAGER=cat
SHLVL=1
LD_LIBRARY_PATH=/data/lib
HOME=/home/root
OLDPWD=/data
HUSHLOGIN=FALSE
PS1=\u@\h:\w\$
LOGNAME=root
TERM=xterm
PATH=/usr/local/bin:/usr/bin:/bin:/data/bin:/data/sbin:/usr/local/sbin:/usr/sbin:/sbin
LANG=C
HZ=100
SHELL=/bin/sh
PWD=/data/log
EDITOR=vi

Thank  you.

- jh


More information about the Openembedded-core mailing list