How can I run systemd as a process with pid 1 and with pid not 1?
Manpage of systemd
says:
--system, --user
For --system, tell systemd to run a system instance, even if the
process ID is not 1, i.e. systemd is not run as init process.
--user does the opposite, running a user instance even if the
process ID is 1.
How can I run systemd as a process with pid 1 and with pid not 1?
What does a system instance with pid not 1 mean? Can it coexist with a system instance with pid 1?
Does a system instance mean a process whose euid/ruid is root?
Does a user instance mean a process whose euid/ruid is nonroot?
Thanks.
systemd
add a comment |
Manpage of systemd
says:
--system, --user
For --system, tell systemd to run a system instance, even if the
process ID is not 1, i.e. systemd is not run as init process.
--user does the opposite, running a user instance even if the
process ID is 1.
How can I run systemd as a process with pid 1 and with pid not 1?
What does a system instance with pid not 1 mean? Can it coexist with a system instance with pid 1?
Does a system instance mean a process whose euid/ruid is root?
Does a user instance mean a process whose euid/ruid is nonroot?
Thanks.
systemd
add a comment |
Manpage of systemd
says:
--system, --user
For --system, tell systemd to run a system instance, even if the
process ID is not 1, i.e. systemd is not run as init process.
--user does the opposite, running a user instance even if the
process ID is 1.
How can I run systemd as a process with pid 1 and with pid not 1?
What does a system instance with pid not 1 mean? Can it coexist with a system instance with pid 1?
Does a system instance mean a process whose euid/ruid is root?
Does a user instance mean a process whose euid/ruid is nonroot?
Thanks.
systemd
Manpage of systemd
says:
--system, --user
For --system, tell systemd to run a system instance, even if the
process ID is not 1, i.e. systemd is not run as init process.
--user does the opposite, running a user instance even if the
process ID is 1.
How can I run systemd as a process with pid 1 and with pid not 1?
What does a system instance with pid not 1 mean? Can it coexist with a system instance with pid 1?
Does a system instance mean a process whose euid/ruid is root?
Does a user instance mean a process whose euid/ruid is nonroot?
Thanks.
systemd
systemd
asked Dec 19 '18 at 23:30
Tim
26k74246455
26k74246455
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
For starters
In UNIX systems (including Linux), all processes have a process identifier, or PID. This is a number used to refer to the process while it runs. Normally, it is not possible to predict which PID a process will have.
However, there is one special process that always has PID 1: The init process, which is the first process launched on the system during boot. In addition to launching all the important background processes, it has several other purposes/tasks.
systemd is one of several possible programs that can run as process 1. However, it has an additional feature where it can also run in a "per-user mode", managing the background processes required for that specific user (e.g., connection to a smartphone -- this requires a special server on Linux). Normally, it can tell what it is supposed to do from its PID. These command line switches allow you to override this.
For more information about why and how to do this, I recommend this page on the Arch Linux wiki. Despite Arch's reputation of being an elitist and difficult distribution, the documentation is very good and surprisingly accessible.
To answer your specific questions:
How can I run systemd as a process with pid 1 and with pid not 1?
To run systemd with PID 1, it must be your init program. Most Linux distributions make it possible to choose from several such services (others are SysV Init, Upstart, runit and OpenRC), but systemd is usually the default. Therefore, this probably already happens on your computer.
To run systemd with a PID other than 1, you simply run it under any other circumstance. Again, this likely already happens on your computer, as the mainstream distributions also use systemd in the aforementioned per-user mode. For some things you can do with that, see the Arch wiki page I linked above.
Does a system instance mean a process whose euid/ruid is root?
Does a user instance mean a process whose euid/ruid is nonroot?
The UID and EUID of the system instance will always be 0 (root), so that it can give the programs it launches all the required privileges. On Linux (and most UNIX systems), it is very common to start with full privileges and then relinquish all but those you actually need.
However, there might be at most one per-user instance of systemd that also has UID 0: Remember that root is just another user. While most modern-day Linux distributions take steps to prevent that by default, it is very well possible to log in as root.
A final word of caution
Do not, under any circumstance, experiment with systemd, logging in as root, or anything else that is startup or root related, on a computer you use for important work.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f490037%2fhow-can-i-run-systemd-as-a-process-with-pid-1-and-with-pid-not-1%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
For starters
In UNIX systems (including Linux), all processes have a process identifier, or PID. This is a number used to refer to the process while it runs. Normally, it is not possible to predict which PID a process will have.
However, there is one special process that always has PID 1: The init process, which is the first process launched on the system during boot. In addition to launching all the important background processes, it has several other purposes/tasks.
systemd is one of several possible programs that can run as process 1. However, it has an additional feature where it can also run in a "per-user mode", managing the background processes required for that specific user (e.g., connection to a smartphone -- this requires a special server on Linux). Normally, it can tell what it is supposed to do from its PID. These command line switches allow you to override this.
For more information about why and how to do this, I recommend this page on the Arch Linux wiki. Despite Arch's reputation of being an elitist and difficult distribution, the documentation is very good and surprisingly accessible.
To answer your specific questions:
How can I run systemd as a process with pid 1 and with pid not 1?
To run systemd with PID 1, it must be your init program. Most Linux distributions make it possible to choose from several such services (others are SysV Init, Upstart, runit and OpenRC), but systemd is usually the default. Therefore, this probably already happens on your computer.
To run systemd with a PID other than 1, you simply run it under any other circumstance. Again, this likely already happens on your computer, as the mainstream distributions also use systemd in the aforementioned per-user mode. For some things you can do with that, see the Arch wiki page I linked above.
Does a system instance mean a process whose euid/ruid is root?
Does a user instance mean a process whose euid/ruid is nonroot?
The UID and EUID of the system instance will always be 0 (root), so that it can give the programs it launches all the required privileges. On Linux (and most UNIX systems), it is very common to start with full privileges and then relinquish all but those you actually need.
However, there might be at most one per-user instance of systemd that also has UID 0: Remember that root is just another user. While most modern-day Linux distributions take steps to prevent that by default, it is very well possible to log in as root.
A final word of caution
Do not, under any circumstance, experiment with systemd, logging in as root, or anything else that is startup or root related, on a computer you use for important work.
add a comment |
For starters
In UNIX systems (including Linux), all processes have a process identifier, or PID. This is a number used to refer to the process while it runs. Normally, it is not possible to predict which PID a process will have.
However, there is one special process that always has PID 1: The init process, which is the first process launched on the system during boot. In addition to launching all the important background processes, it has several other purposes/tasks.
systemd is one of several possible programs that can run as process 1. However, it has an additional feature where it can also run in a "per-user mode", managing the background processes required for that specific user (e.g., connection to a smartphone -- this requires a special server on Linux). Normally, it can tell what it is supposed to do from its PID. These command line switches allow you to override this.
For more information about why and how to do this, I recommend this page on the Arch Linux wiki. Despite Arch's reputation of being an elitist and difficult distribution, the documentation is very good and surprisingly accessible.
To answer your specific questions:
How can I run systemd as a process with pid 1 and with pid not 1?
To run systemd with PID 1, it must be your init program. Most Linux distributions make it possible to choose from several such services (others are SysV Init, Upstart, runit and OpenRC), but systemd is usually the default. Therefore, this probably already happens on your computer.
To run systemd with a PID other than 1, you simply run it under any other circumstance. Again, this likely already happens on your computer, as the mainstream distributions also use systemd in the aforementioned per-user mode. For some things you can do with that, see the Arch wiki page I linked above.
Does a system instance mean a process whose euid/ruid is root?
Does a user instance mean a process whose euid/ruid is nonroot?
The UID and EUID of the system instance will always be 0 (root), so that it can give the programs it launches all the required privileges. On Linux (and most UNIX systems), it is very common to start with full privileges and then relinquish all but those you actually need.
However, there might be at most one per-user instance of systemd that also has UID 0: Remember that root is just another user. While most modern-day Linux distributions take steps to prevent that by default, it is very well possible to log in as root.
A final word of caution
Do not, under any circumstance, experiment with systemd, logging in as root, or anything else that is startup or root related, on a computer you use for important work.
add a comment |
For starters
In UNIX systems (including Linux), all processes have a process identifier, or PID. This is a number used to refer to the process while it runs. Normally, it is not possible to predict which PID a process will have.
However, there is one special process that always has PID 1: The init process, which is the first process launched on the system during boot. In addition to launching all the important background processes, it has several other purposes/tasks.
systemd is one of several possible programs that can run as process 1. However, it has an additional feature where it can also run in a "per-user mode", managing the background processes required for that specific user (e.g., connection to a smartphone -- this requires a special server on Linux). Normally, it can tell what it is supposed to do from its PID. These command line switches allow you to override this.
For more information about why and how to do this, I recommend this page on the Arch Linux wiki. Despite Arch's reputation of being an elitist and difficult distribution, the documentation is very good and surprisingly accessible.
To answer your specific questions:
How can I run systemd as a process with pid 1 and with pid not 1?
To run systemd with PID 1, it must be your init program. Most Linux distributions make it possible to choose from several such services (others are SysV Init, Upstart, runit and OpenRC), but systemd is usually the default. Therefore, this probably already happens on your computer.
To run systemd with a PID other than 1, you simply run it under any other circumstance. Again, this likely already happens on your computer, as the mainstream distributions also use systemd in the aforementioned per-user mode. For some things you can do with that, see the Arch wiki page I linked above.
Does a system instance mean a process whose euid/ruid is root?
Does a user instance mean a process whose euid/ruid is nonroot?
The UID and EUID of the system instance will always be 0 (root), so that it can give the programs it launches all the required privileges. On Linux (and most UNIX systems), it is very common to start with full privileges and then relinquish all but those you actually need.
However, there might be at most one per-user instance of systemd that also has UID 0: Remember that root is just another user. While most modern-day Linux distributions take steps to prevent that by default, it is very well possible to log in as root.
A final word of caution
Do not, under any circumstance, experiment with systemd, logging in as root, or anything else that is startup or root related, on a computer you use for important work.
For starters
In UNIX systems (including Linux), all processes have a process identifier, or PID. This is a number used to refer to the process while it runs. Normally, it is not possible to predict which PID a process will have.
However, there is one special process that always has PID 1: The init process, which is the first process launched on the system during boot. In addition to launching all the important background processes, it has several other purposes/tasks.
systemd is one of several possible programs that can run as process 1. However, it has an additional feature where it can also run in a "per-user mode", managing the background processes required for that specific user (e.g., connection to a smartphone -- this requires a special server on Linux). Normally, it can tell what it is supposed to do from its PID. These command line switches allow you to override this.
For more information about why and how to do this, I recommend this page on the Arch Linux wiki. Despite Arch's reputation of being an elitist and difficult distribution, the documentation is very good and surprisingly accessible.
To answer your specific questions:
How can I run systemd as a process with pid 1 and with pid not 1?
To run systemd with PID 1, it must be your init program. Most Linux distributions make it possible to choose from several such services (others are SysV Init, Upstart, runit and OpenRC), but systemd is usually the default. Therefore, this probably already happens on your computer.
To run systemd with a PID other than 1, you simply run it under any other circumstance. Again, this likely already happens on your computer, as the mainstream distributions also use systemd in the aforementioned per-user mode. For some things you can do with that, see the Arch wiki page I linked above.
Does a system instance mean a process whose euid/ruid is root?
Does a user instance mean a process whose euid/ruid is nonroot?
The UID and EUID of the system instance will always be 0 (root), so that it can give the programs it launches all the required privileges. On Linux (and most UNIX systems), it is very common to start with full privileges and then relinquish all but those you actually need.
However, there might be at most one per-user instance of systemd that also has UID 0: Remember that root is just another user. While most modern-day Linux distributions take steps to prevent that by default, it is very well possible to log in as root.
A final word of caution
Do not, under any circumstance, experiment with systemd, logging in as root, or anything else that is startup or root related, on a computer you use for important work.
answered Dec 20 '18 at 0:18
fNek
1215
1215
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f490037%2fhow-can-i-run-systemd-as-a-process-with-pid-1-and-with-pid-not-1%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown