The book contains a lot of info on this, on why symlinks vs unionfs etc.Thanks, I needed that pointer.
What I see happening during startup is that the time spend “mounting all those packages” takes quite some time (I did not time it exactly but I guess 30..60 seconds).
/opt/bootlater.sh &
#!/bin/sh
TCEDIR=/etc/sysconfig/tcedir
for EXT in $(cat $TCEDIR/onlater.lst)
do
su -c "tce-load -i ${TCEDIR}/optional/${EXT}" tc
sleep 1
done
Run backup if you are using backup to persist your changes so that /opt/bootlater.sh gets saved.Please be aware I’m not a Linux expert. I’m learning.That is exactly why we do what we do here...
Not sure I will follow your suggestion (hope you don't mind),Of course I don't mind! In fact, this thread gives me an idea for a project we're working on. :)
Of course I don't mind! In fact, this thread gives me an idea for a project we're working on. :)Thanks!
Additionally, if you were to modify the list of boot codes you're using and add the code showapps, should you ever need to reboot, this code would display the progress of which extensions are loaded / being loaded and if there was one extension in particular that was taking a good deal of time loading, it would be visually apparent.
Good luck and take care!
@Stefann: Good morning!@Centralware
It sounds to me as though you have a desktop environment and quite a few extensions loading during boot.
If boot time were a concern, you can delegate some extensions to load AFTER the desktop launches.
For example, let's say you had OpenSSH or Dropbear loading to give you remote shell access to the machine. This doesn't HAVE to be something that's done right this second while it's booting up as it'll delay getting to the desktop and it has nothing to DO with the desktop's operations. That said, you could take OpenSSH out of /etc/sysconfig/tcedir/onboot.lst and instead, load it later... in the background... after your desktop is finished and operational.
The extensions you take out of onboot.lst... move them into onlater.lst in the same location. onlater.lst is just a name I came up with, it is not in the TCL text book.
Do not add drivers/firmware, Xorg support extensions or file systems to onlater.lst as it may have adverse results or even stop the desktop from loading.
Add a new line somewhere near the end of /opt/bootlocal.shCode: [Select]/opt/bootlater.sh &
Then create /opt/bootlater.shCode: [Select]#!/bin/sh
Run backup if you are using backup to persist your changes so that /opt/bootlater.sh gets saved.
TCEDIR=/etc/sysconfig/tcedir
for EXT in $(cat $TCEDIR/onlater.lst)
do
su -c "tce-load -i ${TCEDIR}/optional/${EXT}" tc
sleep 1
done
The extensions you load in the background, I would recommend limiting any extensions that add icons to the toolbar/wbar/etc. as too many of these being done at the same time can get odd results.
The sleep() call above slows down loading extensions in the background to help prevent some of these oddities.
# put other system startup commands here
is a good example found at the start of /opt/bootlocal.sh The "#" and everything that follows it on that line is ignored by the system.... I'd imagine this doesn't operate as expected on every extension, ...It doesn't work for every extension. You don't want to use it for
tc@E310:~$ echo $PATH
/home/tc/.local/bin:/usr/local/sbin:/usr/local/bin:/apps/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/sysconfig/tcedir/ondemand
tc@E310:~$
@Stefann: Have you experimented with OnDemand?Thanks,
I'm going through the steps right now while describing it to ensure I'm being as accurate as possible.
1. tce-load -wo curl
This loads the extension curl as an OnDemand program; I just rebooted that machine. Curl is NOT loaded.
2. curl http://www.google.com
The curl extension is loaded/mounted and then launched. Google's heavily obfuscated javascript content is returned, as expected.
3. Until the machine is rebooted, the curl extension remains loaded.
I'd imagine this doesn't operate as expected on every extension, but for compiler tools and other things you may not use very often, this may be a way to speed up booting AND reduce memory usage AND in the process, reduce CPU during startup by reducing the number of extensions being dealt with at that time. It should also be "upgrade" friendly.
Note: Upgrades to the operating system should never be affected by /opt scripts as your backups or persistent directories generally fall outside the core operation files and extensions.
REMEMBERING changes you've made, however, is another story. It's always wise if you make changes and need to remember 5 years from now WHY you did something or what you did it for, in shell scripts like bootlocal.sh, bootsync.sh (and other .sh files) simply leave yourself detailed notes/comments preceded by a pound sign (#)Code: [Select]# put other system startup commands here
is a good example found at the start of /opt/bootlocal.sh The "#" and everything that follows it on that line is ignored by the system.
This is a similar concept to the comments you're accustomed to in C.
It doesn't work for every extension. You don't want to use it forAh.. thanks for that update.
libraries, kernel modules, or firmware.
Anyone placing compiletc.tcz ondemand expecting gcc to magically
load and execute will be disappointed.
... Until recently, I didn't utilize macro extensions at all ...I guess you are referring to meta-extensions ?
- nor did OnDemand seem useful for what I do on a day-to-day basis, ...I've never used OnDemand myself. I felt it was too easy to misuse. Though it's been
... It will only work if the name of the extension exactly matches the nameJust to hammer the point home (or beat it to death), here are a handfull of
of the program you want to run.
Anyone placing compiletc.tcz ondemand expecting gcc to magically
load and execute will be disappointed.
ace-of-penguins.tcz
alsa.tcz
alsa-config.tcz
aoetools.tcz
apache2.4.tcz
bind.tcz
binutils.tcz
blueman.tcz
bluez.tcz
bluez5.tcz
cairo.tcz
cdrtools.tcz
connman.tcz
coreutils.tcz
cups.tcz
ffmpeg3.tcz
findutils.tcz
fox.tcz
freebasic.tcz
ijs.tcz
inetutils.tcz
inotify-tools.tcz
pci-utils.tcz
usbutils.tcz
util-linux.tcz
*-dev.tcz
*-doc.tcz
*-icon*.tcz
lib*.tcz # Plus library extensions by other names (cairomm.tcz, clucene.tcz, clutter.tcz, freeglut.tcz, glu.tcz, ... )
*-locale.tcz
*-theme*.tcz
@Stefann: The extra script isn't a requirement; the same content can be added to bootlocal.sh directly; it's merely my own practice to separate things for organizational reasons.Than actually makes a lot of sense.
(bootlocal.sh is already run as a background task.)
Shortened the quote… but you fully made your point.
Just to hammer the point home (or beat it to death), here are a handfull of
(non-meta extension) examples that are also not candidates for OnDemand…..
I guess you are referring to meta-extensions ?@Rich: LOL... nah!
So you weren't referring to extensions like compiletc.tcz ? ???I guess you are referring to meta-extensions ?@Rich: LOL... nah!
META="...to one's self" (like self-reflection) or showing or suggesting an explicit awareness of itself or oneself as a member of its category"
MACRO="a single instruction that expands automatically into a set of instructions to perform a particular task." ...
Title: compiletc.tcz
Description: compiletc metapackage
Version: 0.1
Author: n/a
Original-site: tinycorelinux.com
Copying-policy: n/a
Size: 4KB
Extension_by: N. Carigon
Tags: compiletc metapackage
Comments: This is a meta-extension for a compile environment
----- Snip -----
Hi CentralWareI suppose that tips suggesting extensions containing some program (or might be even with a prompt to download/install them) can be done by shell hooks on user side (most of shells have some not_found hook).... I'd imagine this doesn't operate as expected on every extension, ...It doesn't work for every extension.
tc@tc-x86_64:~$ cc
cc found in 'gcc'
tc@tc-x86_64:~$ as
as found in 'binutils'
tc@tc-x86_64:~$ yacc
yacc found in 'bison'
tc@tc-x86_64:~$ locate
locate found in 'findutils'
tc@tc-x86_64:~$ hmm
hmm: not found
... My thought is triggered because I notice the “disk activity” led showing lots of action during boot. That is not mounting…. That is reading.The disk activity is likely from all of the links being created from
@yvs: Personally that really annoys me on Ubuntu and others. When I make a typo, that hook causes significant delay, with cold caches the first time is several seconds.agree I usually disable it and use `apt-file search` when it's needed, it's slow there maybe because of enormous number of packages and files in that, or probably some compression to keep that info, I haven't dig into it.
tc@tc-x86_64:~$ time gcc
gcc found in 'gcc'
real 0m0.009s
user 0m0.004s
sys 0m0.005s
# it can be boosted a bit using filelist on ramfs and pregrepping before sed
EXT_BIN_LIST="/etc/sysconfig/tcedir/not_found.aux"
function command_not_found_handle() {
test -f "$EXT_BIN_LIST" && {
bin="$1"; shift
exts="$(sed -n "s,^\(.*\)[ ]\+.*/$bin/.*,\1,p" <"$EXT_BIN_LIST")"
test -n "$exts" && echo "$bin found in '$exts'" || echo "$bin: not found"
}
return 127
}
% grep '^gcc' /etc/sysconfig/tcedir/not_found.aux
gcc /c++/cc/cpp/g++/gcc/gcc-ar/gcc-nm/gcc-ranlib/gcov/gcov-dump/gcov-tool/lto-dump/x86_64-pc-linux-gnu-c++/x86_64-pc-linux-gnu-g++/x86_64-pc-linux-gnu-gcc/x86_64-pc-linux-gnu-gcc-13.2.0/x86_64-pc-linux-gnu-gcc-ar/x86_64-pc-linux-gnu-gcc-nm/x86_64-pc-linux-gnu-gcc-ranlib/
- this mounting of a compressed archive probably requires disk operation to read the full archive file.Not sure if that's related: on Ubuntu with its squashfs use (for snaps) there were many discussions of use different compression formats (for example lzo zstd xz etc.) trading-of between size and performance
Ubuntu with its squashfs use (for snaps) there were many discussions of use different compression formats (for example lzo zstd xz etc.) trading-of between size and performance
wrt squashfs and compression
iv just found this [linked below] post lamenting the state of Ubuntu's Snap single-threaded decompression
... "scripts to recreate these measurements are included" ! .. if any one with similar hw is interested in making comparison?
https://forum.snapcraft.io/t/squashfs-is-a-terrible-storage-format/9466
tc@huis:/mnt/sda1/tce/optional$ ls -Sl
total 215860
-rw-rw-r-- 1 tc staff 61710336 Aug 17 06:26 gcc.tcz
-rw-rw-r-- 1 tc staff 35917824 Aug 17 06:25 samba3.tcz
-rw-rw-r-- 1 tc staff 16601088 Aug 17 06:25 perl5.tcz
-rw-rw-r-- 1 tc staff 16556032 Aug 17 06:25 python3.6.tcz
-rw-rw-r-- 1 tc staff 15740928 Aug 17 06:25 python3.9.tcz
-rw-rw-r-- 1 tc staff 6410240 Aug 17 06:25 binutils.tcz
-rw-rw-r-- 1 tc staff 4218880 Aug 17 06:25 php-8.3-dev.tcz
-rw-rw-r-- 1 tc staff 3239936 Aug 17 06:25 php-8.3-ext.tcz
-rw-rw-r-- 1 tc staff 3125248 Aug 17 06:25 glibc_base-dev.tcz
-rw-rw-r-- 1 tc staff 3063808 Aug 17 06:25 glibc_gconv.tcz
-rw-rw-r-- 1 tc staff 2994176 Aug 17 06:25 gcc_libs-dev.tcz
-rw-rw-r-- 1 tc staff 2834432 Aug 17 06:25 openssl.tcz
-rw-rw-r-- 1 tc staff 2764800 Aug 17 06:26 realvnc.tcz
#!/bin/sh
. /etc/init.d/tc-functions
clear; CUR=$(pwd)
### tcl-load -i theory:
# Gather our extension name from $1 (just for this test, loop from $@ normally)
EXT=$1
EXT=${EXT/.tcz/}
EXT=${EXT/KERNEL/$(uname -r)}
echo "${WHITE}Loading ${YELLOW}$EXT${NORMAL}"
# 1. Mount the extension $EXT in /tmp/tcloop2
if [ ! -d /tmp/tcloop2/$EXT ]; then
echo " ${WHITE}Mounting ${YELLOW}$EXT${NORMAL}"
mkdir -p /tmp/tcloop2/$EXT
sudo mount /etc/sysconfig/tcedir/optional/${EXT}.tcz /tmp/tcloop2/$EXT || $(echo "${RED}ERROR! ${WHITE}Failed to load ${YELLOW}${EXT}${NORMAL}" && exit 1) # <-- SUDO Unnecessary?
fi
# 2. Navigate to /tmp/tcloop2/$EXT
cd /tmp/tcloop2/$EXT
# 3. I'm seeing LINKS and FILES in tce.installed... LINKS are from /tmp/tcloop/EXT, FILES are dummy/empty that didn't exist.
<skipped>
# 4. Use find -exec to mkdir all DIRECTORIES to /fake/*
sudo find * -type d -exec sudo mkdir -p /fake/{} \; # <-- SUDO
# 5. Use find to LINK all FILES into /fake/*
sudo find * -type f -exec sudo ln -s /tmp/tcloop2/${EXT}/{} /fake/{} \; # <-- SUDO
# 6. I'm guessing HERE is a good place to launch /usr/local/tce.installed/$EXT
[ -e /usr/local/tce.installed/$EXT ] && sudo sh /usr/local/tce.installed/$EXT # <-- SUDO
# 7. I don't know if files are SCANNED (libraries) or if ldconfig is called "just in case"
sudo /sbin/ldconfig >/dev/null 2>&1 # <-- SUDO
# 8. I'm also guessing for hardware/firmware/modules we need to call udevadm - unsure of our trigger
# find * -type d -name modules? Or -name modules* needed for x64/pi/etc?
UPDATE: Move #6 to the end
...it was quicker than dredging through TCE :)... I was able to cut 10 seconds by deleting a bunch of old error logs that were part of the backup. ...Backup/restore functions can really eat up time if many and/or
mkdir "$(readlink /etc/sysconfig/tcedir)/../MyData"
ln -s "$(readlink /etc/sysconfig/tcedir)/../MyData" MyData
... I'm guessing all of these scripts assume $USER is a sudoer?Yes.
...it was quicker than dredging through TCE :)There is a lot going on there.
Any insight from experience? (When you have a minute!)
# If load local or install then also check if already installed.
if [ "$INSTALL" ] && [ ! "$BOOTING" ]; then
if [ -f "$TCEINSTALLED/$APPNAME" ]; then
echo "$APPNAME is already installed!"
continue
fi
The links are post install scripts. The rest are empty files.Code: [Select]# 3. I'm seeing LINKS and FILES in tce.installed...
find is only used to determine if an extension is empty (meta extension)Code: [Select]# 4. Use find -exec to mkdir all DIRECTORIES to /fake/*
sudo find * -type d -exec sudo mkdir -p /fake/{} \; # <-- SUDO
# 5. Use find to LINK all FILES into /fake/*
sudo find * -type f -exec sudo ln -s /tmp/tcloop2/${EXT}/{} /fake/{} \; # <-- SUDO
yes "$FORCE" | sudo /bin/cp -ais /tmp/tcloop/"$APPNAME"/* / 2>/dev/null
If $BOOTING ldconfig is called after all of onboot.lst is installed.Code: [Select]# 7. I don't know if files are SCANNED (libraries) or if ldconfig is called "just in case"
Right after creating links from extension into file system:Code: [Select]# 8. I'm also guessing for hardware/firmware/modules we need to call udevadm - unsure of our trigger
# find * -type d -name modules? Or -name modules* needed for x64/pi/etc?
[ -n "`find /tmp/tcloop/$APPNAME -type d -name modules`" ] && MODULES=TRUE
Then update_system gets called which includes this: if [ "$MODULES" ]; then
sudo /sbin/depmod -a 2>/dev/null
sudo /sbin/udevadm trigger
It depends:Code: [Select]# 6. I'm guessing HERE is a good place to launch /usr/local/tce.installed/$EXT
[ -e /usr/local/tce.installed/$EXT ] && sudo sh /usr/local/tce.installed/$EXT # <-- SUDO
if [ -x "$TCEINSTALLED"/$2 ]; then
if [ "$BOOTING" ] ; then
echo "$TCEINSTALLED"/$2 >> /tmp/setup.lst
else
sudo "$TCEINSTALLED"/$2
fi
else
touch "$TCEINSTALLED"/$2
fi
If you add the label or uuid option to waitusb, it will proceed as soon as the device shows up, with the 5 secs becoming the max value.Ahh.. thanks...
Sadly: it will not help as the uuid is already there (I created the install by using the tiny-core "create install gui"
did a forum search for "waitusb=uuid" via the forum search page
(https://forum.tinycorelinux.net/index.php?action=search)
(change the search order to "most recent topics first")
and there are currently four results
Sadly: it will not help as the uuid is already there (I created the install by using the tiny-core "create install gui"
You use the uuid already created - search these forums or see the wiki to see how to do it.
DEFAULT core
LABEL core
KERNEL /tce/boot/vmlinuz
INITRD /tce/boot/core.gz
APPEND quiet host=huis syslog cron tz=CET-1CEST,M3.5.0,M10.5.0/3 waitusb=5:UUID="a6f362cf-6c77-4fb7-bb05-76724d3b8113" tce=UUID="a6f362cf-6c77-4fb7-bb05-76724d3b8113"