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.
-
AuthorPosts
-
December 15, 2022 at 4:27 am #95689Member
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.December 15, 2022 at 4:28 am #95690Memberctcx
::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.December 15, 2022 at 4:31 am #95691Memberctcx
::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.December 15, 2022 at 4:33 am #95692Memberctcx
::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.gzDecember 15, 2022 at 4:36 am #95693Memberctcx
::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.December 15, 2022 at 4:38 am #95694Memberctcx
::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/*December 15, 2022 at 4:41 am #95695Memberctcx
::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…
December 15, 2022 at 4:46 am #95696Memberctcx
::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.December 15, 2022 at 6:49 am #95697Member
iznit
::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
December 15, 2022 at 12:22 pm #95711Forum Admin
dolphin_oracle
December 17, 2022 at 9:48 pm #95816Forum Admin
dolphin_oracle
::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?
December 17, 2022 at 11:01 pm #95820Memberctcx
::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.
December 17, 2022 at 11:15 pm #95822Memberctcx
::In another completely apart point:
https://www.antixforum.com/forums/topic/cannot-mount-internal-ntfs-partitions-only-as-root/page/2/#post-66551Turns 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…”
December 17, 2022 at 11:56 pm #95825Forum Admin
dolphin_oracle
::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.
December 18, 2022 at 12:42 am #95827Memberctcx
::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 -
AuthorPosts
- You must be logged in to reply to this topic.