Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: wysiwyg on January 24, 2015, 10:24:40 PM

Title: boot from ntfs
Post by: wysiwyg on January 24, 2015, 10:24:40 PM
Good evening everyone!  I am trying to get TC booting from an NTFS partition and have read the following threads:

http://forum.tinycorelinux.net/index.php/topic,7416.msg39355.html#msg39355
http://forum.tinycorelinux.net/index.php/topic,6931.0.html

Both of which seem out dated (using TC 3.x) so I decided to give it a whirl.  I added ntfs-3g.tcz and fuse.tcz to a remastered image (ran ldconfig beforehand to grab the new libs), but I can seem to get TC to mount the NTFS partition during the boot cycle (where the tce directory is).  Any thoughts on what needs to be fixed?

Thanks,
Dave
Title: Re: boot from ntfs
Post by: gerald_clark on January 24, 2015, 10:36:28 PM
For tce on ntfs, remastering with ntfs-3g is sufficient.
Ezremaster works fine for this.
Title: Re: boot from ntfs
Post by: Lee on January 25, 2015, 01:27:36 PM
Isn't there still an ntfs-3g.gz file that can be loaded alongside core.gz to provide this functionality without even needing to remaster?
Title: Re: boot from ntfs
Post by: wysiwyg on January 26, 2015, 09:40:00 AM
Good morning everyone!

@gerald_clark I didn't use the remaster tool, but I followed the directions in the wiki to repackage with ntfs-3g so unless something was missing from there, I'm not sure what could be going on.  I can mount the drive once I get to a prompt without any issues.  The distro just doesn't seem to see the tce directory to load other extensions during bootup.  Additional thoughts?

@Lee I don't think this would be possible because you will run into an issue where Linux will need to mount the ntfs partition to load the ntfs-3g.tcz extension, but not have the tools to do so.  There does appear to be several ways to include ntfs-3g (or other extensions for that matter) into the gzipped cpio ramdisk though.  Check the wiki for details.

Dave
Title: Re: boot from ntfs
Post by: bmarkus on January 26, 2015, 09:48:18 AM
You do not need ntfs-3g to read ntfs partition, the Linux kernel fs driver can do the job if it is available at boot time (ntfs module is not in base).
Title: Re: boot from ntfs
Post by: wysiwyg on January 26, 2015, 10:28:43 AM
You do not need ntfs-3g to read ntfs partition, the Linux kernel fs driver can do the job if it is available at boot time (ntfs module is not in base).

It doesn't appear to be using the internal ntfs driver or the ntfs-3g driver to mount at boot time.  Any thoughts as to why not?

Thanks,
Dave
Title: Re: boot from ntfs
Post by: wysiwyg on January 26, 2015, 11:14:05 AM
BTW, the boot parameters being used are:

kernel (hd0,2)/xinix64/corepure64-vmlinuz quiet tce=LABEL=OS/xinix64 host=DEVICE1 settime

The partition where the files are located is /dev/sda3 so the line above matches correctly...

Dave
Title: Re: boot from ntfs
Post by: gerald_clark on January 26, 2015, 11:47:17 AM
LABELS may not be readable at that point.  Try specifying tce=sda3/xinix64 ( assuming you are using the directory xinix64 instead of tce ).
Title: Re: boot from ntfs
Post by: wysiwyg on January 26, 2015, 12:01:00 PM
Thanks for the help gerald_clark.  I adjusted the menu.lst file to use sda3 instead of using the partition label, but it is still exhibiting the same behavior...

I also noticed that the mount.ntfs and mount.ntfs-3g symlinks were missing from the ntfs-3g package, so I added them to a remastered cpio file.  I can see the sda3 partition being auto-mounted once I get to a prompt, but it still isn't installing the modules.  Again, once I'm at a prompt I can run "tce-load -i bash" and everything works as designed.  No idea why this isn't loading during bootup.

Dave
Title: Re: boot from ntfs
Post by: wysiwyg on January 26, 2015, 02:23:28 PM
Would there be a reason why the drive is getting mounted, but the tce directory wouldn't get processed?

Thanks,
Dave
Title: Re: boot from ntfs
Post by: gerald_clark on January 26, 2015, 05:33:34 PM
Show us the output of 'showbootcodes'.
Title: Re: boot from ntfs
Post by: wysiwyg on January 26, 2015, 06:25:13 PM
Show us the output of 'showbootcodes'.

quiet tce=sda3/xinix64 host=DEVICE1 settime
Title: Re: boot from ntfs
Post by: wysiwyg on January 26, 2015, 07:45:30 PM
Are there any logs or debug info I can see during the boot cycle to find out where things are going wrong?  I would imagine either the partition isn't getting mounted quickly enough to access the extension files or something is preventing the reading of those files.

Dave
Title: Re: boot from ntfs
Post by: gerald_clark on January 26, 2015, 08:58:51 PM
Remove 'quiet' from the boot options.
Then add a 'pause' option.
The system will then pause for the enter key before running login.
This gives you a chance to use shift and arrow/PG keys to scroll through output.
Title: Re: boot from ntfs
Post by: wysiwyg on January 27, 2015, 09:17:37 AM
Per your advice gerald_clark, I edited the menu.lst file and rebooted.  The only error messages I could see are similar to ones I posted from my 'by-id' thread:

udev[258]: failed to execute '/lib/udev/ata_id' 'ata_id --export /dev/sda': No such file or directory

udev[259]: failed to execute '/lib/udev/ata_id' 'ata_id --export /dev/sr0': No such file or directory

udev[279]: failed to execute '/lib/udev/scsi_id' 'scsi_id --export --whitelisted -d /dev/sda': No such file or directory

udev[311]: failed to execute '/lib/udev/scsi_id' 'scsi_id --export --whitelisted -d /dev/sr0': No such file or directory

The numbers are different, but the messages are the same.  Could this be the issue that is keeping things from working?  What I don't understand is, by the time I get to the cli, the Windows partition is mounted.

Also, right after the "Setting hostname..." line, I can see that squashfs module is being loaded so that should allow the mounting of the extensions.  No messages could be identified that prevents the partition from being used as the tce directory.  Any thoughts on something else to do to identify the problem?  Is there something I can edit to see debug output?

Thanks,
Dave
Title: Re: boot from ntfs
Post by: Misalf on January 27, 2015, 09:43:03 AM
Not sure if this is still valid for TC 6 but might be helpful:
http://yalis.fr/cms/index.php/post/2013/05/12/NTFS-and-modular-boot-for-TinyCore-Linux
Title: Re: boot from ntfs
Post by: gerald_clark on January 27, 2015, 10:16:36 AM
I boot from ntfs on my laptop.
I used ezremaster and included ntfs-3g.tcz and ntfsprogs.tcz.
Title: Re: boot from ntfs
Post by: wysiwyg on January 27, 2015, 10:39:32 AM
@misalf thanks for the link to that script.  It looks like the only parts that I didn't do that are in there are the symlinks in the /usr/local/tce.installed directory and I didn't run the command:

sudo sed -i 's/\$(blkid \$1)/$(blkid $1|sed s@TYPE=\\"ntfs\\"@TYPE=\\"ntfs-3g\\"@g)/' usr/sbin/fstype

Instead I added the /usr/local/sbin/mount.ntfs and mount.ntfs-3g symlinks (which do the same thing I think).

@gerald_clark what steps does ezremaster take to add an extension into a remastered image?  Here's my steps:

mkdir /tmp/extract
cd /tmp/extract
zcat /tmp/corepure64.gz | sudo cpio -i -H newc -d
mount -t squashfs -o loop /tmp/ntfs-3g.tcz /mnt/source
cp -R /mnt/source/* ./
(repeated the above two steps for fuse.tcz; I also created the /usr/local/sbin/mount.ntfs[-3g] symlinks)
ldconfig -r /tmp/extract
rm ../corepure64.gz; sudo find | sudo cpio -o -H newc | gzip -2 > ../corepure64.gz

Also, does your remastered image still allow the loading of extensions from a specified 'optional' directory on the ntfs partition?

Thanks,
Dave
Title: Re: boot from ntfs
Post by: gerald_clark on January 27, 2015, 10:54:09 AM
You did not do the depmod.

http://wiki.tinycorelinux.net/wiki:remastering
Title: Re: boot from ntfs
Post by: wysiwyg on January 27, 2015, 11:10:38 AM
You did not do the depmod.

http://wiki.tinycorelinux.net/wiki:remastering

I didn't run it because I didn't add any kernel modules (ntfs-3g seems to be a user space program).  However, I ran the following two lines before repackaging:

sudo chroot /tmp/extract depmod -a 3.16.6-tinycore64
sudo ldconfig -r /tmp/extract

After rebooting, nothing has changed.  The Windows partition is still getting mounted once I've reached the cli, but no extensions are being loaded from that partition.

Would I need to add the symlinks in the /usr/local/tce.installed directory?  Also, all the files that were added under /usr/local have root:root ownership.  Would that cause any problems?

Thanks,
Dave
Title: Re: boot from ntfs
Post by: wysiwyg on January 27, 2015, 11:20:24 AM
I was also avoiding the ezremaster tool because it seemed difficult to use if I recall correctly.  At this point, I would just like to have a working system so I looked through the wiki on the remaster tool and it says to download the 'ezremaster' extension.  Unfortunately it doesn't appear to be available in the 5.x or 6.x repos for x86_64.  Seems like I'm back to the forums for help.

Dave
Title: Re: boot from ntfs
Post by: Misalf on January 27, 2015, 11:39:08 AM
Scripts in  /usr/local/tce.installed  won't get executed if not contained in an extension.

Quote
Instead I added the /usr/local/sbin/mount.ntfs and mount.ntfs-3g symlinks (which do the same thing I think).
Do you also have  /usr/local/sbin/mount.lowntfs-3g  symlinked to  /usr/local/bin/lowntfs-3g ?
Not sure if it's needed in your case though, but..
Title: Re: boot from ntfs
Post by: wysiwyg on January 27, 2015, 11:52:55 AM
@Misalf the contents of /usr/local/tce.installed are:

-rwxr-xr-x 1 root root   241 Jan 24 21:53 fuse
-rwxr-xr-x 1 root root   205 Jan 24 17:40 ntfs-3g
-rwxr-xr-x 1 root root   455 Jan 27 11:33 udev-extra

I added the symlink to the lowntfs-3g binary, rebooted, but still no mounting of the extensions...  Any other thoughts?

Would there be a way I can add some debug information during the boot cycle?  Something like showing what is mounted before the "Loading extensions..." call during the boot process?  Something has to be up with this...

Thanks,
Dave
Title: Re: boot from ntfs
Post by: Misalf on January 27, 2015, 12:09:45 PM
If you have extracted those extensions into the filesystem (core.gz), tce.installed scripts won't get executed. If you place the extensions in  /tmp/tce/builtin  (also in core.gz - take good care about permissions if doing this manually - also needs an additional /tmp/tce/onboot.lst file IIRC), tce.installed scripts will get executed and create proper symlinks or whatever they are supposed to do. I should stop suggesting thing now, though. Has been a while since I tryed this.

The  syslog  boot code gives lots of messages that you can read after boot in  /var/log/ (messages?).
The  loglevel=x  boot code might give some info while booting.
Title: Re: boot from ntfs
Post by: wysiwyg on January 27, 2015, 12:14:12 PM
@Misalf I was just about to post the following information, but you beat me to it!

It looks like the files in the /usr/local/tce.installed directory are just scripts that should/are executed at some point (boot perhaps).  It looks like the one for ntfs-3g is just supposed to create /sbin/mount.ntfs-3g and lowntfs-3g symlinks.  It appears that these are not getting created during the boot cycle.  Is this indicating another problem somewhere?


@gerald_clark when you boot up from your ntfs partition and run a 'which mount.ntfs', what is getting returned?  I created these symlinks in the /usr/local/sbin directory.  Both are in the $PATH, but I don't know if this may be causing problems.

Dave
Title: Re: boot from ntfs
Post by: Misalf on January 27, 2015, 12:32:54 PM
The thing is, after all extensions have been loaded at boot, only those who were actually listed in the onboot.lst file (and the respective dependencies) will be checked for containing a start script in  /usr/local/tce.installed . For extensions that have been manually extracted into core.gz, this check will not be done.

When creating symlinks manually before remastering (because the start script can't create them), make sure you're in the correct directory. Otherwise, after booting your remastered initrd, the symlinks might point to  /tmp/extractet/usr/... .

Unfortunately, I can't reproduce what I have done (I have ntfs-3g added to my more.gz with correct symlinks). I keep trying.

I thought I did something like this:
Code: [Select]
/tmp/more/usr/local/bin/$ sudo ln -s ntfs-3g ../sbin/mount.ntfs-3g
Title: Re: boot from ntfs
Post by: Misalf on January 27, 2015, 12:45:37 PM
Maybe I did
Code: [Select]
/tmp/more/usr/local/bin/$ sudo ln -s /usr/local/bin/ntfs-3g ../sbin/mount.ntfs-3g

My links work properly and I was actually able to install TC 5.x 32-bit on a friends 64-bit laptop with no problem (I didn't even installed a boot loader to the MBR; just added grubldr from Grub4DOS and a menu.lst file and the booting just worked automagically).
Title: Re: boot from ntfs
Post by: wysiwyg on January 27, 2015, 01:03:14 PM
That's exactly what I did:

cd /usr/local/sbin
ln -s ../bin/ntfs-3g mount.ntfs-3g
ln -s ../bin/ntfs-3g mount.ntfs
ln -s ../bin/lowntfs-3g mount.lowntfs-3g

So these files are stored in the /usr/local/sbin directory.  The ntfs-3g tce.installed script creates them in /bin.  As stated, both of these directories are in the path so either location should work just fine.  From any directory I can execute "mount.ntfs --help" and I get the ntfs-3g help page for the binary so I know the symlinks are correct.  Running 'which mount.ntfs' returns '/usr/local/sbin/mount.ntfs', so that's correct.  Plus the Windows partition is mounted r/w when I check it after a bootup.  Everything appears to work as designed, its just that the extensions aren't being loaded for some reason.

Dave
Title: Re: boot from ntfs
Post by: Rich on January 27, 2015, 01:20:06 PM
Hi wysiwyg
Maybe try this:
http://forum.tinycorelinux.net/index.php/topic,13113.msg72330.html#msg72330
Title: Re: boot from ntfs
Post by: wysiwyg on January 27, 2015, 02:22:33 PM
Hi wysiwyg
Maybe try this:
http://forum.tinycorelinux.net/index.php/topic,13113.msg72330.html#msg72330


So I tried:

cat corepure64.gz fuse.tcz ntfs-3g.tcz > corepure64-test.gz

After rebooting, there are several error messages with the final one saying it is going to reboot in 60 seconds.  So it appears that does not work... Thanks for the attempt though Rich.  Any other thoughts?

Dave
Title: Re: boot from ntfs
Post by: wysiwyg on January 27, 2015, 02:39:12 PM
Has anyone gotten this to work with a modern version of TC (5.x or 6.x)?  Please note, I *CAN* boot from an ntfs partition but I *CAN NOT* get the extensions located on the partition in the tce directory to automatically install during the boot process!!!  If so, what steps did you take to create the ramdisk image being used?  Also, note that this is a 64-bit version of the software, not 32-bit.

Worst case scenario can someone tell me what file I can call a script from that will duplicate the process of the onboot.lst.  This way I'll just loop through that file calling a 'tce-load -i ${EXT}'.  I can't believe it is this difficult to get something so trivial working...

Thanks,
Dave
Title: Re: boot from ntfs
Post by: wysiwyg on January 27, 2015, 03:53:00 PM
Worst case scenario can someone tell me what file I can call a script from that will duplicate the process of the onboot.lst.  This way I'll just loop through that file calling a 'tce-load -i ${EXT}'.

Thanks,
Dave
Title: Re: boot from ntfs
Post by: Rich on January 27, 2015, 03:57:16 PM
Hi wysiwyg
Sorry, I didn't realize this was 64 bit.
Title: Re: boot from ntfs
Post by: wysiwyg on January 27, 2015, 04:21:41 PM
No problem, thanks for you help Rich.

Dave
Title: Re: boot from ntfs
Post by: wysiwyg on January 27, 2015, 07:02:31 PM
Is the code to process the onboot.lst file in a script or a compiled program?  I think I should just be able to add that code verbatim or make a call to the binary as a temporarily solution to the problem.

Thanks,
Dave
Title: Re: boot from ntfs
Post by: Rich on January 27, 2015, 08:21:03 PM
Hi wysiwyg
It's part of the  /etc/init.d/tc-config  script.
Title: Re: boot from ntfs
Post by: wysiwyg on January 28, 2015, 10:24:46 AM
Good morning everyone!  To my surprise the problem encountered by TC not loading the onboot.lst file was that it was edited by a Windows editor at some point which caused the formatting to switch from Linux-based to Microsoft-based.  I re-created the onboot.lst on a Linux system and copied it over to the NTFS partition and everything worked like a charm!  I just wanted to point this out in case anyone comes across this post and are running into problems.  This will give them something else to check in an attempt to resolve the issue.

@Rich thanks for the info!  I actually figured out the above solution by placing some debug code in the /etc/skel/.ashrc file to show info during the final stage of the boot process.  Once I noticed some of the returned info was garbled, I figured out the solution.
Title: Re: boot from ntfs
Post by: bmarkus on January 28, 2015, 10:33:03 AM
I re-created the onboot.lst on a Linux system and copied it over to the NTFS partition and everything worked like a charm! 

dos2unix command can change line ending.
Title: Re: boot from ntfs
Post by: Rich on January 28, 2015, 10:36:37 AM
Hi wysiwyg
Quote
... file was that it was edited by a Windows editor ...
This is a lesson that others have learned and has come up on this forum before. Running  dos2unix  on a text file will fix that assuming
the editor didn't add formatting (bold, underline, etc.). Run  unix2dos  on a text file if you want to open it with  notepad. Another one
that occasionally cause problems is forgetting to hit the carriage return on the last line of a file.
Title: Re: boot from ntfs
Post by: wysiwyg on January 28, 2015, 10:40:30 AM
Just a follow-up so that if anyone stumbles across this post in an effort to enable NTFS booting by the most recent version of TC (6.x as of this posting), they will have a simple guide.  Here are the steps I took to reproduce this modification:

cd /tmp
wget http://tinycorelinux.net/6.x/x86_64/release/distribution_files/corepure64.gz
wget http://tinycorelinux.net/6.x/x86_64/release/distribution_files/vmlinuz64.gz
wget http://tinycorelinux.net/6.x/x86_64/tcz/fuse.tcz
wget http://tinycorelinux.net/6.x/x86_64/tcz/ntfs-3g.tcz

mkdir /tmp/remaster
mkdir /tmp/extension
cd /tmp/remaster
zcat /tmp/corepure64.gz | sudo cpio -i -H newc -d

sudo mount -t squashfs -o loop fuse.tcz /tmp/extension
cp -R /tmp/extension/* ./
sudo umount /tmp/extension

sudo mount -t squashfs -o loop ntfs-3g.tcz /tmp/extension
cp -R /tmp/extension/* ./
sudo umount /tmp/extension

sudo chroot /tmp/remaster depmod -a 3.16.6-tinycore64
sudo chroot /tmp/remaster ldconfig
sudo find | sudo cpio -o -H newc | gzip -2 > ../corepure64-ntfs.gz

That's all folks!  Be sure to note that the onboot.lst file (and any other tce directory files) need to be edited on a *LINUX* system, not a *MICROSOFT* system!  Also the above steps can be performed on any working Linux distro, not just a TC system.

Dave
Title: Re: boot from ntfs
Post by: wysiwyg on January 28, 2015, 10:41:24 AM
@Rich and @bmarkus thanks for the tips, good info for any user who stumbles across this post!

Dave
Title: Re: boot from ntfs
Post by: SvOlli on January 28, 2015, 11:29:58 AM
You can make you life a lot easier here.

Instead of merging several stuff into the original cpio, you can create a second one and load both from the bootloader. That way you don't need to rebuild the cpio, if the original initrd changes.

Been there, done that, ... a couple of times. ;-)
And yes, back then I didn't know that more than one initrd can be loaded at startup-time either...
Title: Re: boot from ntfs
Post by: patrikg on January 28, 2015, 11:43:03 AM
Great.

I am trying to make tcl for a pxe environment, and get this problems.

First I have some trouble with the rights on the files when i packed them into the tcz files.
my_root is a directory. User tc (1001) group staff (50).
I see when i run the tce-setdrive it sets the correct rights to the directory and the files.
And if I don't set the correct rights in the tcz file, it complains then i run the tce-load -wi "Access denied".
It's fixed then i run the tce-setdrive. I just wan't to run tce-setdrive.

So i changed the files with:
Code: (bash) [Select]
chown -R 1001:50 my_root
And a tip for the onboot.lst file, it is easy to create first with this command and then edit if needed.
Code: (bash) [Select]
(cd my_root/opt/tce/optional/ && ls -1 *.tcz) > my_root/opt/tce/onboot.lst
Title: Re: boot from ntfs
Post by: wysiwyg on January 28, 2015, 11:56:34 AM
Just to clarify what SvOlli is saying in his post above... He is referring to modifying your bootloader config to use something like the following:

# an example of a traditional grub legacy line:
# initrd (hd0,1)/boot/ramdisk/tinycore.gz

# an updated version to load multiple 'ramdisks' (NOTE: some bootloaders may or may not need the comma):
# initrd (hd0,1)/boot/ramdisk/tinycore.gz, /boot/ramdisk/ntfs-3g.gz


@patrikg thanks for the additional tips for others visiting this thread!  Checking file permissions is something else to keep in mind while remastering things.  Of course if you use SvOlli's techniques, you can just use the official packages instead of creating your own!

Dave
Title: Re: boot from ntfs
Post by: patrikg on January 28, 2015, 12:16:01 PM
Yes, of course my previous  post was to make some additional tips.
My pxe boot config file is like this with two initrd:
My next project is figured out how to make my own mydata.tcz.

Code: (bash) [Select]
LABEL tcl
MENU LABEL Tiny Core Linux 6.0
KERNEL http://192.168.1.73/vmlinuz
INITRD http://192.168.1.73/core.gz,http://192.168.1.73/my_root.gz
APPEND quiet tce=/opt/tce norestore kmap=qwerty/sv-latin1 host=tcbox tz=CET-1CEST,M3.5.0,M10.5.0/3
Title: Re: boot from ntfs
Post by: wysiwyg on January 28, 2015, 12:32:20 PM
@patrikg I'm now looking into the same thing.  See my post below:

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

Dave
Title: Re: boot from ntfs
Post by: curaga on January 28, 2015, 02:21:51 PM
Hi SvOlli, welcome back :)