Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: linic on December 23, 2024, 03:37:35 PM

Title: init (error -26) with Core 15.0
Post by: linic on December 23, 2024, 03:37:35 PM
With Core 15.0, init fails with error code -26 on by IBM 560Z (Pentium II, 64 MB of RAM). I have a working Core 14.0 frugal install on it which works very well.

Just for testing, I tried this:
Code: [Select]
0. boot my frugal Core 14.0 install like I usually do.
1. wget the new version of core.iso in /home/tc/
2. mkdir c15 && mount core.iso c15/
3. mount /dev/sda1 (this is where my /tce/boot/ is)
4. sudo mkdir /mnt/sda1/tce/boot/c15
5. cp /home/tc/c15/boot/core.gz /mnt/sda1/tce/boot/c15/core15.gz
6. cp /home/tc/c15/boot/vmlinuz /mnt/sda1/tce/boot/c15/vmlinuz15

Then, I edited /mnt/sda1/tce/boot/extlinux/extlinux.conf to add the following

Code: [Select]
LABEL core15
KERNEL /tce/boot/c15/vmlinuz15
INITRD /tce/boot/c15/core15.gz
APPEND vga=789 base norestore syslog showapps nozswap

vmlinuz15 and core15.gz get loaded and the boot process starts until it fails with:

Code: [Select]
Run /init as init process
Failed to execute /init (error -26)
Run /sbin/init as init process
Starting init: /sbin/init exists but couldn't execute it (error -26)
Run /etc/init as init process
Run /bin/init as init process
Run /bin/sh as init process
Starting init: /bin/sh exists but couldn't execute it (error -26)
Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
Kernel Offset: disabled
Rebooting in 60 seconds..

I tried the same thing with Core 14.0 by copying the core.gz and the vmlinuz in /mnt/sda1/tce/boot/c14/core14.gz and /mnt/sda1/tce/boot/c14/vmlinuz14 and added the following to /mnt/sda1/tce/boot/extlinux/extlinux.conf

Code: [Select]
LABEL core14
KERNEL /tce/boot/c14/vmlinuz14
INITRD /tce/boot/c14/core14.gz
APPEND vga=789 base norestore syslog showapps nozswap

This works well.

Before going deeper into this rabbit hole, does anyone know why I'm getting error -26 only with Core 15.0? Thank you!

    [Edit]: Added code tags.  Rich
Title: Re: init (error -26) with Core 15.0
Post by: Rich on December 23, 2024, 05:27:57 PM
Hi linic
Please use  Code Tags  when posting commands and responses seen in a terminal. To use  Code Tags  click on the  #  icon
above the reply box and paste your text between the  Code Tags  as shown in this example:

Quote
[code][   36.176529] pcm512x 1-004d: Failed to get supply 'AVDD': -517
[   36.176536] pcm512x 1-004d: Failed to get supplies: -517
[   36.191753] pcm512x 1-004d: Failed to get supply 'AVDD': -517[/code]

It will appear like this in your post:
Code: [Select]
[   36.176529] pcm512x 1-004d: Failed to get supply 'AVDD': -517
[   36.176536] pcm512x 1-004d: Failed to get supplies: -517
[   36.191753] pcm512x 1-004d: Failed to get supply 'AVDD': -517

Code Tags  serve as visual markers between what you are trying to say and the information you are posting. They also preserve
spacing so column aligned data displays properly. Code tags also automatically add horizontal and or vertical scrollbars
to accommodate long lines and listings.
Title: Re: init (error -26) with Core 15.0
Post by: Rich on December 23, 2024, 05:30:21 PM
Hi linic
Maybe you are running out of RAM?

Just a thought, try adding a small (64Meg) swap partition to your device.
Title: Re: init (error -26) with Core 15.0
Post by: linic on December 24, 2024, 06:50:55 AM
Hi Rich,

Thanks for responding so quickly! I'll use the Code Tags from now on.

About, the swap partition, I have one of 3145724k. Here's an excerpt of the logs which print on the screen at
boot up for 14.0:

Code: [Select]
[...]
fb0: VESA VGA frame buffer device
ccp_crypto: Cannot load: there are no available CC
Driver for HIFM 795x crypto accelerator chip has been successfully registered.
hid: raw HID events driver (C) Jiri Kosina
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
usb 1-1: new full-speed USB device number 2 using uhci_hcd
ipip: IPv4 amd MPLS over IPv4 tunneling driver
initializing XFRM netlink socket
MET: Registered PF_PACKET protocol family
Key type dns_resolver registered
microcode: sig=0x652, pf=0x2, revision=0x2c
microcode: Microcode Update Driver: v2.2
IPI shorthand broadcast: enabled
registered taskstats version 1
Key type .fscrypt registered
Key type fscrypt-provisioning registered
Key type encrypted registered
Freeing unused kernel image (initmem) memory: 732K
Write protecting kernel text and read-only data: 8500k
Run /init as init process
init started: BusyBox v1.36.0 (2023-01-17 10:14:32 UTC)
[...screen clears out...]
Booting Core 14.0
Running Linux Kernel 6.1.2-tinycore
[...]
Adding 3145724k swap on /dev/sda2. Priority:-2 extents:1 accross:3145724k SS
Possible swap partition(s) enabled.

With 15.0, I get:

Code: [Select]
[...]
MET: Registered PF_PACKET protocol family
Key type dns_resolver registered
microcode: Microcode Update Driver: v2.2
IPI shorthand broadcast: enabled
registered taskstats version 1
Key type .fscrypt registered
Key type fscrypt-provisioning registered
Key type encrypted registered
Freeing unused kernel image (initmem) memory: 772K
Write protecting kernel text and read-only data: 8780k
Run /init as init process
Failed to execute /init (error -26)
Run /sbin/init as init process
Starting init: /sbin/init exists but couldn't execute it (error -26)
Run /etc/init as init process
Run /bin/init as init process
Run /bin/sh as init process
Starting init: /bin/sh exists but couldn't execute it (error -26)
Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
Kernel Offset: disabled
Rebooting in 60 seconds..

It looks like swap is only loaded when init and BusyBox have started.

Interestingly I was able to boot using this entry

Code: [Select]
LABEL vmlinuz15withcore14
KERNEL /tce/boot/c15/vmlinuz15
INITRD /tce/boot/c14/core14.gz
APPEND vga=789 base norestore syslog showapps nozswap

and I get:

Code: [Select]
[...]
MET: Registered PF_PACKET protocol family
Key type dns_resolver registered
microcode: Microcode Update Driver: v2.2
IPI shorthand broadcast: enabled
registered taskstats version 1
Key type .fscrypt registered
Key type fscrypt-provisioning registered
Key type encrypted registered
clk: Disabling unused clocks
Freeing unused kernel image (initmem) memory: 772K
Write protecting kernel text and read-only data: 8780k
Run /init as init process
init started: BusyBox v1.36.0 (2023-01-17 10:14:32 UTC)
[...screen clears out...]
Booting Core 14.0
Running Linux Kernel 6.6.8-tinycore
[...]
Adding 3145724k swap on /dev/sda2. Priority:-2 extents:1 accross:3145724k SS
Possible swap partition(s) enabled.

Does /init comes from BusyBox? Since swapping the core.gz makes init work, it looks like my issue comes from the version of BusyBox which comes with 15.0.

Additionaly, I searched for error -26 and it looks like it is ETXTBSY and happens when something writes to a file that is being executed (https://lwn.net/Articles/866493/). I don't understand which file init would be modifying which is also being executed. init is the first process and the parent of all other processes. Would it be trying to modify itself after it has started execution? Could another possibility maybe be that error -26 is not accurate and the new init has an insctruction that the CPU doesn't support and this fails in a weird way returning error -26?
Title: Re: init (error -26) with Core 15.0
Post by: Juanito on December 24, 2024, 07:09:09 AM
/sbin/init is provided by busybox, but looks like it is called by /init, which is a script.

You could try replacing /bin/busybox in tc-15.x by the one in tc-14 to confirm if busybox is the problem or not?
Title: Re: init (error -26) with Core 15.0
Post by: Rich on December 24, 2024, 10:07:23 AM
Hi linic
I did a little experimenting.

I added a Core15 entry on one of my machines with your boot codes.
The machine booted up fine.

Then I decided to make the machine look a little more like yours and
added the boot code:
Code: [Select]
mem=64MThis time I got the same /init (error -26) errors as you did.
Title: Re: init (error -26) with Core 15.0
Post by: Rich on December 24, 2024, 10:56:24 AM
Hi linic
I tried a few more things.

When I increased the memory by 8Meg:
Code: [Select]
mem=72Mit no longer got  /init errors. It did eventually stop with
an out of memory error.

I then added the boot code:
Code: [Select]
udev.children-max=1Found here:
https://forum.tinycorelinux.net/index.php/topic,24886.msg158364.html#msg158364
That got me to a command prompt.

But lowering the other boot code back to:
Code: [Select]
mem=64Mcaused the /init errors to return.

So it looks like you're right on the edge memory wise.
Title: Re: init (error -26) with Core 15.0
Post by: linic on December 25, 2024, 08:10:03 AM
Hi Rich,

Thanks for checking that! You're awesome! Thanks for the boot codes. I didn't know about them. Looks like I was lucky using 14.0 initially which requires a little less RAM.

Have an awesome 25th of December!
Title: Re: init (error -26) with Core 15.0
Post by: Rich on December 25, 2024, 08:17:27 AM
Hi linic
Sorry I couldn't give you any better news.

For future reference, here's where a list of kernel boot codes can be found:
https://www.mjmwired.net/kernel/Documentation/kernel-parameters.txt
Title: Re: init (error -26) with Core 15.0
Post by: patrikg on December 25, 2024, 05:03:13 PM
And to the boot codes for tc you have them here:

https://distro.ibiblio.org/tinycorelinux/faq.html#bootcodes (https://distro.ibiblio.org/tinycorelinux/faq.html#bootcodes)
Title: Re: init (error -26) with Core 15.0
Post by: mocore on December 25, 2024, 05:18:15 PM
And to the boot codes for tc you have them here:

https://distro.ibiblio.org/tinycorelinux/faq.html#bootcodes (https://distro.ibiblio.org/tinycorelinux/faq.html#bootcodes)

and or there  https://wiki.tinycorelinux.net/doku.php?id=wiki:boot_options
Title: Re: init (error -26) with Core 15.0
Post by: Rich on January 01, 2025, 01:48:15 AM
Hi linic
Though it won't solve your problem, I did find something interesting.
Even though I allocated 72 Mbytes of RAM, free reports only 60 Mbytes present:
Code: [Select]
free -m
              total        used        free      shared  buff/cache   available
Mem:             60          10          22          20          27          26
Swap:             7           0           7

Looking through dmesg shows the missing 12 Mbytes used as a RAM disk:
Code: [Select]
    47.59M    59.76M    12.17M  RAMDISK: [mem 0x02f98000-0x03bc3fff]
Title: Re: init (error -26) with Core 15.0
Post by: CNK on January 01, 2025, 06:39:23 PM
Though it won't solve your problem, I did find something interesting.
Even though I allocated 72 Mbytes of RAM, free reports only 60 Mbytes present:
Code: [Select]
free -m
              total        used        free      shared  buff/cache   available
Mem:             60          10          22          20          27          26
Swap:             7           0           7


Looking through dmesg shows the missing 12 Mbytes used as a RAM disk:
Code: [Select]
    47.59M    59.76M    12.17M  RAMDISK: [mem 0x02f98000-0x03bc3fff]

Interesting. I've always put this down to the size of the Linux kernel being subtracted from the total. But 0x03bc3fff - 0x02f98000 = 12,763,135 decimal so around the 12MB missing from the total.

The documentation for RAMDISK (https://www.kernel.org/doc/html/latest/admin-guide/blockdev/ramdisk.html) says it can be configured with the ramdisk_size= kernel parameter. Although I'm confused that only 4MB is missing from the 80MB physical RAM in my PC running Damn Small Linux (kernel 2.4.31) even though it's using the default 4096K block size:

Code: [Select]
free -m
             total       used       free     shared    buffers     cached
Mem:            76         61         14          0          3         35
-/+ buffers/cache:         22         54
Swap:          101          0        101

dmesg | grep RAMDISK
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize

Does TCL reserve three 4MB RAMDISKs instead of one? But then DSL's dmesg says it's initialised 16! I'm confused. This might be something to play with when I have time to see if I can squeeze new TCL HDD installs on my i486 laptop more easily in its 16MB of RAM (TC15 was a really tight fit).
Title: Re: init (error -26) with Core 15.0
Post by: Rich on January 01, 2025, 09:16:31 PM
Hi CNK
...
Code: [Select]
----- Snip -----
dmesg | grep RAMDISK
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize

 ... But then DSL's dmesg says it's initialised 16! I'm confused. ...
I suspect DSL probably created 16 devices (/dev/ram0 - /dev/ram15) each
capable of addressing 4 Mbytes, but hasn't allocated memory to them yet
because they are not currently in use.
Title: Re: init (error -26) with Core 15.0
Post by: CNK on January 01, 2025, 09:58:30 PM
I suspect DSL probably created 16 devices (/dev/ram0 - /dev/ram15) each
capable of addressing 4 Mbytes, but hasn't allocated memory to them yet
because they are not currently in use.

That could be, but I'm not sure why TCL would be using any. According to this interesting description of the differences between ramdisk, ramfs, rootfs and initramfs (https://www.kernel.org/doc/html/latest/filesystems/ramfs-rootfs-initramfs.html), since kernel 2.6 ramdisk isn't used during boot, replaced by initramfs.

The default ramdisk size and number can be changed in the kernel configuration, and it seems TC15 x86 uses these values:
Code: [Select]
CONFIG_BLK_DEV_RAM_COUNT=8
CONFIG_BLK_DEV_RAM_SIZE=8192

So 8MB ramdisk block size instead of the standard 4MB. I'm still not clear on how or if that can subtract from available memory if the ramdisks aren't used though.
Title: Re: init (error -26) with Core 15.0
Post by: Rich on January 02, 2025, 01:42:39 AM
Hi linic
I think I found something.
Instead of using core.gz for the initrd, I used rootfs.gz found here:
http://tinycorelinux.net/15.x/x86/release/distribution_files/

I was able to boot with mem= set to 64M, 48M, and 40M.
It failed with mem= set to 32M.

Add the boot code:
Code: [Select]
udev.children-max=1Download rootfs to /tce/boot/c15/.
Change the INITRD line to this:
Code: [Select]
INITRD /tce/boot/c15/rootfs.gz
That should get you to a command line, but you'll only have
drivers that are built into the kernel.

Stripping out some unneeded drivers from core.gz should make
it bootable.

These are some of the more heavily populated directories:
Code: [Select]
tc@E310:~$ du -cs TinycoreISOs/Core15/lib/modules/6.6.8-tinycore/kernel/drivers/net
6.1M    TinycoreISOs/Core15/lib/modules/6.6.8-tinycore/kernel/drivers/net
6.1M    total
tc@E310:~$ du -cs TinycoreISOs/Core15/lib/modules/6.6.8-tinycore/kernel/drivers/platform
820K    TinycoreISOs/Core15/lib/modules/6.6.8-tinycore/kernel/drivers/platform
820K    total
tc@E310:~$ du -cs TinycoreISOs/Core15/lib/modules/6.6.8-tinycore/kernel/drivers/hid
712K    TinycoreISOs/Core15/lib/modules/6.6.8-tinycore/kernel/drivers/hid
712K    total
Title: Re: init (error -26) with Core 15.0
Post by: gadget42 on January 02, 2025, 02:20:50 AM
@CNK, you referenced DSL(damnsmalllinux) but which version are you using for this experiment(ing)? thanks in advance!
Title: Re: init (error -26) with Core 15.0
Post by: CNK on January 02, 2025, 05:25:50 PM
@CNK, you referenced DSL(damnsmalllinux) but which version are you using for this experiment(ing)?

v. 4.4.10.
Title: Re: init (error -26) with Core 15.0
Post by: Rich on January 03, 2025, 12:13:44 AM
Hi linic
I was able to boot to a desktop with 64 Mbytes.
First I trimmed down the initrd (core.gz):
Code: [Select]
#!/bin/sh

# Fetch a fresh copy of the initrd.
wget http://repo.tinycorelinux.net/15.x/x86/release/distribution_files/core.gz

# Create a temporary workspace.
mkdir tmp
cd tmp

# Unpack the initrd
zcat ../core.gz | sudo cpio -i


# ---------------- Modify this section to match your system ---------------- #
# Find the driver for our NIC.
find lib/modules/6.6.8-tinycore/kernel/ -name sky2.ko*
# The find command returned this:
# lib/modules/6.6.8-tinycore/kernel/drivers/net/ethernet/marvell/sky2.ko.gz

# Save a copy of the directory containing our driver.
sudo mv lib/modules/6.6.8-tinycore/kernel/drivers/net/ethernet/marvell ../

# Remove the  net  directory (about 6 Mbytes).
sudo rm -rf lib/modules/6.6.8-tinycore/kernel/drivers/net

# Recreate the path for our saved directory.
sudo mkdir -p lib/modules/6.6.8-tinycore/kernel/drivers/net/ethernet

# Move our saved directory back to its original location.
sudo mv ../marvell lib/modules/6.6.8-tinycore/kernel/drivers/net/ethernet/
# ---------------------- End of modification section ----------------------- #


# Recreate modules.alias and modules.dep in lib/modules/6.6.8-tinycore/.
sudo depmod -a -b . 6.6.8-tinycore

# We don't need the symbols file.
sudo rm -f lib/modules/6.6.8-tinycore/*symbols

# Re-pack the initrd.
sudo find . | sudo cpio -o -H newc | gzip > ../core15Stripped.gz

# Back to our starting directory.
cd ..

# Clean up.
sudo rm -rf tmp
rm -f core.gz

echo "Your new initrd is called core15Stripped.gz"
I found my NIC driver, saved its directory, removed the net directory, and
then restored the directory I saved and re-packed the initrd.
The new size is about 7.3 Mbytes.

I booted with the modified initrd and these parameters and a new partition:
Code: [Select]
menuentry "*** Core-15-x86" {
search --no-floppy --fs-uuid --set=root 2bd65bbc-d71a-48be-8e35-f72f81453a15
linux /tce/Core15/vmlinuz udev.children-max=1 nodhcp nozswap norestore waitusb=5:UUID="2bd65bbc-d71a-48be-8e35-f72f81453a15" tce=UUID="2bd65bbc-d71a-48be-8e35-f72f81453a15"  home=UUID="2bd65bbc-d71a-48be-8e35-f72f81453a15" opt=UUID="2bd65bbc-d71a-48be-8e35-f72f81453a15"
initrd /tce/Core15/core15Stripped.gz
}
This will create a persistent /home and /opt. You need to use a UUID that matches your system

Now run this to create a tce directory:
Code: [Select]
tce-setdrive
You'll want to clear out the  /opt/.filetool.lst  file so /home and /opt
can't get caught up in a backup:
Code: [Select]
> /opt/.filetool.lst
Create /opt/eth0.sh:
Code: [Select]
#!/bin/sh
pkill udhcpc
ifconfig eth0 192.168.1.49 netmask 255.255.255.0 broadcast 192.168.1.255 up
route add default gw 192.168.1.1
echo nameserver 68.237.161.12 > /etc/resolv.conf
echo nameserver 71.243.0.12 >> /etc/resolv.conf

Edit /opt/bootlocal.sh:
Code: [Select]
#!/bin/sh
# put other system startup commands here

/opt/eth0.sh

Reboot and run ifconfig to make sure the network is up.

Then:
Code: [Select]
tce-load -w Xvesa flwm_topside aterm wbar
tce-load -i Xvesa flwm_topside aterm wbar
Xvesa -listmodes
Pick a mode suitable for your screen.

Then edit .xsession:
Code: [Select]
/usr/local/bin/Xvesa -mode 0x0165 -br -nolisten tcp &
export XPID=$!
waitforX || ! echo failed in waitforX || exit
"$DESKTOP" 2>/tmp/wm_errors &
export WM_PID=$!
[ -x $HOME/.setbackground ] && $HOME/.setbackground
[ -x $HOME/.mouse_config ] && $HOME/.mouse_config &
[ $(which "$ICONS".sh) ] && ${ICONS}.sh &
[ -d "/usr/local/etc/X.d" ] && find "/usr/local/etc/X.d" -type f -o -type l | sort | while read F; do . "$F"; done
[ -d "$HOME/.X.d" ] && find "$HOME/.X.d" -type f -o -type l | sort | while read F; do . "$F"; done

Then:
Code: [Select]
startxand I was presented with a desktop.

I opened a terminal and:
Code: [Select]
tc@box:~$ sudo cache-clear
tc@box:~$ sync
tc@box:~$ free -m
              total        used        free      shared  buff/cache   available
Mem:             52          29          12           5          11          15
Swap:           999          12         987
tc@box:~$
I also have a swap partition that's supplying some space.

Populate onboot.lst:
Code: [Select]
printf "Xvesa\nflwm_topside\naterm\nwbar\n" > /etc/sysconfig/tcedir/onboot.lst
It now boots right into the desktop.

A copy of the script that modified the initrd is attached.

    [Edit]: Xorg-7.7 should not have been listed. Changed them to Xvesa.  Rich
Title: Re: init (error -26) with Core 15.0
Post by: CNK on January 04, 2025, 08:09:47 PM
Even though I allocated 72 Mbytes of RAM, free reports only 60 Mbytes present:
Code: [Select]
free -m
              total        used        free      shared  buff/cache   available
Mem:             60          10          22          20          27          26
Swap:             7           0           7

Looking through dmesg shows the missing 12 Mbytes used as a RAM disk:
Code: [Select]
    47.59M    59.76M    12.17M  RAMDISK: [mem 0x02f98000-0x03bc3fff]

I think RAMDISK was a red herring. I've done some testing in TC8 (Linux kernel 4.8.17) on my laptop (with 768MB physical RAM but some memory used for graphics) and RAMDISK settings "ramdisk.rd_nr=1" or "ramdisk_size=10" don't seem to have an effect on "total" memory reported by free (763652 (745MB)).

This line in dmesg is more relevent:
Code: [Select]
Memory: 755572K/777656K available (4670K kernel code, 422K rwdata, 1288K rodata, 588K init, 532K bss, 22084K reserved, 0K cma-reserved, 0K highmem)

Also on my router with 32MB RAM, OpenWRT 23's Linux kernel (5.15.137) doesn't appear to be built with RAMDISK enabled, yet 10MB is missing from the total RAM reported by free on that:

Code: [Select]
root@OpenWrt:~# ls /dev/ram*
ls: /dev/ram*: No such file or directory
root@OpenWrt:~# dmesg | grep Memory:
Memory: 22176K/32768K available (7124K kernel code, 641K rwdata, 884K rodata, 1328K init, 221K bss, 10592K reserved, 0K cma-reserved)
root@OpenWrt:~# free
              total        used        free      shared  buff/cache   available
Mem:          23504       16424        3616          80        3464        3772
Swap:             0           0           0
root@OpenWrt:~# dmesg | grep RAM
32MB of RAM installed
root@OpenWrt:~# uname -a
Linux OpenWrt 5.15.137 #0 SMP Tue Nov 14 13:38:11 2023 mips GNU/Linux

The 1328K shown for "init" on the "Memory:" line seems to have been freed after boot.

So it's just a coincidence that RAMDISK happened to assign the same amount of memory as was reserved by the Linux kernel in your testing. It's the kernel itself taking up most of the space (besides and hardware-specific memory regions reserved by the GPU or the BIOS) and unfortunately this will keep increasing as the Linux kernel keeps getting fatter.
Title: Re: init (error -26) with Core 15.0
Post by: Rich on January 05, 2025, 01:25:33 AM
Hi CNK
... I think RAMDISK was a red herring. ...
I think you might be right.
Title: Re: init (error -26) with Core 15.0
Post by: linic on January 15, 2025, 07:42:38 AM
Hi linic
I was able to boot to a desktop with 64 Mbytes.
First I trimmed down the initrd (core.gz):
Code: [Select]
#!/bin/sh

# Fetch a fresh copy of the initrd.
wget http://repo.tinycorelinux.net/15.x/x86/release/distribution_files/core.gz

# Create a temporary workspace.
mkdir tmp
cd tmp

# Unpack the initrd
zcat ../core.gz | sudo cpio -i


# ---------------- Modify this section to match your system ---------------- #
# Find the driver for our NIC.
find lib/modules/6.6.8-tinycore/kernel/ -name sky2.ko*
# The find command returned this:
# lib/modules/6.6.8-tinycore/kernel/drivers/net/ethernet/marvell/sky2.ko.gz

# Save a copy of the directory containing our driver.
sudo mv lib/modules/6.6.8-tinycore/kernel/drivers/net/ethernet/marvell ../

# Remove the  net  directory (about 6 Mbytes).
sudo rm -rf lib/modules/6.6.8-tinycore/kernel/drivers/net

# Recreate the path for our saved directory.
sudo mkdir -p lib/modules/6.6.8-tinycore/kernel/drivers/net/ethernet

# Move our saved directory back to its original location.
sudo mv ../marvell lib/modules/6.6.8-tinycore/kernel/drivers/net/ethernet/
# ---------------------- End of modification section ----------------------- #


# Recreate modules.alias and modules.dep in lib/modules/6.6.8-tinycore/.
sudo depmod -a -b . 6.6.8-tinycore

# We don't need the symbols file.
sudo rm -f lib/modules/6.6.8-tinycore/*symbols

# Re-pack the initrd.
sudo find . | sudo cpio -o -H newc | gzip > ../core15Stripped.gz

# Back to our starting directory.
cd ..

# Clean up.
sudo rm -rf tmp
rm -f core.gz

echo "Your new initrd is called core15Stripped.gz"
I found my NIC driver, saved its directory, removed the net directory, and
then restored the directory I saved and re-packed the initrd.
The new size is about 7.3 Mbytes.

I booted with the modified initrd and these parameters and a new partition:
Code: [Select]
menuentry "*** Core-15-x86" {
search --no-floppy --fs-uuid --set=root 2bd65bbc-d71a-48be-8e35-f72f81453a15
linux /tce/Core15/vmlinuz udev.children-max=1 nodhcp nozswap norestore waitusb=5:UUID="2bd65bbc-d71a-48be-8e35-f72f81453a15" tce=UUID="2bd65bbc-d71a-48be-8e35-f72f81453a15"  home=UUID="2bd65bbc-d71a-48be-8e35-f72f81453a15" opt=UUID="2bd65bbc-d71a-48be-8e35-f72f81453a15"
initrd /tce/Core15/core15Stripped.gz
}
This will create a persistent /home and /opt. You need to use a UUID that matches your system

Now run this to create a tce directory:
Code: [Select]
tce-setdrive
You'll want to clear out the  /opt/.filetool.lst  file so /home and /opt
can't get caught up in a backup:
Code: [Select]
> /opt/.filetool.lst
Create /opt/eth0.sh:
Code: [Select]
#!/bin/sh
pkill udhcpc
ifconfig eth0 192.168.1.49 netmask 255.255.255.0 broadcast 192.168.1.255 up
route add default gw 192.168.1.1
echo nameserver 68.237.161.12 > /etc/resolv.conf
echo nameserver 71.243.0.12 >> /etc/resolv.conf

Edit /opt/bootlocal.sh:
Code: [Select]
#!/bin/sh
# put other system startup commands here

/opt/eth0.sh

Reboot and run ifconfig to make sure the network is up.

Then:
Code: [Select]
tce-load -w Xorg-7.7 flwm_topside aterm wbar
tce-load -i Xorg-7.7 flwm_topside aterm wbar
Xvesa -listmodes
Pick a mode suitable for your screen.

Then edit .xsession:
Code: [Select]
/usr/local/bin/Xvesa -mode 0x0165 -br -nolisten tcp &
export XPID=$!
waitforX || ! echo failed in waitforX || exit
"$DESKTOP" 2>/tmp/wm_errors &
export WM_PID=$!
[ -x $HOME/.setbackground ] && $HOME/.setbackground
[ -x $HOME/.mouse_config ] && $HOME/.mouse_config &
[ $(which "$ICONS".sh) ] && ${ICONS}.sh &
[ -d "/usr/local/etc/X.d" ] && find "/usr/local/etc/X.d" -type f -o -type l | sort | while read F; do . "$F"; done
[ -d "$HOME/.X.d" ] && find "$HOME/.X.d" -type f -o -type l | sort | while read F; do . "$F"; done

Then:
Code: [Select]
startxand I was presented with a desktop.

I opened a terminal and:
Code: [Select]
tc@box:~$ sudo cache-clear
tc@box:~$ sync
tc@box:~$ free -m
              total        used        free      shared  buff/cache   available
Mem:             52          29          12           5          11          15
Swap:           999          12         987
tc@box:~$
I also have a swap partition that's supplying some space.

Populate onboot.lst:
Code: [Select]
printf "Xorg-7.7\nflwm_topside\naterm\nwbar\n" > /etc/sysconfig/tcedir/onboot.lst
It now boots right into the desktop.

A copy of the script that modified the initrd is attached.
Thanks Rich!! What you have done is epic!
I hadn't attempted to boot in the graphical desktop because I thought that would use too much RAM. I will try that once I get a moment.

Sorry for the late reply. I got very busy lately and also got absorbed in building a custom kernel + core.gz after seeing that I could switch them easily.
The result is this: https://github.com/linic/tcl-core-560z. I was able to boot in core as I did with 14.0. Here's what the memory usage looked like with my TCZs loaded:
Code: [Select]
              total        used        free      shared  buff/cache   available
Mem:          56752       11476       20764       13244       24512       28312
Swap:       3145724           0     3145724
I added a link to your post in this section https://github.com/linic/tcl-core-560z?tab=readme-ov-file#summary. It will be useful for people who don't want to build their own kernel.

Kudos to you Rich and to all the team which supports tiny core linux!! This distribution is so fun to learn from! It's great how its moving parts (TCZs, core.gz kernel (vmlinuz)) are broken down so clearly and are so easily interchangeable!

Thanks again!
Title: Re: init (error -26) with Core 15.0
Post by: Rich on January 15, 2025, 12:12:16 PM
Hi linic
... I hadn't attempted to boot in the graphical desktop because I thought that would use too much RAM. ...
Quote
... Here's what the memory usage looked like with my TCZs loaded: ...
Just for kicks, I exited from the GUI to a prompt and ran free -m:
Code: [Select]
              total        used        free      shared  buff/cache   available
Mem:             52          20          25           5           8          25
Swap:           999          10         989

Quote
... It will be useful for people who don't want to build their own kernel. ...
When it comes to ease of modification, time invested, and predicting
memory savings, I feel modifying core.gz wins hands down.
Core:
Removing drivers does not remove kernel capability. They can quickly be restored.

Removing unneeded drivers is easy as I demonstrated with the network driver.

By editing the script, what gets removed can easily be changed.

The script does all the work consistently and should take under a minute to run.

The file system provided by core.gz resides in RAM. The file sizes you see listed
in those directories is basically what you save in RAM if they are removed. The
same does not apply to extensions that provide drivers. Those get linked to the
RAM file system, not copied to it.

Kernel:
Removing driver support removes capability. Restoring it requires recompiling.

Making changes requires running  make menuconfig. Then navigating through
the menus disabling anything you think you don't want. You should not
edit .config directly. As you enable/disable options, make menuconfig will
enable/disable other options in the background due to changing dependencies.

Depending on hardware, compile time can become extensive. Especially if you
find yourself yourself doing it multiple times.

Predicting memory savings is difficult, more so for the kernel than the drivers.
Kernel size may or may not be affected depending on how an option was implemented.
RAM required may or may not be affected depending on how data structures are affected.

Title: Re: init (error -26) with Core 15.0
Post by: linic on January 18, 2025, 07:13:12 AM
Hi Rich,

Quote
When it comes to ease of modification, time invested, and predicting
memory savings, I feel modifying core.gz wins hands down.

I agree. It's way faster, easier and predictable to modify core.gz.

About custom kernels, I noticed that if I select the components I think I'll need and build directly in the kernel and not as modules the boot process seems faster. At one point, I disabled too many things using make menuconfig, I had no modules and everything was in the kernel and the system booted taking about 1/4 or 1/5 of the usual time, with network, but without being able mount partitions and fdisk -l would show nothing. I was missing some SCSI/ATA/PATA drivers if I remember correctly. What helped me guess a working set of kernel components were /var/log/messages and lsmod from Core 14.0 which doesn't need any customization to boot. Oh and make menuconfig helps also understand what each kernel option does by typing "?". That was also very useful.

About the desktop, I ran this:
Code: [Select]
tce-load -wi Xorg-7.7 flwm_topside aterm wbar
tce-load -wi Xvesa
Xvesa -listmodes

and then edited my .xsession

Code: [Select]
Xvesa -mode 0x0115 -br -2button -mouse /dev/input/mice,5 -nolisten tcp -I >/dev/null 2>&1 &
export XPID=$!
waitforX || ! echo failed in waitforX || exit
"$DESKTOP" 2>/tmp/wm_errors &
export WM_PID=$!
[ -x $HOME/.setbackground ] && $HOME/.setbackground
[ -x $HOME/.mouse_config ] && $HOME/.mouse_config &
[ $(which "$ICONS".sh) ] && ${ICONS}.sh &
[ -d "/usr/local/etc/X.d" ] && find "/usr/local/etc/X.d" -type f -o -type l | sort | while read F; do . "$F"; done
[ -d "$HOME/.X.d" ] && find "$HOME/.X.d" -type f -o -type l | sort | while read F; do . "$F"; done

and got to the desktop too (see screenshot in attachments). I'm blown away by this! Thanks again!
Title: Re: init (error -26) with Core 15.0
Post by: curaga on January 18, 2025, 07:16:28 AM
Yes, custom kernels help boot time quite a bit, in addition to saving space and RAM. Something to have fun with, or if you do want that fast boot.
Title: Re: init (error -26) with Core 15.0
Post by: Rich on January 18, 2025, 01:50:43 PM
Hi linic
... At one point, I disabled too many things using make menuconfig, ...
Which is why I wrote this comment the way I did:
... Then navigating through the menus disabling anything you think you don't want. ...
I've done that too. You look at an option and think "nah, I don't need that", not
realizing there's something else in the dependency chain you do need.

Quote
... About the desktop, I ran this:
Code: [Select]
tce-load -wi Xorg-7.7 flwm_topside aterm wbar
tce-load -wi Xvesa
Xvesa -listmodes
...
Remove  Xorg-7.7  from your  /etc/sysconfig/tcedir/onboot.lst  file.
You don't need it because you're running Xvesa.

Quote
... and got to the desktop too (see screenshot in attachments). I'm blown away by this! Thanks again!
You are quite welcome. Glad it worked out for you.

    [Edit]: Xorg-7.7 in reply #18 was an error. It has been corrected.  Rich
Title: Re: init (error -26) with Core 15.0
Post by: linic on January 20, 2025, 07:38:07 AM
Hi Rich,

Quote
Remove  Xorg-7.7  from your  /etc/sysconfig/tcedir/onboot.lst  file.

Thanks! That saved some memory.

Another thing, if anyone wonders, I started with the linux kernel 5.10.232 which was at the time the latest v5.x kernel because I thought maybe the latest v6.x kernel would be too big to boot due to the 64 MB RAM limit. I'm now running the 6.12.10 kernel with a modified 15.x core.gz and it boots nicely into the desktop.
Code: [Select]
              total        used        free      shared  buff/cache   available
Mem:          55656       30428        4988        7792       20240       13500
Swap:       3145724        5616     3140108