How to writes the log on the screen during shutdown and startup (after grub)
As we know, when we startup the system (after grub) and when we shutdown the system, many logs will be printed on screen.
I know that the kernel would write some logs of the kernel. But how about the others? Who writes them?
As I know, Ubuntu uses systemd
and there are some logs from systemd
. I want to know if it is possible that I could create a service of systemd
, which can write some logs on screen while starting up and shutting down?
systemd logs startup shutdown reboot
add a comment |
As we know, when we startup the system (after grub) and when we shutdown the system, many logs will be printed on screen.
I know that the kernel would write some logs of the kernel. But how about the others? Who writes them?
As I know, Ubuntu uses systemd
and there are some logs from systemd
. I want to know if it is possible that I could create a service of systemd
, which can write some logs on screen while starting up and shutting down?
systemd logs startup shutdown reboot
To me at least it is unclear what your intentions are with "creating a service of systemd. Yes, the kernel, systemd and other applications will write to the screen during the boot process.
– Tommiie
Jan 16 at 12:43
You might be looking at logs written by Plymouth, which is a boot splash manager in modern Linux distributions.
– filbranden
Jan 16 at 13:22
@Tommiie I simply want to know how to write a log message with my own service or process while startup and shutdown.
– Yves
Jan 17 at 1:22
@Yves : that is a completely different question than “who writes to the screen during startup”
– Tommiie
Jan 17 at 5:49
add a comment |
As we know, when we startup the system (after grub) and when we shutdown the system, many logs will be printed on screen.
I know that the kernel would write some logs of the kernel. But how about the others? Who writes them?
As I know, Ubuntu uses systemd
and there are some logs from systemd
. I want to know if it is possible that I could create a service of systemd
, which can write some logs on screen while starting up and shutting down?
systemd logs startup shutdown reboot
As we know, when we startup the system (after grub) and when we shutdown the system, many logs will be printed on screen.
I know that the kernel would write some logs of the kernel. But how about the others? Who writes them?
As I know, Ubuntu uses systemd
and there are some logs from systemd
. I want to know if it is possible that I could create a service of systemd
, which can write some logs on screen while starting up and shutting down?
systemd logs startup shutdown reboot
systemd logs startup shutdown reboot
edited 22 secs ago
Yves
asked Jan 16 at 11:51
YvesYves
870618
870618
To me at least it is unclear what your intentions are with "creating a service of systemd. Yes, the kernel, systemd and other applications will write to the screen during the boot process.
– Tommiie
Jan 16 at 12:43
You might be looking at logs written by Plymouth, which is a boot splash manager in modern Linux distributions.
– filbranden
Jan 16 at 13:22
@Tommiie I simply want to know how to write a log message with my own service or process while startup and shutdown.
– Yves
Jan 17 at 1:22
@Yves : that is a completely different question than “who writes to the screen during startup”
– Tommiie
Jan 17 at 5:49
add a comment |
To me at least it is unclear what your intentions are with "creating a service of systemd. Yes, the kernel, systemd and other applications will write to the screen during the boot process.
– Tommiie
Jan 16 at 12:43
You might be looking at logs written by Plymouth, which is a boot splash manager in modern Linux distributions.
– filbranden
Jan 16 at 13:22
@Tommiie I simply want to know how to write a log message with my own service or process while startup and shutdown.
– Yves
Jan 17 at 1:22
@Yves : that is a completely different question than “who writes to the screen during startup”
– Tommiie
Jan 17 at 5:49
To me at least it is unclear what your intentions are with "creating a service of systemd. Yes, the kernel, systemd and other applications will write to the screen during the boot process.
– Tommiie
Jan 16 at 12:43
To me at least it is unclear what your intentions are with "creating a service of systemd. Yes, the kernel, systemd and other applications will write to the screen during the boot process.
– Tommiie
Jan 16 at 12:43
You might be looking at logs written by Plymouth, which is a boot splash manager in modern Linux distributions.
– filbranden
Jan 16 at 13:22
You might be looking at logs written by Plymouth, which is a boot splash manager in modern Linux distributions.
– filbranden
Jan 16 at 13:22
@Tommiie I simply want to know how to write a log message with my own service or process while startup and shutdown.
– Yves
Jan 17 at 1:22
@Tommiie I simply want to know how to write a log message with my own service or process while startup and shutdown.
– Yves
Jan 17 at 1:22
@Yves : that is a completely different question than “who writes to the screen during startup”
– Tommiie
Jan 17 at 5:49
@Yves : that is a completely different question than “who writes to the screen during startup”
– Tommiie
Jan 17 at 5:49
add a comment |
1 Answer
1
active
oldest
votes
Can analyze the reboot system call source code, maybe the answer is there.
PATH: linux-4.4.1/kernel/reboot.c
280 SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
281 void __user *, arg)
282 {
....
315 switch (cmd) {
316 case LINUX_REBOOT_CMD_RESTART:
....
333 case LINUX_REBOOT_CMD_POWER_OFF:
334 kernel_power_off();
335 do_exit(0);
336 break;
....
257 void kernel_power_off(void)
258 {
259 kernel_shutdown_prepare(SYSTEM_POWER_OFF);
260 if (pm_power_off_prepare)
261 pm_power_off_prepare();
262 migrate_to_reboot_cpu();
263 syscore_shutdown();
264 pr_emerg("Power downn");
265 kmsg_dump(KMSG_DUMP_POWEROFF);
266 machine_power_off();
267 }
New contributor
Before kernel doing its shutdown, we can see many log have been printed on the screen. So this shouldn't have business with the kernel.
– Yves
Jan 17 at 8:50
The kernel outputs some information before the real shutdown. 265 kmsg_dump(KMSG_DUMP_POWEROFF); 266 machine_power_off();
– wzq
Jan 17 at 13:35
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%2f494800%2fhow-to-writes-the-log-on-the-screen-during-shutdown-and-startup-after-grub%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
Can analyze the reboot system call source code, maybe the answer is there.
PATH: linux-4.4.1/kernel/reboot.c
280 SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
281 void __user *, arg)
282 {
....
315 switch (cmd) {
316 case LINUX_REBOOT_CMD_RESTART:
....
333 case LINUX_REBOOT_CMD_POWER_OFF:
334 kernel_power_off();
335 do_exit(0);
336 break;
....
257 void kernel_power_off(void)
258 {
259 kernel_shutdown_prepare(SYSTEM_POWER_OFF);
260 if (pm_power_off_prepare)
261 pm_power_off_prepare();
262 migrate_to_reboot_cpu();
263 syscore_shutdown();
264 pr_emerg("Power downn");
265 kmsg_dump(KMSG_DUMP_POWEROFF);
266 machine_power_off();
267 }
New contributor
Before kernel doing its shutdown, we can see many log have been printed on the screen. So this shouldn't have business with the kernel.
– Yves
Jan 17 at 8:50
The kernel outputs some information before the real shutdown. 265 kmsg_dump(KMSG_DUMP_POWEROFF); 266 machine_power_off();
– wzq
Jan 17 at 13:35
add a comment |
Can analyze the reboot system call source code, maybe the answer is there.
PATH: linux-4.4.1/kernel/reboot.c
280 SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
281 void __user *, arg)
282 {
....
315 switch (cmd) {
316 case LINUX_REBOOT_CMD_RESTART:
....
333 case LINUX_REBOOT_CMD_POWER_OFF:
334 kernel_power_off();
335 do_exit(0);
336 break;
....
257 void kernel_power_off(void)
258 {
259 kernel_shutdown_prepare(SYSTEM_POWER_OFF);
260 if (pm_power_off_prepare)
261 pm_power_off_prepare();
262 migrate_to_reboot_cpu();
263 syscore_shutdown();
264 pr_emerg("Power downn");
265 kmsg_dump(KMSG_DUMP_POWEROFF);
266 machine_power_off();
267 }
New contributor
Before kernel doing its shutdown, we can see many log have been printed on the screen. So this shouldn't have business with the kernel.
– Yves
Jan 17 at 8:50
The kernel outputs some information before the real shutdown. 265 kmsg_dump(KMSG_DUMP_POWEROFF); 266 machine_power_off();
– wzq
Jan 17 at 13:35
add a comment |
Can analyze the reboot system call source code, maybe the answer is there.
PATH: linux-4.4.1/kernel/reboot.c
280 SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
281 void __user *, arg)
282 {
....
315 switch (cmd) {
316 case LINUX_REBOOT_CMD_RESTART:
....
333 case LINUX_REBOOT_CMD_POWER_OFF:
334 kernel_power_off();
335 do_exit(0);
336 break;
....
257 void kernel_power_off(void)
258 {
259 kernel_shutdown_prepare(SYSTEM_POWER_OFF);
260 if (pm_power_off_prepare)
261 pm_power_off_prepare();
262 migrate_to_reboot_cpu();
263 syscore_shutdown();
264 pr_emerg("Power downn");
265 kmsg_dump(KMSG_DUMP_POWEROFF);
266 machine_power_off();
267 }
New contributor
Can analyze the reboot system call source code, maybe the answer is there.
PATH: linux-4.4.1/kernel/reboot.c
280 SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
281 void __user *, arg)
282 {
....
315 switch (cmd) {
316 case LINUX_REBOOT_CMD_RESTART:
....
333 case LINUX_REBOOT_CMD_POWER_OFF:
334 kernel_power_off();
335 do_exit(0);
336 break;
....
257 void kernel_power_off(void)
258 {
259 kernel_shutdown_prepare(SYSTEM_POWER_OFF);
260 if (pm_power_off_prepare)
261 pm_power_off_prepare();
262 migrate_to_reboot_cpu();
263 syscore_shutdown();
264 pr_emerg("Power downn");
265 kmsg_dump(KMSG_DUMP_POWEROFF);
266 machine_power_off();
267 }
New contributor
New contributor
answered Jan 17 at 1:12
wzqwzq
1
1
New contributor
New contributor
Before kernel doing its shutdown, we can see many log have been printed on the screen. So this shouldn't have business with the kernel.
– Yves
Jan 17 at 8:50
The kernel outputs some information before the real shutdown. 265 kmsg_dump(KMSG_DUMP_POWEROFF); 266 machine_power_off();
– wzq
Jan 17 at 13:35
add a comment |
Before kernel doing its shutdown, we can see many log have been printed on the screen. So this shouldn't have business with the kernel.
– Yves
Jan 17 at 8:50
The kernel outputs some information before the real shutdown. 265 kmsg_dump(KMSG_DUMP_POWEROFF); 266 machine_power_off();
– wzq
Jan 17 at 13:35
Before kernel doing its shutdown, we can see many log have been printed on the screen. So this shouldn't have business with the kernel.
– Yves
Jan 17 at 8:50
Before kernel doing its shutdown, we can see many log have been printed on the screen. So this shouldn't have business with the kernel.
– Yves
Jan 17 at 8:50
The kernel outputs some information before the real shutdown. 265 kmsg_dump(KMSG_DUMP_POWEROFF); 266 machine_power_off();
– wzq
Jan 17 at 13:35
The kernel outputs some information before the real shutdown. 265 kmsg_dump(KMSG_DUMP_POWEROFF); 266 machine_power_off();
– wzq
Jan 17 at 13:35
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.
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%2f494800%2fhow-to-writes-the-log-on-the-screen-during-shutdown-and-startup-after-grub%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
To me at least it is unclear what your intentions are with "creating a service of systemd. Yes, the kernel, systemd and other applications will write to the screen during the boot process.
– Tommiie
Jan 16 at 12:43
You might be looking at logs written by Plymouth, which is a boot splash manager in modern Linux distributions.
– filbranden
Jan 16 at 13:22
@Tommiie I simply want to know how to write a log message with my own service or process while startup and shutdown.
– Yves
Jan 17 at 1:22
@Yves : that is a completely different question than “who writes to the screen during startup”
– Tommiie
Jan 17 at 5:49