Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO] Silent boot and shutdown (with splash)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Jari_42
n00b
n00b


Joined: 06 Jan 2018
Posts: 4

PostPosted: Thu Jul 12, 2018 11:50 am    Post subject: [HOWTO] Silent boot and shutdown (with splash) Reply with quote

It took me quite a while to figure out how to get an (almost) completely silent boot and shutdown with flicker-free splash on gentoo, so I thought I'd share it here (constructive comments and suggestions welcome):

  1. Silence GRUB2
    By default GRUB2 is annoyingly verbose, however you can patch the GRUB2 sources to silence it:
    https://bbs.archlinux.org/viewtopic.php?id=209207
    recompile and then reinstall the silenced GRUB2 to the MBR:
    https://wiki.gentoo.org/wiki/GRUB2#Installing_the_boot_loader
    By far the easiest way to do this is to create a local portage overlay with a patched GRUB2.

    This still leaves an annoying flashing cursor before GRUB2 starts but apparently this requires adding a custom interrupt handler in assembler which is beyond me (any help appreciated):
    https://unix.stackexchange.com/questions/381076/how-to-hide-grub-2-cursor-before-kernel-splashscreen-menu

  2. Silence Kernel
    To disable kernel decompression messages, make sure that you add 'quiet' to the GRUB2 kernel command line options:
    https://wiki.gentoo.org/wiki/GRUB2_Quick_Start#Silent_kernel_decompression
    Also add vt.global_cursor_default=0 to the kernel command line parameters to hide the blinking console cursor.

  3. Use Kernel Mode Setting
    This is needed for a flicker-free splash, enable it as follows:
    https://wiki.gentoo.org/wiki/Xorg/Guide#Kernel_modesetting
    NOTE: the proprietary Nvidia driver does not provide a framebuffer so you will need to use Nouveau instead.

  4. Install Plymouth
    I would have much preferred to use fbsplash (love the framebuffer console decorations) but it flickers too much so plymouth is really the only option. Install it as follows:
    https://wiki.gentoo.org/wiki/Plymouth
    and create an initramfs as detailed in the wiki (I used genkernel-next for this). Also make sure that udev_log=3 in /etc/udev/udev.conf or you may get an INIT message when the initrd loads.
    NOTE: you do not actually need a splash theme as such, you can just have a black splash screen.
    BUGS: if you're using openrc then you need to use sys-boot/plymouth-0.8.8 (which is no longer in tree) as per bug 621470. Also, you'll want to patch sys-boot/plymouth-openrc-plugin as per the last comment in bug 491194 so that plymouth displays correctly on shutdown.

  5. Silence Openrc
    By default, openrc (or rather sys-apps/sysvinit) is really quite verbose on shutdown but can be silenced by patching the sysvinit sources to remove the various printouts/warnings from init.c and shutdown.c and by patching inittab to redirect the output of shutdown and reboot to /dev/null as per post 4802102. Again, I created a patched sys-apps/sysvinit in a local portage overlay (see next post for the patch).

  6. Enable Logging
    Finally, to stop various stderr/stdout messages overwriting the splash screen, install a system logger such as app-admin/syslog-ng to redirect them to a log file/another console instead.

That's it, let me know if you have any comments/questions/suggestions.
Back to top
View user's profile Send private message
Jari_42
n00b
n00b


Joined: 06 Jan 2018
Posts: 4

PostPosted: Thu Jul 12, 2018 11:51 am    Post subject: Reply with quote

Patch for silent sys-apps/sysvinit-2.88:
Code:

diff -Naur a/src/init.c b/src/init.c
--- a/src/init.c        2010-04-13 10:48:54.000000000 +0100
+++ b/src/init.c        2018-06-03 13:28:32.000000000 +0100
@@ -1444,7 +1444,7 @@
 
   INITDBG(L_VB, "Checking for children to kill");
   for(round = 0; round < 2; round++) {
-    talk = 1;
+    talk = 0;
     for(ch = family; ch; ch = ch->next) {
        ch->flags &= ~KILLME;
 
@@ -1799,8 +1799,8 @@
                case 'U':
                        initlog(L_SY, "Trying to re-exec init");
                        return 'U';
-               default:
-                       initlog(L_VB, "Switching to runlevel: %c", foo);
+               /* default: */
+                       /* initlog(L_VB, "Switching to runlevel: %c", foo); */
        }
 
        if (foo == 'Q') {
@@ -2624,7 +2624,7 @@
        /*
         *      Restart: unblock signals and let the show go on
         */
-       initlog(L_CO, bootmsg, "reloading");
+       /* initlog(L_CO, bootmsg, "reloading"); */
        sigfillset(&sgt);                                                                                                           
        sigprocmask(SIG_UNBLOCK, &sgt, NULL);                                                                                       
                                                                                                                                     
diff -Naur a/src/shutdown.c b/src/shutdown.c                                                                                         
--- a/src/shutdown.c    2010-03-23 14:37:01.000000000 +0000                                                                         
+++ b/src/shutdown.c    2018-06-03 13:20:16.000000000 +0100                                                                         
@@ -342,10 +342,10 @@                                                                                                               
        }                                                                                                                           
                                                                                                                                     
        /* Kill all processes. */                                                                                                   
-       fprintf(stderr, "shutdown: sending all processes the TERM signal...\r\n");                                                   
+       /* fprintf(stderr, "shutdown: sending all processes the TERM signal...\r\n"); */                                             
        kill(-1, SIGTERM);                                                                                                           
        sleep(sltime ? atoi(sltime) : 3);                                                                                           
-       fprintf(stderr, "shutdown: sending all processes the KILL signal.\r\n");                                                     
+       /* fprintf(stderr, "shutdown: sending all processes the KILL signal.\r\n"); */                                               
        (void) kill(-1, SIGKILL);                                                                                                   
                                                                                                                                     
 #if 0                                                                                                                               
@@ -406,7 +406,7 @@                                                                                                                 
        int     do_halt = (down_level[0] == '0');                                                                                   
                                                                                                                                     
        /* Warn for the last time */
-       warn(0);
+       /* warn(0); */
        if (dontshut) {
                hardsleep(1);
                stopit(0);

Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum