WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [SOLVED] Testing USB sticks issue with norestore ...restoring my hd TC and etc?  (Read 2970 times)

aus9

  • Guest
Hi

mods feel free to move.

I am testing grub2 on usb MBR. I did not use grub-legacy and so could not use the cpanel install to usb either.

I have confirmed....with bios boot order hd then usb....with usb inserted...that its my usb stick that boots......as one of my boots allows chainload to MBR1 (grub-legacy would be hd1)....and then I see my special grub2 menu.
In my special menu....I tried cheatcode home=sdb1 opt=sdb1 tce=sdb1 waitusb=5
then I adjusted to norestore.

My issues may relate to TC "autorestore" type function versus "norestore"

1) How do I tell what device TC detects as the current media?

/etc/fstab mentions sda and sdb

2) Clicking on cpanel ...sys stats....various tabs......I can see dmesg but my eyesight could not spot what device TC thought it was booting or trying to boot

3) In a different boot ..... one of my failures....cpanel ...stats showed my (wrong) sda2 showing up its tcz extensions.
I am hoping this is because I have failed incorrrect use of norestore?

4) In a possible success....I had the normal wallpaper and no files in /home/tc....which is what I expected but as above...I am clueless as to where I am really in the fstab.

sorry for the repeat.....(4) gives me some hope....but I need to confirm exactly how I confirm I am at a certain /dev/sd(letter)

5) I have seen this wiki
http://wiki.tinycorelinux.com/Boot+codes+explained

I believe I can discount the /dev/sdb/sda issue versus UUID as my booted fstab shows both devices?

6) I hope you don't think I am trolling.....but how do I confirm that TC...truly booted with the norestore cheatcode?

Should I enable logs....or is it handy on boot up?

I am still a TC newbie.....but I am thinking out loud that my usb test ....failed to use norestore

thanks for reading if no help can be offered.
« Last Edit: June 16, 2010, 07:36:13 AM by aus9 »

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Here are some fairly basic commands that might help to answer some questions:

(1) What boot codes were used? showbootcodes
(2) What directory (and hence what device) has been identified for extension storage? cat /opt/.tce_dir
(3) What partition and directory has been identified to hold the backup archive (i.e. 'mydata.tgz')? cat /opt/.backup_device (note: this is expected to be almost identical to the result of (2), just missing the '/mnt/' prefix)
(4) Has the 'home=PARTITION' boot code been accepted? mount | grep home (note: this should show that '/home' is mounted to the expected device and a 'home' directory should exist in the root of the partition)
(5) Has the 'opt=PARTITION' boot code been accepted? mount | grep opt (note: this should show that '/opt' is mounted to the expected device and a 'opt' directory should exist in the root of the partition)

AFAIK the 'tce=sdb1' boot code might only be helpful for the initial creation of the 'tce' directory structure. Alternatively 'tce-setdrive' should be able to achieve the same. TC / MC will auto-detect the 'tce' directory in the future, unless you have several to choose from. Using this boot code might also speed up future auto-detection, if you have multiple partitions (and / or devices). But in a single partition scenario not much would be gained. I wonder how much faster it would be in a multi partition scenario whether using the boot code or not.

aus9

  • Guest
maro

Thankyou very much for your time and hope you can help me.

This post is done booted as follows

hard drive bootloader chainloads to mbr1....the usb stick

usb stick's bootloader (translated in grub-legacy terms) would be

title USB
root (hd1,0)
kernel /boot/bzImage max_loop=255 norestore waitusb=5
initrd /boot/tinycore.gz

1) Your suggestions produce this

Code: [Select]
showbootcodes
BOOT_IMAGE=/boot/bzImage max_loop=255 norestore waitusb=5

cat /opt/.tce_dir
/mnt/sda2/tce

cat /opt/.backup_device
(no response)

mount | grep home
(no response)

mount | grep opt
/dev/loop61 on /tmp/tcloop/popt type squashfs (ro)

2) /dev/sda2 is my real hard drive install of TC....and indicates IMHO a failure to norestore or "not auto-restore".
I forgot to mention...I know it was a failure....as LXDE boots up on this install....while I have no LXDE on the usb stick.

And yet the no response to some of your commands gives me some hope.

Also when I started firefox in this boot....I do not appear to have any bookmarks.

I am stumped.

3) I will do a separate post on my closest...norestore.....booted system later.

Do you want to see those results before replying? (assuming I can duplicate it?) or wait until you tell me what I am doing wrong with this booted system

Feel free to be blunt......I don't intend to use this usb stick on a permanent basis....but I want to get it right for my grub2 wiki under construction

If you can't help.....thanks heaps for the commands......I understand if you can't help as I am a weirdo!


EDIT
(4) I am wondering if the issue of failed norestore is due entirely to me having available to the booting TC system.....TWO Tinycore systems?
« Last Edit: June 12, 2010, 08:27:20 PM by aus9 »

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
I'm not really sure that I understand what you are trying to achieve, I therefore will just give you my conclusions from the details you've provided:

(a) Without a dedicated 'tce=...' boot code the first "TCE candidate" that was found gets promoted to the "driver seat". Hence assuming you have a '/mnt/sda2/tce' and a '/mnt/sdb1/tce' the former one wins this "race". As it appears you have a (maybe older) 'tce' directory structure on that 'sda2' device those extensions got loaded (well I guess the ones included in '/mnt/sda2/tce/onboot.lst'). But without any other persistence (no restore, and no persistent 'home' or 'opt') all user specific settings will be at their initial values (e.g. no bookmarks).

(b) I guess the 'root (hd1,0)' information in the GRUB stanza has no impact on the 'tce' detection but provides guidance as to where the kernel (i.e. '/boot/bzImage') and initrd (i.e. '/boot/tinycore.gz') are to be taken from. If your various devices have multiple versions of those you want to be really careful in what you are doing. If your boot loader is located on the same partition as the kernel and initrd file I would probably remove the 'root (...)' entry from the stanza. IIRC GRUB should then take as 'root' the same device where it found the boot loader.

(c) As you used 'norestore' the fact that '/opt/.backup_device' was empty is entirely as expected.

(d) As you used neither 'home=...' nor 'opt=...' the fact that no mount point showed up is as expected. (note: the loop mount point reported is a false positive, I should have given you the much "tighter" search terms of mount | grep ' /home ' and mount | grep ' /opt ' instead)

I could not work out from your description which boot loader is on which device, but that is maybe just me. Or you have successfully confused yourself and continued this by extension to myself.

I guess what I would do is use a boot loader on the USB stick that would work in a purely "self-contained" way:
  • That means removal of any hard-coded device or partition information, and using UUID (or LABEL) for the 'tce', 'home', and 'opt' specification.
  • Furthermore (on the assumption that you are using persistent 'home' and 'opt') I'd remove all 'home' and 'opt' entries from your '/opt/.filetool.lst'. If that leaves nothing left in that file (like e.g. files from '/etc') I'd use boot code 'norestore' since nothing else is left to be restored. Otherwise you'd potentially end up overwriting files.

This way the USB stick should work on any computer whether is allows direct booting from it (via permanent or temporary BIOS boot device selection) or via chain loading the USB stick boot loader from a primary boot loader on a hard disk.

aus9

  • Guest
maro

thankyou for your excellent reply...I have not had time to test all of your suggestions as I was testing other things to make sure my post below was reproducible by me....

The closest I got to a norestore condition...BEFORE reading your reply is this

hard drive bootloader chainloads to usb bootloader

bios changed to boot usb before hard drive

usb menu in legacy terms become

title usb
root (hd0,0)
kernel /boot/bzImage norestore usbwait=5 tce=sdb1
initrd /boot/tinycore.gz

I did not want to install a web browser to this usb system so took a snapshot and saved to hard drive



Some of the more obvious to me were.....lxde not showing....good sign
cpan filesystem stats shows /dev/sdb1......good....correct size for usb first partition
backup device....................sda2...............bad

2) As you have already explained the driver seat issue.....which I was thinking might be an issue as per (4) in my second  post
The issue only raises itself for someone booting an USB device where they have a internal or multiple TC system.
So if I take this usb stick to a friends computer....the backup will not be sda2....but not sure if will truly fall to sdb1.

3) Yes I am confused because.....err...in setting bios boot order to usb.....usb should now be sda1.....but when I tried cheatcode sda1.... the system stats showed the size of /dev/sda1 as being NOT 688MB but the size of my real hard drive......eeek.

Your (a)   If you get a chance.....what do you mean by an older tce directory structure.....I am hoping this is the key?

Your (b).....I agree....but I was attempting to show that my usb TC is first partition and hd is second partition

Your (c)....thanks for confirming

Your (d) ....not tested yet....thanks for the update...much appreciated.

Your other suggestions that relate to not pointing to /dev/structure but UUID.....I have not tested so far. I think your are kindly suggesting my first post (5) was in error.

more testing for me.



Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10961
Did you mean the "base" bootcode earlier? That skips the loading of extensions.
The only barriers that can stop you are the ones you create yourself.

aus9

  • Guest
curaga

thanks for that....no what I am actually trying to achieve is persistence on the usb stick.

but currently....TC is detecting my persistence on hard drive and restoring that.

So then I got sidetracked into trying to prevent that with norestore.

Have not tested base.....but I shall take a while to reply......from now....as I am going to do a number of tests

one test....not done will be to install grub-legacy....follow some of maro's advice....the install page etc....to get persistence
---if that works then I replace the bootloader.....as its not really the bootloader that is my issue ....me thinks

second test....I prefer labels....is to use tce=LABEL="mylabel" ...first in legacy

third test....ignore cheatcodes....and set the backup_device once booted.....I have done a partial test for this and logout changed from sda2 to sdb1
---which was encouraging.

work and dollars....forces me to stop testing for a while

thanks

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
aus9: I get the impression you are confused about what the 'norestore' and 'base' boot codes are doing for you. So I'll try to explain what I know:

  • norestore instructs TC to ignore the 'mydata.tgz' file during system start. That archive should include the files (and directories) listed in '/opt/.filetool.lst' (and exclude those listed in 'opt/.filetool.lst'). The default setting for those two control files means basically that the backup should consist of the users home directory (minus stuff like browser caches) plus a few global setting files (e.g. the extension mirror and user enhancements for system start and shutdown). As I've already stated (almost at the very end of reply #3), this boot code has to be seen in a certain relationship with the 'home=...' and 'opt=...' boot codes.
    The critical point is that 'norestore' has nothing to do with extensions.
  • base in contrast instructs TC not to load any extension at startup. Extensions would otherwise be either "auto-magically" found without a boot code, or loaded from a partitions specified via 'tce=...'. Having multiple stores makes using a 'tce=...' boot code almost mandatory as TC will choose the first one it finds (i.e the "race" mentioned earlier).

The combination of "base norestore" leads to a situation that should be equivalent to the (initial) "cloud mode". That means no extensions are loaded and only default (and hence not user-specific) settings are used.

Furthermore you appear to be struggling a bit with identification of the partitions. Using fdisk -l and blkid /dev/sd* and comparing this with grep mnt /etc/*tab should make things more obvious.

My guess is that you have managed to set yourself up with a combination of two extensions stores (one on the hard disk, the other on the USB stick) and keep on changing your boot options in such a way that your attempts of achieving persistence are failing you. Maybe operating in cloud mode until you have managed to "clear the mist" could be the way forward. In my view there are at least two aspects of persistence: (1) related to extensions and (2) related to settings. Controlling those is achieved by the correct (!!) combination of boot codes.

PS: Since the two of us are only a couple of timezones apart I could send you (by PM) my phone number (in NZ). That way I could talk you through more questions you might have (alternatively I should still have a Skype account, which I have not used for a while). I'm certainly much happier talking over stuff than writing everything as a post here (which is a bit of a pain for me).

aus9

  • Guest
maro

thanks for all that.

1) I have never had a problem with persistence on my hard drive....but I was not (before) testing usb sticks

2) All of my issues....and any mis-understandings from my end....relate purely to my usb testing.

3) Please let me...do all my testing......as I work....that may take some time....as you can guess I am very happy with hd TC.
But those usb issues may be self-inflicted....heh heh

Therefore...altho its a wonderful ideal to talk to a real person in kiwiland.....at this stage I prefer not to until I have completed my tests.
You may be able to guess....I do things...more than once....to know I can reproduce it
You may guess I am shy to talk to someone....who twigs....I am complete idiot.....lol

I may take up your phone offer as I have VOIP...... but not until testing complete. Altho I had a skype account...I have heard there are security issues with it so have not used for yonks.

I have thought of a few other things to test BTW but time....time is the key. I use partimage for another distro....so I will wipe my hd TC and see if that resolves any issues .....along with lots of other tests I intend to do.

(You can never do enough tests.....If you think paranoid I have no issue with that....since you have been so kind....forgive me for letting know where I am at with grub2 wiki. It is deliberately not published at main index as its under construction....and usb does install...but not fully resolved and I have a todo list there somewhere.)
http://wiki.tinycorelinux.com/gfx

so please forgive any rudeness on my part.

regards

gordy

aus9

  • Guest
hi

1) ......I followed the install wiki and put grub-legacy on the usb stick.....at one stage it was bootable....but I later used cfdisk to remove the bootable flags from my hard drive TC and the usb TC.

2) bios boot order was changed to usb first then hard drive

bootcodes were changed a few times.....but I also deleted my entire TC off the hard drive so TC on usb could not restore it.

Now that should leave us with a nice simple usb boot up?
Using kernel/tinycore.gz  from 2.11.3 (only just saw 2.11.4) sorry

3) One of the main issues I am now able to regular reproduce....meaning NOT wanted is the wrong backup device



IMHO the backup device should be sdb1/tce?

If I leave it tce...and click on cpanel....and click on backup.....or try to logout with current setting.....I always get an error

So each time....yes I did this more than once.....

I run sudo su
vi /opt/.backup_device.....and make it .....sdb1/tce

then I get no error on backup.

4) My other issue...TC fstab to show usb as sdB structure..... no matter what I do to bios boot order......TC always detects hard drive first.

I was thinking of using a device.map file.....but as I am writing a wiki on grub2....so that is irrelevant to my needs.

so I changed bootcode from tce=LABEL=usbone to tce=LABEL="usbone" to tce=sdb1....with exactly the same results for backup device.

(I used e2label from e2fsprogs to label my usb partition "usbone"..and run e2label /dev/sdb1 to confirm the label name was registered

I can live with TC detecting sda as always my hard drive......so my question is

Why is backup_device not correctly detected?

aus9

  • Guest
oops I forgot to add my very first bootcode was using usbp1 which I changed in case e2label was affected by numbers...so adopted usbone

append (2)....and I forgot to make it explicit....that after edit file to allow backup to occur with no error....then reboot....the backup device "drops" back to /tce.

This is a reproducible error....and kind of has stopped my progress.

thanks for reading.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
The bootcode should be 'waitusb=5' NOT 'usbwait=5'

aus9

  • Guest
Gerald

yikes.....bangs head against wall.

I had it right the first few posts and then the voices in my head made me bork it up.

I have resolved....thankyou...the one change waitusb cheatcode.....that fixed my tce backup device


what a relief

I am marking this post solved.....and will resume my other tests

thanks heaps