WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11725
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: 838
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: 307
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.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11725
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: 307
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.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11725
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.