Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
3d1e40ea
Commit
3d1e40ea
authored
Dec 08, 2020
by
Chris Kim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle the case when systemd lives under `/init.scope`
Signed-off-by:
Chris Kim
<
oats87g@gmail.com
>
parent
e71e11fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
agent.go
pkg/daemons/agent/agent.go
+2
-1
No files found.
pkg/daemons/agent/agent.go
View file @
3d1e40ea
...
@@ -200,6 +200,7 @@ func checkCgroups() (root string, hasCFS bool, hasPIDs bool) {
...
@@ -200,6 +200,7 @@ func checkCgroups() (root string, hasCFS bool, hasPIDs bool) {
// Examine process ID 1 to see if there is a cgroup assigned to it.
// Examine process ID 1 to see if there is a cgroup assigned to it.
// When we are not in a container, process 1 is likely to be systemd or some other service manager.
// When we are not in a container, process 1 is likely to be systemd or some other service manager.
// It either lives at `/` or `/init.scope` according to https://man7.org/linux/man-pages/man7/systemd.special.7.html
// When containerized, process 1 will be generally be in a cgroup, otherwise, we may be running in
// When containerized, process 1 will be generally be in a cgroup, otherwise, we may be running in
// a host PID scenario but we don't support this.
// a host PID scenario but we don't support this.
g
,
err
:=
os
.
Open
(
"/proc/1/cgroup"
)
g
,
err
:=
os
.
Open
(
"/proc/1/cgroup"
)
...
@@ -218,7 +219,7 @@ func checkCgroups() (root string, hasCFS bool, hasPIDs bool) {
...
@@ -218,7 +219,7 @@ func checkCgroups() (root string, hasCFS bool, hasPIDs bool) {
for
_
,
system
:=
range
systems
{
for
_
,
system
:=
range
systems
{
if
system
==
"name=systemd"
{
if
system
==
"name=systemd"
{
last
:=
parts
[
len
(
parts
)
-
1
]
last
:=
parts
[
len
(
parts
)
-
1
]
if
last
!=
"/"
{
if
last
!=
"/"
&&
last
!=
"/init.scope"
{
root
=
"/systemd"
root
=
"/systemd"
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment