Faster Boot for antiX Linux 23

Forum Forums General Tips and Tricks Faster Boot for antiX Linux 23

  • This topic has 61 replies, 13 voices, and was last updated Oct 8-7:11 pm by olsztyn.
Viewing 15 posts - 46 through 60 (of 62 total)
  • Author
    Posts
  • #117901
    Member
    abc-nix

      Thanks for testing, @anti-apXos. I will probably scratch the runit-core changes and start again. I will open an issue in gitlab and discuss with anticapitalista what changes to keep.

      Stage 2 boot time decreased for me by exactly the same amount as abc-nix reported, ~0.2 second to 0.01 second. I don’t yet understand if this is mostly because the virtualbox script that was placed in /etc/init.d when I installed that package is no longer being run, though. The output that script generated is no longer shown (or logged). My VMs do still work fine, but I haven’t yet looked into what the script actually does. Maybe it’s not necessary for what I do in VMs.

      I guess the question is are scripts in the rc*.d directories still run at boot or is that totally disabled now? I do see that rc.local still runs.

      This needs a bit of historical context. During the antix 23 beta 3 runit testing, a proposition to remove sysvinit script support was discussed, and I pushed in favor of keeping the current compatibility. There was debate that without it antiX was faster, but it was decided that sysvinit scripts compatibility was too precious as for it to be removed, and it was kept.
      During the discussion, I accepted the challenge to try improving the runit functionality. I worked on it aiming for a future antiX 24-25 release instead of pushing for experimental features in close-to-be antiX release.

      I decided to separate the sysvinit compatibility from stage 2 to its own separate service, which would also start in parallel with the other runit services. Now starting and stopping sysvinit scripts is managed by the sysvinit-compat service described in the article:

      2. Stage 2 optimization: Faster SysVInit script loading
      While runit offers many advantages over traditional init systems, some users may still require compatibility with legacy sysvinit scripts. To address this need, antiX already provides a step in stage 2 that launches the necessary init scripts in /etc/rc2.d sequentially. This process delays starting the desktop, as all init scripts need to be executed first. To speed up this step, we have developed an alternative init compatibility service that runs alongside the standard runit services during stage 2, instead of before it.
      […]
      Next, we will create a new folder in /etc/sv named “sysvinit-compat” and copy over both the run and finish files from the runit-antix git repo to /etc/sv/sysvinit-compat and make them executable.

      Finally, we enable the new sysvinit-compat service (you can use the runit-service-manager for this), and replace both runit stages 2 and 3 with the ones in the runit-antiX gitlab repository if we haven’t yet done it.

      After rebooting, the service sysvinit-compat will be in charge of starting and stopping sysvinit scripts.

      So this makes it possible for anyone to enable and disable sysvinit compatibility by enabling and disabling the sysvinit-compat runit service. Having this logic separated from the runit stage 2 is an improvement to keep, I believe.
      Runit-core changes can be rethought. Keeping the originals and maybe separting them to their own startup and shutdown folders could be kept.

      #117922
      Member
      olsztyn

        Stage 1 boot time increased from ~6.5 seconds to ~9 seconds. The primary culprit is a 2 second pause following an error message in 06-checkroot.sh. The message is just an unhelpful to me

        I do not know what I am doing wrong, but I am not geting any such error message. I always watch boot messages and I do not see anything out of ordinary except it takes about a second pause on adding client to seat0 by seatd.
        My boot time did not increased or decreased noticeably but I will try to measure it to verify if necessary.

        To be clear, the process abc-nix described earlier in this thread is not necessary to disable slimski. Just removing it from the list of services (in runit or sysvinit), optionally setting up autologin on tty1 and a ~/.bash_login file, and if necessary switching to the libinput driver for a trackpad should be enough.

        I have not analyzed the process provided but I see that using that process now slimski shows among runit services that can be enabled and started by runit service manager if needed for some reason, such as to flip antiX into a multi-user system. If my conjecture is correct, this would make a difference from just removing slimski service, as such action would not provide this flexibility of enabling this service if needed.
        Please correct me if I am wrong.

        All testing I have done of no-slimski antiX 23 runit full was on a copy of my real ‘production’ system, which I do use every day, not in VirtualBox. By saying this I am not claiming that testing on real production system (exact copy of it on a second disk) is superior from testing in VirtualBox, as I am very familiar with VirtualBox and VMWare.
        All I am saying here is that testing on my real environment with all the apps I am using, decides whether test results are good for adopting this new antiX configuration as my new day-to-day production image.
        The results I see, just to summarize:
        – No errors of any kind when booting or operation
        – No noticeable increase (or noticeable decrease) of boot time
        – Cleaner transition to desktop (no interim slimski background screen popping up whether you actually use background image on desktop or not).
        – Simplification by elimination of redundant slimski for a single user

        To emphasize, I like the way it works now. Simplicity and efficiency.

        Edit:
        I have done some boot time measurement of identical environment of antiX 23 runit except with and without slimski. Test performed on two identical machines from 2008, namely Thinkpad X61 with Core2Duo T7300, 2Ghz, 4Gb ram, 7200 hard disks. Boot was complete to antiX desktop and included Pipewire initialization all the way to volume icon.

        Boot time test resulted in 26 seconds both. Any boot time difference was within one second and inconclusive which one was the faster one…
        Of course other users may experience different results.
        So in my case what matters is a cleaner and simpler configuration for single user system, rather than boot time, as decisive in adoption of the no-slimski antiX.

        • This reply was modified 10 months ago by olsztyn.

        Live antiX Boot Options (Previously posted by Xecure):
        http://antixlinuxfan.miraheze.org/wiki/Table_of_antiX_Boot_Parameters

        #117986
        Member
        blur13

          – Cleaner transition to desktop (no interim slimski background screen popping up whether you actually use background image on desktop or not).

          The solution to this, that I used:

          sudo mv /usr/share/slimski/themes/antiX/background.jpg /usr/share/slimski/themes/antiX/background-original.jpg

          This will make the interim slimski background plain black, which is much less of a distraction.

          #117990
          Member
          olsztyn

            The solution to this, that I used:

            Thank you @blur13!
            I will implement this on my antiX line with slimski. I have several lines of antiX 23 with different configurations, on separate hard disks. Your configuration, I did not think about doing something like this before, solves my question.
            My newest antiX ‘production’ line I am using now (until I discover some major issue, forcing me to fall back to slimski line) is no-slimski antiX. It works very well so far.

            Live antiX Boot Options (Previously posted by Xecure):
            http://antixlinuxfan.miraheze.org/wiki/Table_of_antiX_Boot_Parameters

            #117997
            Member
            anti-apXos

              Thanks @abc-nix for that explanation. It makes more sense now and I can see the value of being able to turn on and off sysvinit scripts while still having the basic things that you would not want to turn off handled by runit-core. I definitely didn’t understand how runit and sysvinit scripts interacted before. Honestly, even though I’ve used Linux for years, with both systemd and sysvinit, these things have always been pretty vague to me. As for runit, antiX-23 is the first time I’ve used it, so my understanding is even worse.

              Now I understand that even before the changes, scripts were being run from both /etc/runit-core and /etc/init.d (or /etc/rc*.d), so that actually nothing really has gotten more complex. If anything simpler since the ones in /etc/init.d are now more clearly controlled as a runit service. At least, that’s what I think I understand. Is this right?

              After more testing, I can see that toggling the sysvinit-compat service does indeed enable and disable running the virtualbox script in /etc/init.d (and that my VMs do not work when sysvinit-compat is disabled). Part of my confusion was that the output of the virtualbox script is no longer shown on the boot screen (or logged) even when sysvinit-compat is enabled. I don’t know why that is, but I can help troubleshoot if the goal is to have the messages shown, which it seems like they should be. Just to be clear, I’m using virtualbox to run VMs (mostly Windows) in antiX, not to run antiX in a VM.

              As for the error message I get at boot from the /etc/runit-core/startup.d/06-checkroot.sh script, I still can’t tell exactly what the problem is, but I have satisfied myself that it is not an error with my root partition. I’m happy to provide more testing for that, too, if you want to use my system to isolate it.

              Even though I said I didn’t plan to make these changes permanent, I’m also in no hurry to revert to my previous snapshot, so I’ll be running my system this way for a while at least. I’ll probably make a snapshot before reverting, too.

              EDIT: Since /etc/rc.local is also not run when sysvinit-compat is disabled, is there an alternate method that will be recommended to run a command or script at boot that requires root? I’ve always used rc.local for those cases, but what would be the best alternative under runit without sysvinit compatibility? Just putting my own script in /etc/runit-core/startup.d? Or is there something else?

              • This reply was modified 9 months, 4 weeks ago by anti-apXos.
              #118009
              Member
              stevesr0

                Hi all,

                With my antiX-22–>23 system, boot time is slowed by dhcpd trying to connect via ethernet (eth0) when there is no ethernet connection. I don’t see this with my antiX-19 OS on the same computer.

                Do I need to edit the dhclient.conf file to tell it to use wlan0 or is this more likely occurring because wlan0 hasn’t started up promptly or…?

                Appreciate any references to explain, assess and fix.

                stevesr0

                #118078
                Member
                abc-nix

                  Thanks, anti-apXos. This is very good feedback which leads to good questions and solutions. These are the kind of things I love of collaborative development.

                  If anything simpler since the ones in /etc/init.d are now more clearly controlled as a runit service. At least, that’s what I think I understand. Is this right?

                  Yes. The separation makes it easier to manage, at least for users.

                  Part of my confusion was that the output of the virtualbox script is no longer shown on the boot screen (or logged) even when sysvinit-compat is enabled. I don’t know why that is, but I can help troubleshoot if the goal is to have the messages shown, which it seems like they should be. Just to be clear, I’m using virtualbox to run VMs (mostly Windows) in antiX, not to run antiX in a VM.

                  The logs are turned off by default. You can enable them with the runit-service-manager and you will see them in /var/log/runit/sysvinit-compat/current. But they won’t (shouldn’t) be showing anymore in the console.

                  As for the error message I get at boot from the /etc/runit-core/startup.d/06-checkroot.sh script, I still can’t tell exactly what the problem is, but I have satisfied myself that it is not an error with my root partition. I’m happy to provide more testing for that, too, if you want to use my system to isolate it.

                  There is some issue in live (not present on install I think) with fsck. For some reason, it also doesn’t work for 10-checkfs.sh. The only fix I found is to use the full path for fsck, but other commands launched by the other runit-core scripts do work. Do you also see an error message for 10-checkfs.sh saying something like “Could not perform file system check or fsck is missing.”? It would be great to figure out if this issue was also present on the older runit-core scripts, but those had poorer logging compared to the newer ones.

                  EDIT: Since /etc/rc.local is also not run when sysvinit-compat is disabled, is there an alternate method that will be recommended to run a command or script at boot that requires root? I’ve always used rc.local for those cases, but what would be the best alternative under runit without sysvinit compatibility? Just putting my own script in /etc/runit-core/startup.d? Or is there something else?

                  Good question. Theoretically, if sysvinit-compat is “removed” (meaning there is no symlink for this service in /etc/service), then /etc/rc.local should always be executed in stage 2 (and the output should be displayed in both console and the runit.log). Try it out. Remove the sysvinit-compat service using the runit-service manager (remove button, not “disable startup”), add some echo lines to /etc/rc.local and rebbot. You should be able to see if they are writen in the runit.log file.

                  #118079
                  Member
                  abc-nix

                    Hi all,

                    With my antiX-22–>23 system, boot time is slowed by dhcpd trying to connect via ethernet (eth0) when there is no ethernet connection. I don’t see this with my antiX-19 OS on the same computer.

                    Do I need to edit the dhclient.conf file to tell it to use wlan0 or is this more likely occurring because wlan0 hasn’t started up promptly or…?

                    Appreciate any references to explain, assess and fix.

                    stevesr0

                    Is this the runit or sysvinit edition? If the runit version, is this with the suggested runit-core scripts or the default ones?

                    #118144
                    Member
                    anti-apXos

                      There is some issue in live (not present on install I think) with fsck. For some reason, it also doesn’t work for 10-checkfs.sh. The only fix I found is to use the full path for fsck, but other commands launched by the other runit-core scripts do work. Do you also see an error message for 10-checkfs.sh saying something like “Could not perform file system check or fsck is missing.”? It would be great to figure out if this issue was also present on the older runit-core scripts, but those had poorer logging compared to the newer ones.

                      I saw your earlier comment about this and had already fixed it in my frugal install. Even with the stock runit scripts, yes, I saw a message something like “fsck: file or directory does not exist” and it was fixed by putting the full path in the script. I only saw this on a frugal-live install, not my full install.

                      The error message I’m seeing now, with the new scripts, is different. It’s a red text “(ERROR)” followed by “code 0” and then there’s a 2 second pause. SInce the pause is exactly 2 seconds, I figured it must be a ‘sleep 2’ command in the script, but I don’t see any ‘sleep 2’ in 06-checkroot.sh, so I dunno.

                      Here’s an example output of boot from my runit.log:

                      Wed, 27 Sep 2023 14:10:41 -0700
                      [2.06000000]: Start stage 1
                      [2.07000000]: running /etc/runit-core/startup.d/01-console-setup.sh
                      Setting up console font and keymap ...setupcon: /etc/console-setup is not writable. No files will be saved there.
                      /bin/setupcon: 999: cannot create /etc/console-setup/cached_UTF-8_del.kmap.gz: Read-only file system
                       failed.
                      [2.87000000]: running /etc/runit-core/startup.d/01-mountkernfs.sh
                      [2.92000000]: running /etc/runit-core/startup.d/02-udev.sh
                      Starting hot-plug events dispatcher udevd ... done.
                      Synthesizing the initial hotplug events (subsystems) ... done.
                      Synthesizing the initial hotplug events (devices) ... done.
                      Waiting for /dev to be fully populated ... done.
                      [4.29000000]: running /etc/runit-core/startup.d/03-mountdevsubfs.sh
                      [4.35000000]: running /etc/runit-core/startup.d/04-keyboard-setup.sh
                      Setting up keyboard layout ... done.
                      [5.15000000]: running /etc/runit-core/startup.d/05-hwclock.sh
                      [5.17000000]: running /etc/runit-core/startup.d/06-checkroot.sh
                      Starting checkroot ...Activating swap ...swapon: /dev/mmcblk0p4: found signature [pagesize=4096, signature=swap]
                      swapon: /dev/mmcblk0p4: pagesize=4096, swapsize=8579448832, devsize=8579448832
                      swapon /dev/mmcblk0p4
                      [39;49m(SUCCESS)[39;49m
                      Checking root file system ...[/sbin/fsck.ext4 (1) -- /] fsck.ext4 -a -C0 /dev/mmcblk0p2 
                      ROOT: clean, 188009/655360 files, 1638326/2621440 blocks
                      [31m(ERROR)[39;49m: code 0
                      [7.25000000]: running /etc/runit-core/startup.d/07-cryptdisks-early.sh
                      Starting early crypto disks...done.
                      [7.29000000]: running /etc/runit-core/startup.d/08-checkroot-bootclean.sh
                      Cleaning up temporary files .../tmp ...Cleaning /tmp ... done.
                       done.
                      [7.31000000]: running /etc/runit-core/startup.d/08-kmod.sh
                      Loading kernel module lp  ... done.
                      Loading kernel module ppdev  ... done.
                      Loading kernel module parport_pc  ... done.
                      [7.34000000]: running /etc/runit-core/startup.d/08-nfs-common.sh
                      Starting NFS common utilities
                      statd ...
                      [33m(WARNING)[39;49m: Not starting: portmapper is not running
                      [7.36000000]: running /etc/runit-core/startup.d/09-cryptdisks.sh
                      Starting remaining crypto disks...done.
                      [7.38000000]: running /etc/runit-core/startup.d/10-checkfs.sh
                      Will now check all file systems
                      Checking all file systems.
                      UUID=8af17b90-1e87-4150-ae7e-97d5e9943ce9 is mounted
                      UUID=d1247db9-b33f-4a1a-bfb4-95f6c2b55e67 is not mounted
                      [/usr/sbin/fsck.ext4 (1) -- /home] fsck.ext4 -a -C0 /dev/mmcblk0p3 
                      HOME: clean, 11490/2621440 files, 4818618/10485760 blocks
                      [39;49m(SUCCESS)[39;49m: Done checking file systems
                      [39;49m(SUCCESS)[39;49m: Log is being saved in /var/log/fsck/checkfs if that location is writable
                      [7.41000000]: running /etc/runit-core/startup.d/11-mount-configfs.sh
                      [7.42000000]: running /etc/runit-core/startup.d/11-mountall.sh
                      Mounting local filesystems ... done.
                      Activating swapfile swap, if any ...swapon: /dev/mmcblk0p4: already active -- ignored
                       done.
                      [33m(WARNING)[39;49m: Files under mount point '/run/lock' will be hidden.
                      Checking minimum space in /tmp ... done.
                      [7.52000000]: running /etc/runit-core/startup.d/12-mountall-bootclean.sh
                      Cleaning up temporary files ... done.
                      [7.54000000]: running /etc/runit-core/startup.d/13-brightness.sh
                      Initialising intel brightness level ... done.
                      [7.55000000]: running /etc/runit-core/startup.d/13-hostname.sh
                      Setting hostname to 'fleex' ... done.
                      [7.56000000]: running /etc/runit-core/startup.d/13-procps.sh
                      [7.57000000]: running /etc/runit-core/startup.d/13-resolvconf.sh
                      Setting up resolvconf ...[39;49m(SUCCESS)[39;49m: done.
                      [7.60000000]: running /etc/runit-core/startup.d/13-urandom.sh
                      Initializing random number generator ... failed.
                      [7.61000000]: running /etc/runit-core/startup.d/14-networking.sh
                      Not configuring network interfaces, see /etc/default/networking
                      [7.62000000]: running /etc/runit-core/startup.d/15-mountnfs.sh
                      [7.63000000]: running /etc/runit-core/startup.d/16-mountnfs-bootclean.sh
                      Cleaning up temporary files ... done.
                      [7.65000000]: running /etc/runit-core/startup.d/17-alsa-utils.sh
                      Setting up ALSA ...[39;49m(SUCCESS)[39;49m: done.
                      [7.68000000]: running /etc/runit-core/startup.d/17-bootmisc.sh
                      [7.69000000]: running /etc/runit-core/startup.d/17-lm-sensors.sh
                      Setting sensors limits...
                      [7.71000000]: running /etc/runit-core/startup.d/17-x11-common.sh
                      Setting up X socket directories .../tmp/.X11-unix .../tmp/.ICE-unix ... done.
                      [7.72000000]: Exit stage 1
                      [7.73000000]: Start stage 2
                      [7.73000000]: Service directory changed to default
                      [7.74000000]: Running rc.local as fallback for missing sysvinit compatibility
                      [7.75000000]: Starting runit services in /etc/service...
                      

                      Should it be safe to disable 06-checkroot.sh? Since 10-checkfs.sh also checks root and 11-mountall.sh looks like it wants to mount my swap partition, maybe checkroot.sh is not necessary? Or does it do something else as well? I guess it must since it tries to do something that produces this error message, at least.

                      Good question. Theoretically, if sysvinit-compat is “removed” (meaning there is no symlink for this service in /etc/service), then /etc/rc.local should always be executed in stage 2 (and the output should be displayed in both console and the runit.log). Try it out. Remove the sysvinit-compat service using the runit-service manager (remove button, not “disable startup”), add some echo lines to /etc/rc.local and rebbot. You should be able to see if they are writen in the runit.log file.

                      Yes, I tried this and it works, showing the message about running rc.local as a fallback shown in the log above.

                      The behavior of rc.init run this way seems to be different from when it runs with sysvinit-compat added and enabled (or how it worked before making these changes to separate sysvinit compatability).

                      I have a call to /usr/bin/keyd in my rc.local like this:
                      /usr/bin/keyd &
                      Normally, this backgrounds the keyd process and my boot goes on, but with sysvinit-compat removed and rc.local run as a “fallback,” boot halts on the keyd output like it’s remaining as a foreground process of the script. I’m not sure if anything can be done about this, depending on how this “fallback” rc.local works, but I just thought I’d mention it. For me, I’ll be running with sysvinit-compat enabled since I need it anyway for virtualbox.

                      #118150
                      Member
                      stevesr0

                        hi abc-nix,

                        Thanks for responding.

                        To answer< I had to reread your OP. I have NOT replaced the default files with the suggested ones from github.

                        I posted here because I have a problem (connecting to wifi) that is SLOWING my boot. If you as the OPer feel that this is off topic, I will open a new thread, as I don’t want to push people off your topic.

                        stevesr0

                        #118204
                        Member
                        abc-nix

                          Should it be safe to disable 06-checkroot.sh?

                          I am not sure. There are so many things going on in each script, even if they seem redundant, different things happen at different stages. I wouldn’t discard anything for now. Fixing the issue should be the priority, and with more testing and understanding we can decide if removing is a good idea.

                          Normally, this backgrounds the keyd process and my boot goes on, but with sysvinit-compat removed and rc.local run as a “fallback,” boot halts on the keyd output like it’s remaining as a foreground process of the script.

                          Thanks. I will look into this. Maybe even forking this step could be an improvement. For now sourcing /etc/rc.local in this step should also fix the issue even if it isn’t logged.

                          #118205
                          Member
                          abc-nix

                            @stevesr0
                            If this happens during boot, and we are still talking about runit, you could see if after boot running the networking runit-core script also gets a long delay
                            sudo /etc/runit-core/S14networking restart

                            It would be best to open a new thread to give it more attention. It will get lost between these posts if we continue the discussion here.

                            #118294
                            Member
                            anti-apXos

                              I solved the issue I had with 06-checkroot.sh…sort of.

                              First, the (ERROR) message should not have been shown. Code 0 should display (SUCCESS) but it’s being hard-coded to show (ERROR) instead at this line
                              221 log_special_msg 1 "code $FSCKCODE"
                              After looking at the way it’s done in the original S06chckroot.sh, I changed that to

                                      if [ "$FSCKCODE" = 0 ]
                                      then
                                              log_special_msg 0
                                      else
                                              log_special_msg 1 "code $FSCKCODE"
                                      fi
                              

                              That fixes the scary error message, but it didn’t do anything about the 2 second delay, which now occurs after (SUCCESS) is displayed. After testing other things I found that a log_msg even at the very end of 06-checkroot.sh still showed on screen before the pause, so it seems to be happening between the end of that script and the beginning of 07-cryptdisks-early.sh. I don’t understand why there would be a pause between these two scripts, but when I turn debug logging off in /etc/default/runit-antix, the pause goes away. I guess it’s just a weird coincidence that it happens right after that erroneous error message was shown.

                              So with logging off, bootup is back to its regular speed. It could be faster than before switching to the new scripts, but it’s hard to say for sure without a log.

                              #118383
                              Member
                              abc-nix

                                Thanks, anti-apXos. I will revert all the changes I did for runit-core and send a merge request to the gitlab repo later. I think I changed too many things and broke some of the scripts, like:

                                [7.60000000]: running /etc/runit-core/startup.d/13-urandom.sh
                                Initializing random number generator … failed.

                                Too many issues related to these changes. Better to return to the previous scripts but keep the separation between startup and shutdown.
                                I will also fix the issue with rc.local, so it doesn’t get stuck.

                                when I turn debug logging off in /etc/default/runit-antix, the pause goes away.

                                I will try implementing a different way for logging. Both the issue with rc.local and 06-checkroot.sh seems to be related to how I implemented logging.

                                Thanks for the feedback.

                                #119554
                                Member
                                olsztyn

                                  From my perspective I see just positives resulting from development of no-slimski antiX. So far in my testing it appears to work perfectly fine and since in my case there is no particular need to have multiple users with separate profiles and Homes, using the same installation, it seems to fit very well.

                                  Having continued testing on various machines with slimski-less antiX I ran into the following issue:
                                  On UEFI machines booting stops short of desktop. The last message I see on most machines is:

                                  “Server listening on 0.0.0.0 port 22
                                  Server listening on :: port 22”

                                  At this point I do not know what is causing this slimski-less antiX to stop booting at this point, where identical instance, except with slimski boots fine all the way to desktop on UEFI machines as well…
                                  Any hints appreciated.

                                  • This reply was modified 9 months, 2 weeks ago by olsztyn.

                                  Live antiX Boot Options (Previously posted by Xecure):
                                  http://antixlinuxfan.miraheze.org/wiki/Table_of_antiX_Boot_Parameters

                                Viewing 15 posts - 46 through 60 (of 62 total)
                                • You must be logged in to reply to this topic.