WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: init (error -26) with Core 15.0  (Read 1240 times)

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11745
Re: init (error -26) with Core 15.0
« Reply #15 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

Offline gadget42

  • Hero Member
  • *****
  • Posts: 844
Re: init (error -26) with Core 15.0
« Reply #16 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!
The fluctuation theorem has long been known for a sudden switch of the Hamiltonian of a classical system Z54 . For a quantum system with a Hamiltonian changing from... https://forum.tinycorelinux.net/index.php/topic,25972.msg166580.html#msg166580

Offline CNK

  • Wiki Author
  • Sr. Member
  • *****
  • Posts: 308
Re: init (error -26) with Core 15.0
« Reply #17 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.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11745
Re: init (error -26) with Core 15.0
« Reply #18 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 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.

Offline CNK

  • Wiki Author
  • Sr. Member
  • *****
  • Posts: 308
Re: init (error -26) with Core 15.0
« Reply #19 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.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11745
Re: init (error -26) with Core 15.0
« Reply #20 on: January 05, 2025, 01:25:33 AM »
Hi CNK
... I think RAMDISK was a red herring. ...
I think you might be right.

Offline linic

  • Newbie
  • *
  • Posts: 24
Re: init (error -26) with Core 15.0
« Reply #21 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!

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11745
Re: init (error -26) with Core 15.0
« Reply #22 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.