According I test by systemctl. It didn't export $USER when start service.

```
[Unit]
Description=test
After=network.target

[Service]
ExecStart=/bin/env
ExecStop=/bin/env

[Install]
WantedBy=multi-user.target
```

```
$ systemctl status test.service
Mar 19 01:45:24 localhost env[25754]: LANG=en_SG.UTF-8
Mar 19 01:45:24 localhost env[25754]:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
```

One possible way is add User and Group in service
```
[Unit]
Description=test
After=network.target

[Service]
ExecStart=/bin/env
ExecStop=/bin/env
User=root
Group=root

[Install]
WantedBy=multi-user.target
```

So that you could see
```
$ systemctl status test.service
Mar 19 01:44:24 localhost env[25720]: HOME=/root
Mar 19 01:44:24 localhost env[25720]: LOGNAME=root
Mar 19 01:44:24 localhost env[25720]: USER=root
Mar 19 01:44:24 localhost env[25720]: SHELL=/bin/sh
```

On Sat, Mar 19, 2016 at 1:26 AM, Steven Schlansker <
[email protected]> wrote:

> We are seeing the same thing, using Mesosphere .debs on Ubuntu:
>
> mesos-master.mesos1-qa-sf.invalid-user.log.WARNING.20160209-221625.12071
> mesos-master.mesos1-qa-sf.invalid-user.log.WARNING.20160223-211310.1456
> mesos-master.mesos1-qa-sf.invalid-user.log.WARNING.20160223-211857.5347
>
> What if the fallback was to using getpwuid(getuid()) or the like instead
> of "invalid-user" ?
>
>
> > On Mar 18, 2016, at 9:58 AM, Peter Steele <[email protected]> wrote:
> >
> > In my case I am using the CentOS 7 set of rpms  from mesosphere...
> >
> > On 03/18/2016 09:14 AM, Pradeep Chhetri wrote:
> >> I installed mesos using mesosphere debian repository.
> >>
> >> On Fri, Mar 18, 2016 at 4:10 PM, haosdent <[email protected]> wrote:
> >> cool, you install mesos by deb or build it from source directly?
> >>
> >> On Mar 19, 2016 12:06 AM, "Pradeep Chhetri" <
> [email protected]> wrote:
> >> I think it is an upstart issue. I am noticing this issue in Ubuntu
> 14.04 which uses upstart. This is what i can debug so far:
> >>
> >>
> >> According to this documentation:
> http://upstart.ubuntu.com/cookbook/#job-environment
> >>
> >> When Upstart runs a job, it provides it with a very restrictive
> environment which contains just two system variables:
> >>
> >>      • TERM
> >>      • PATH
> >>
> >> These are the exact two variables i can notice in proc filesystem set
> as well.
> >>
> >> I will post if i find something more.
> >>
> >>
> >> On Fri, Mar 18, 2016 at 2:54 PM, Peter Steele <[email protected]>
> wrote:
> >> Yes, I see that as well. Also the case for the mesos master. That
> explains the invalid-user, but why isn't these processes picking up $USER?
> >>
> >>
> >> On 03/18/2016 07:31 AM, Pradeep Chhetri wrote:
> >>> I can see that USER environment variable is not set for mesos-slave
> process from /proc/<pid>/environ.
> >>>
> >>> On Fri, Mar 18, 2016 at 2:19 PM, Pradeep Chhetri <
> [email protected]> wrote:
> >>> My mesos cluster also produces logs like
> mesos-slave.ip-172-31-45-33.invalid-user.log.ERROR. I guess log file name
> shouldnt affect you all because generally you ship these logs in some
> centralized logging system like logstash/splunk and search there by tags
> >>>
> >>> On Fri, Mar 18, 2016 at 1:46 PM, Peter Steele <[email protected]>
> wrote:
> >>> What would you suggest to troubleshoot this? Clear something isn't
> quite right if my log files are called "invalid-user". That said, I have
> managed to get a containerized application up and running so whatever is
> wrong isn't fatal. Just ugly...
> >>>
> >>>
> >>> On 03/17/2016 10:42 AM, haosdent wrote:
> >>>> Not sure why glog could not get USER environment variable correctly
> after looking its code. But should not affect you running mesos.
> >>>>
> >>>> On Fri, Mar 18, 2016 at 1:11 AM, haosdent <[email protected]> wrote:
> >>>> root should be fine.
> >>>>
> >>>> On Fri, Mar 18, 2016 at 12:53 AM, Peter Steele <[email protected]>
> wrote:
> >>>> My USER var is root. Do I need to create a non-root user for mesos to
> run under?
> >>>>
> >>>>
> >>>> On 03/17/2016 09:22 AM, haosdent wrote:
> >>>>> glog get the user name by environment variable "USER" in Linux.
> https://github.com/google/glog/blob/master/src/utilities.cc#L290-L302 I
> think you could check the environment variable "USER" before you start
> Mesos slave.
> >>>>>
> >>>>> On Fri, Mar 18, 2016 at 12:19 AM, haosdent <[email protected]>
> wrote:
> >>>>> invalid-user is from glog
> https://github.com/google/glog/blob/master/src/logging.cc#L1036
> >>>>>
> >>>>> >W0317 06:26:41.178268   915 authenticator.cpp:511] No credentials
> provided, authentication requests will be refused
> >>>>> >which I'm thinking might be related. What am I missing?
> >>>>>
> >>>>> I think should not related. This is a warning message if you don't
> pass `credentials` flag when start mesos master.
> >>>>>
> >>>>> On Thu, Mar 17, 2016 at 10:07 PM, Peter Steele <[email protected]>
> wrote:
> >>>>> I'm testing out mesos for the first time and after installing the
> software I'm seeing numerous log files of the form
> >>>>>
> >>>>> mesos-slave.<host>.invalid-user.log.INFO.20160317-062640.918
> >>>>>
> >>>>> I don't see any errors in the logs themselves, but the fact that
> "invalid-user" is part of the name makes me think I'm missing something in
> my config. The mesos-master.WARNING log has the message
> >>>>>
> >>>>> W0317 06:26:41.178268   915 authenticator.cpp:511] No credentials
> provided, authentication requests will be refused
> >>>>>
> >>>>> which I'm thinking might be related. What am I missing?
> >>>>>
> >>>>> Peter
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> Best Regards,
> >>>>> Haosdent Huang
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> Best Regards,
> >>>>> Haosdent Huang
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Best Regards,
> >>>> Haosdent Huang
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Best Regards,
> >>>> Haosdent Huang
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> Regards,
> >>> Pradeep Chhetri
> >>>
> >>>
> >>>
> >>> --
> >>> Regards,
> >>> Pradeep Chhetri
> >>
> >>
> >>
> >>
> >> --
> >> Regards,
> >> Pradeep Chhetri
> >>
> >>
> >>
> >> --
> >> Regards,
> >> Pradeep Chhetri
> >
>
>


-- 
Best Regards,
Haosdent Huang

Reply via email to