WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Persisting extensions with dynamic remastering on a frugal install  (Read 5581 times)

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
I'm trying to get the scsi extensions to persist on a frugal install and am having a lot of trouble.

The method I'm using is the dynamic remastering method referenced on the wiki [1], with some tips from the netbooting wiki page [2], and some helpful pointers sending me in that direction from genec on irc.

The full method to reproduce my issue is not that long (not indicative of how long it took me to get here!!), so I'll explain it all for the sake of documentation.

First I boot up the CorePlus iso (v4.7.7 at this time) straight to "command line only" and make a frugal install like this:
Code: [Select]
tce-load -wi scsi-`uname -r` #to make the drive accessible!
tce-load -wi tc-install
#do a frugal install from CD...
# - yes to bootloader
# - core only
# - ext4 the whole disk
# - no to every other option
sudo tc-install.sh

If we reboot at this point it does not work because the install created has no scsi drivers.  We need to add the scsi drivers to the intrd.

Per the links above, I now do the dynamic remaster like so:

Code: [Select]
mount /mnt/sda1
#Now make a working area to create a cpio archive that will extract
#to /tmp/builtin (where tce-setup looks for extensions during boot)
mkdir -p /tmp/tmp/builtin/optional
cp /tmp/tce/optional/scsi*.tcz /tmp/tmp/builtin/optional/
echo "scsi-`uname -r`.tcz" > /tmp/tmp/builtin/onboot.lst

#fix up permissions/ownership so unpacking doesn't wreck /tmp
# - may not be required (thought this was one of my issues)
sudo chown -R root:staff /tmp/tmp
sudo chmod 1777 /tmp/tmp
sudo chmod -R 775 /tmp/tmp/builtin

#make the cpio archive...
cd /tmp
find tmp | cpio -o -H newc | gzip -9 > /tmp/scsi-32.cpz

#Now set up extlinux to load the cpio archive to initrd
mv /tmp/scsi-32.cpz /mnt/sda1/tce/boot/
sudo sed -i "s|core.gz|core.gz,/tce/boot/scsi-32.cpz|" /mnt/sda1/tce/boot/extlinux/extlinux.conf

#Rebooting should work now...
sudo reboot

At this point, on reboot, the scsi drivers *are* loaded properly, but pretty much everything else has issues.  A few symptoms are:

1. /mnt/sda1 does not automount (but /dev/sda1 is accessible/mountable)
2. tce-load does not work at all

Crawling through tce-setup and friends and doing some exploring I can see that at least one thing has a serious problem, and that is that the /etc/sysconfig/tcedir symlink is broken, incorrectly pointing to /tce which does not exist.  I see that that dir being symlinked in three scripts (tc-config, tce-setup, and tce-setdrive), but can't yet figure out why it is failing.

What am I doing wrong?  How do you properly make that cpio?  Any other tips/fixes to my method above would also be appreciated.

Topic-wise (and to help future search hits), this involves remastering (dynamic, anyway), microcore, extensions, VMs / Virtual Machines in VMware (where my scsi issue crops up), etc... wasn't sure where to put it so I dropped it into general.

[1] http://wiki.tinycorelinux.net/wiki:dynamic_root_filesystem_remastering
[2] http://wiki.tinycorelinux.net/wiki:netbooting

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Persisting extensions with dynamic remastering on a frugal install
« Reply #1 on: June 20, 2013, 09:30:40 AM »
Did you check the wiki first?
The answer is to not use the scsi driver.

http://wiki.tinycorelinux.net/wiki:vmware_installation

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
Re: Persisting extensions with dynamic remastering on a frugal install
« Reply #2 on: June 20, 2013, 09:50:46 AM »
The answer is to not use the scsi driver.
http://wiki.tinycorelinux.net/wiki:vmware_installation

Sorry -- my question is not actually about vmware.  It is about how to properly persist extensions with dynamic remastering.  I only included the vmware tidbits to make for reference and to make my post more complete.  I probably I should have clarified that I'm aware of that solution already for getting vmware to work.  It, of course, works fine without scsi as mentioned on that page.

In fact, forget the scsi "requirement" in my question entirely... if I follow my method above on a machine where scsi is not required at all, it breaks the installation in the exact same way (notably that that the /etc/sysconfig/tcedir symlink is broken).

ie: it seems there is something about the way I'm doing that initrd that is breaking things.

Offline genec

  • Full Member
  • ***
  • Posts: 240
Re: Persisting extensions with dynamic remastering on a frugal install
« Reply #3 on: June 20, 2013, 12:41:47 PM »
I'd add another directory to insulate.
Code: [Select]
mkdir -p /tmp/rt/tmp/builtin/optional

sudo chown -R root:staff /tmp/rt
sudo chmod 775 /tmp/rt
sudo chmod 1777 /tmp/rt/tmp
sudo chmod -R ug=rwX,o=rX /tmp/rt/tmp/builtin

Second command takes care of the resultant / while the fifth only applies eXecute if already executable.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: Persisting extensions with dynamic remastering on a frugal install
« Reply #4 on: June 20, 2013, 02:47:31 PM »
It sounds like after the driver is loaded from /tmp/builtin, your drive is not yet ready for the probe immediately after.

I'd remaster your scsi driver to the main initrd, so that the drive has more time to initialize.
The only barriers that can stop you are the ones you create yourself.

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Persisting extensions with dynamic remastering on a frugal install
« Reply #5 on: June 20, 2013, 11:49:40 PM »
I don't want to sound like I'm plugging my own script, but the script in this link was created for exactly this reason;  simplistic method to remaster the core initrd.   It was added in the hope that someone other than myself would find it useful

http://forum.tinycorelinux.net/index.php/topic,15493.0.html


use it once, add your module, then use the script one for time to complete, works every time

Am not going to say any more, I promise

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
Re: Persisting extensions with dynamic remastering on a frugal install
« Reply #6 on: June 21, 2013, 12:00:00 AM »
I'd add another directory to insulate.

Thanks for the suggestion.  I tried this and it unfortunately did not work... same problem.  Here's an image right after boot:
http://static.inky.ws/image/4085/Selection_179.png

It sounds like after the driver is loaded from /tmp/builtin, your drive is not yet ready for the probe immediately after.

I'd remaster your scsi driver to the main initrd, so that the drive has more time to initialize.
The timing thing is an interesting idea.  I tried a few things to no avail...

First I tried remastering with some simple sleep calls placed into /usr/bin/tce-setup in between the loading of the "tcz initrd builtins" and the "Next process regular extensions" sections, but these did not work.  In fact, I put sleeps and echoing in all kinds of places in there for debugging and none of it showed up so I was confused.  The changes definitely make it through to the remastered core.gz since the file had the changes upon reboot.  I got lost here and moved on to a full remaster.

Next I did a full remaster, stuffing *all* of the files in scsi-3.0.21-tinycore into the remastered core.gz.  Here is a log of how I did it (it sort of worked, but not really... see below):

Code: [Select]
tc@box:~$ mount /mnt/sda1/
tc@box:~$ cp /mnt/sda1/tce/boot/core.gz .
tc@box:~$ tce-load -wi squashfs-tools-4.x
squashfs-tools-4.x is already installed!
tc@box:~$ unsquashfs -f -d scsi_files /tmp/tce/optional/scsi-3.0.21-tinycore.tcz
Parallel unsquashfs: Using 8 processors
96 inodes (502 blocks) to write

[=============================================================================================================================================================================|] 502/502 100%
created 96 files
created 38 directories
created 0 symlinks
created 0 devices
created 0 fifos
tc@box:~$ ls scsi_files/
usr/
tc@box:~$ cp /mnt/sda1/tce/boot/core.gz .
tc@box:~$ mkdir core_files
tc@box:~$ cd core_files/
tc@box:~/core_files$ zcat ../core.gz | sudo cpio -i -H newc -d
16219 blocks
tc@box:~/core_files$ sudo cp -r ../scsi_files/* .
tc@box:~/core_files$ find | sudo cpio -o -H newc | gzip -9 > ../core.gz
tc@box:~/core_files$ sudo cp ../core.gz /mnt/sda1/tce/boot/core.gz
tc@box:~/core_files$ sudo reboot

The remaster appeared to do what I wanted it to, but even though the files were where I wanted them on reboot, the drivers definitely did not get loaded!  Curiously, the rebooted Core is broken in a very similar way to before, but one step backwards!! As before (with the second initrd file containing the scsi tcz) the tce dir did not get automapped (same dead /etc/sysconfig/tcedir symlink to /tce), but this time the scsi drivers didn't load either, even though they are all present in the remaster.  ie: `fdisk -l` returns nothing.

Is tce-load'ing the scsi extension doing anything other than dropping the files into place?  If not, I don't get why the remaster didn't work. :(

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
Re: Persisting extensions with dynamic remastering on a frugal install
« Reply #7 on: June 21, 2013, 12:04:09 AM »
I don't want to sound like I'm plugging my own script, but the script in this link was created for exactly this reason;  simplistic method to remaster the core initrd.   It was added in the hope that someone other than myself would find it useful
http://forum.tinycorelinux.net/index.php/topic,15493.0.html
use it once, add your module, then use the script one for time to complete, works every time

Great!  Thanks!  I will check this out right now.  Since it works I'll either just use it as-is, or dissect it to get a better understanding of what I should *actually* be doing to make this work.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: Persisting extensions with dynamic remastering on a frugal install
« Reply #8 on: June 21, 2013, 05:24:20 AM »
When you add modules, you need to update the dep files afterwards - this is covered in the remastering wiki. "sudo depmod -a -b ~/core_files"
The only barriers that can stop you are the ones you create yourself.

Offline genec

  • Full Member
  • ***
  • Posts: 240
Re: Persisting extensions with dynamic remastering on a frugal install
« Reply #9 on: June 21, 2013, 06:49:56 PM »
Timing is plausible.  I normally load quite a few extension and don't use a persistent tce/.  I think the only way to load earlier would be unpack core.gz, unsquashfs the extension, then depmod.

coreplayer2, I'll have to check that out.

Offline qopit

  • Jr. Member
  • **
  • Posts: 81
Re: Persisting extensions with dynamic remastering on a frugal install
« Reply #10 on: June 21, 2013, 10:28:35 PM »
As you guys knew, the issue with my remaster was the depmod.  I should have caught that.

coreplayer2 -- your script is awesome and makes remastering really simple in Core.  You should make that into an extension to make it even easier to get!

For potential timing issues with the multimaster approach, I'll have to try depmod'ing after and see if that helps.

Thanks for all the help!