Doubts solved; proposing *tested* enhancements for init script

Forum Forums antiX-development Development Doubts solved; proposing *tested* enhancements for init script

  • This topic has 36 replies, 3 voices, and was last updated Jan 14-2:05 am by ctcx.
Viewing 15 posts - 1 through 15 (of 37 total)
  • Author
    Posts
  • #95689
    Member
    ctcx

      Hello.

      Basically title, coming from this thread:
      https://www.antixforum.com/forums/topic/doubts-about-antix-init-script/

      After a LONG way studying the entire init script, I think I finally managed to successfully test some additions which fix some bugs/errors when using certain options for booting AntiX.

      Beforehand, I’d like to clarify: I won’t be referencing the Gitlab repository links because, for some reason, stuff there is horribly outdated with respect to current stuff in the live ISO.

      /live/init:

      I found a couple of typo-like bugs:

      find_crypt_or_linuxfs():
      [ -n "$BOOT_ID" ] && ENCRYPT_MODE=$ENCRYPT_DiSABLE # <-- !!!

      write_output_files():
      TOORAM_ALL="$TOORAM_ALL" # <-- !!!

      Should be “$ENCRYPT_DISABLE” and “TORAM_ALL=”$TORAM_ALL” respectively. The second one may be actually of little to no consequence, but the first one could lead to a malfunction when using LUKS stuff or the like.

      find_linuxfs_file():

      [...]
      SQFILE_MP=$ISO_FILE_MP                            # <-- Existing line
      BOOT_MP=$SQFILE_MP
      SQFILE_DEV=$FOUND_DEV   # Used for toram-eject    # <-- Existing line
      [...]

      copy_to_ram():

      [...]
      log_cmd umount $SQFS_MP                           # <-- Existing line
      mount_linuxfs "$SQFS_MP" "$SQFILE_FULL"           # <-- Existing line
      [ "$DID_ISO" ] && log_cmd umount $ISO_FILE_MP
      [...]

      These finally solve problems when using “fromiso=” boot option to boot from an ISO, of which I once opened discussion here:
      https://www.antixforum.com/forums/topic/booting-antix-with-multiboot-usb/
      Now, booting from ISO seems to be *fully* functional, at least as far as I have tested. No errors in the boot process anymore, and when using “toram” and “automount=off” boot options, it’s completely safe to remove the boot device -usually USB stick- as soon as just entering the desktop; except if on UEFI and not using “automount=off”, because with this setting one will find that, just like with the live-usb-maker -made liveUSB, the ESP partition was mounted, although it can be just unmounted with no problems.

      #95690
      Member
      ctcx
        Helpful
        Up
        0
        ::

        copy_xtra():

        # local var "dir" is not even used !!!
        [...]
        (cd "$xtra_dir" && tar cf - *) | tar x -C "$NEW_ROOT"                  # <-- Existing line
        
        # To avoid conflict when live-init script creates home directory.
        # Would be cooler if Busybox's tar supported the --transform option,
        # in which case the below line would be not necessary
        [ -d "$NEW_ROOT/home" ] && mv "$NEW_ROOT/home" "$NEW_ROOT/home.xtra"
        
        # Create a symlink to the /antiX/xtra directory if it exists           # <-- Existing line
        [...]

        Part one of two solving the xtra.tgz problem previously described in the other thread.

        /live/etc/init.d:

        create_home():

        [...]
        cp -a /etc/skel/* /etc/skel/.[!.]* $home 2>/dev/null # Avoid error [...]   # <-- Existing line
        
        # Check for home.xtra (from init script)
        local upper_home="/home" home_xtra="/home.xtra"
        if [ -d "$home_xtra" ]; then
        	echo_live "$_Copy_home_xtra_file_s_"
        	(cd "$home_xtra" && tar cf - *) | tar x -C "$upper_home"
        	rm -r "$home_xtra"
        fi
        
        local uid_gid=$(getent passwd $user | cut -d: -f3,4)                       # <-- Existing line
        [...]

        Part two of two solving the xtra.tgz problem previously described in the other thread.
        Now just would leave putting the corresponding entry for the “_Copy_home_xtra_file_s_” string in the /live/locale/xlat/<lang>/live-init.xlat files; otherwise if not even the English “en” one has it, only a blank line will be printed.

        #95691
        Member
        ctcx
          Helpful
          Up
          0
          ::

          Finally, not related to the init script, but just reiterating one past suggestion of mine for “battery indicator”:
          https://www.antixforum.com/forums/topic/issue-with-notify-send/#post-81623
          At least for me, as basic as useful.

          #95692
          Member
          ctcx
            Helpful
            Up
            0
            ::

            For testing, I had to do the process of unpacking and repacking the initrd.gz many times. This is how I usually do it:

            mv initrd{,_orig}.gz
            mkdir testInit && cd testInit
            zcat ../initrd_orig.gz | cpio -idmv
            (do changes to init...)
            find . | cpio -H newc -o | gzip -9 > ../initrd.gz
            #95693
            Member
            ctcx
              Helpful
              Up
              0
              ::

              One final miscellaneous doubt:

              Maybe a kind of childish question but, I learned that AntiX, as well Debian-based distros in general, seem to use Busybox for the init scripts. On the other hand I also just learned that a key developer of Busybox made a fork, Toybox, out of some differences with Busybox folks, or something like that. And now it seems that Toybox is the one being actively developed, while Busybox was left more legacy now. Have you heard about this? What would you think?

              Thanks everyone for your attention. Really hope all of this can be of some help or contribution…
              Special thanks to skidoo and Xecure.
              Hope they’re doing well.

              #95694
              Member
              ctcx
                Helpful
                Up
                0
                ::

                Overall consulted files:

                /live/init
                /live/config/{initrd.out,*}
                /live/custom/antiX/[0-9].sh
                /live/etc/init.d/{live-init,*}
                /live/locale/xlat/*/{live-init.xlat,*}
                /var/log/live/*
                #95695
                Member
                ctcx
                  Helpful
                  Up
                  0
                  ::

                  Final comment:

                  With all due respect to the community and the forum, but what a bad HELL this forum is currently being at least right now.

                  It wasn’t letting me post, nor edit, or even “banning” the public IP I had…

                  #95696
                  Member
                  ctcx
                    Helpful
                    Up
                    0
                    ::

                    Brief off-topic comment, because I think I once made mr anticapitalista a bit mad and would like to apologize:

                    By the way, the Multiboot USB mentioned in one of the links above was such a *life saver* for being able to test.
                    But just to clarify, I NEVER mean Multiboot is better than AntiX live-usb-maker; they’re just different, for different purposes.
                    If just wanting AntiX on single USB, the live-usb-maker is definitely the ace, and as perhaps implied here already, it even has its privileges.
                    If needing to use not just one or two, but several distributions, and not wanting to carry many USBs, the Multiboot is a saver. I know there’s Ventoy out there since circa 2 years ago, but personally I kind of preferred a more “manual” or “native” approach.

                    #95697
                    Member
                    iznit
                      Helpful
                      Up
                      0
                      ::

                      TOORAM_ALL=”$TOORAM_ALL” # <– !!!

                      This same mistaken variable name is present in the MX Linux init. Probably same with the other things you mentioned.

                      to do the process of unpacking and repacking the initrd.gz many times

                      Try the unpack-initrd script. It accepts several runtime options.

                      toybox

                      Compared to busybox ((( which is not a dead project, BTW ))) toxbox lacks applets for many commands. It must be a non-starter due the absence of at least one these, required by the various live scripts, right?

                      List here http://landley.net/toybox/status.html

                      #95711
                      Forum Admin
                      dolphin_oracle
                        Helpful
                        Up
                        0
                        ::

                        thanks for the looks. we will take a look at the intrd fixes.

                        #95816
                        Forum Admin
                        dolphin_oracle
                          Helpful
                          Up
                          0
                          ::

                          I presume this home.xtra thing is new. what is the format of the directory and the contents?

                          the xtra folder was originally meant for development work. home.xtra might be useful, but curious as to what the use case is?

                          #95820
                          Member
                          ctcx
                            Helpful
                            Up
                            0
                            ::

                            I presume this home.xtra thing is new. what is the format of the directory and the contents?

                            the xtra folder was originally meant for development work. home.xtra might be useful, but curious as to what the use case is?

                            It’s just the renamed /home directory, in case one also includes stuff from here in the xtra “package”.
                            I thought use cases should be the same or similar to all the xtra stuff…

                            Why renaming? Check the comment in the code:
                            # To avoid conflict when live-init script creates home directory.

                            By definition, the live-init script creates the whole /home directory only if needed; if it detects already the existence of a “/home” directory it will do nothing. According to what skidoo once explained and also what I could test myself, the “xtra” function is meant to work by only packaging the individual files one wants to preserve, and letting only these ones to be overridden, while leaving the rest of the system as is by default.
                            However, by doing this with the particular case of the /home directory, the live-init script won’t create the full home structure of course, leaving the user’s whole profile incomplete, and could even prevent logging in –this in fact happened to me back in the 21 release.

                            TL;DR, it was thought as just a small addition/fix to the whole “xtra” functionality: the /home directory in particular must be treated a bit more specially.

                            I’m not sure if skidoo already meant the “just for development usage” argument back in the other thread here
                            https://www.antixforum.com/forums/topic/several-doubts-about-savestate/
                            And I did ask in the very last post there, but by then skidoo had already been gone…

                            For my own defense, I did test this home.xtra thing, and it seemed to work just well. It could serve as an ugly, perhaps half-a**ed form of “persistence” without using an apart filesystem, but please correct me if wrong.
                            Given how unorthodox it is, better to still leave it undocumented.

                            Well, these were my thoughts.

                            #95822
                            Member
                            ctcx
                              Helpful
                              Up
                              0
                              ::

                              In another completely apart point:
                              https://www.antixforum.com/forums/topic/cannot-mount-internal-ntfs-partitions-only-as-root/page/2/#post-66551

                              Turns that make-fstab puts whatever device was used for booting -optical or USB-, but by doing so if I want to plug again the boot device I get error, because the mountpoints are now privileged. In my particular case, whenever booting the live system, I always have to delete their respective entries in /etc/fstab.

                              It would be pretty good if user was given choice at least for the live system usage. For example, whether adding them or not; or if forcibly adding, choosing custom unprivileged mountpoints, or things like that.

                              I felt tempted to also try exploring the make-fstab script, but shortly after I thought “er, this is maybe more delicate stuff…”

                              #95825
                              Forum Admin
                              dolphin_oracle
                                Helpful
                                Up
                                0
                                ::

                                so give me an example for home.xtra and where to place it on the live-usb.

                                • This reply was modified 4 months, 3 weeks ago by dolphin_oracle.
                                #95827
                                Member
                                ctcx
                                  Helpful
                                  Up
                                  0
                                  ::

                                  so give me an example for home.xtra and where to place it on the live-usb.

                                  Skidoo’s own example back then:
                                  https://www.antixforum.com/forums/topic/several-doubts-about-savestate/#post-76093

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