Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 20 Jan 2018, 13:32
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Tahrpup Can't find Save folder on Large USB Hard Drive
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 2 [24 Posts]   Goto page: Previous 1, 2
Author Message
bigpup


Joined: 11 Oct 2009
Posts: 9881
Location: Charleston S.C. USA

PostPosted: Wed 10 Jan 2018, 02:58    Post subject:  

If the Grub4dos bootloader is on the same USB hard drive, sdd1 the first partition.

Tahrpup 6.0.6 is all installed on partition sdd4.
Everything including the save.
Nothing is in a directory, just on the partition.

Try this for a save parameter in the boot menu entry.
Code:
psave=sdd4:/tahrsave


This assumes the save is a save folder.

Or using the uuid.
Code:
psave=fab3b011-746f-448b-85a3-5f7fb7f8e7f6/sdd4:/tahrsave

_________________
I have found, in trying to help people, that the things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected Shocked

Last edited by bigpup on Wed 10 Jan 2018, 03:09; edited 1 time in total
Back to top
View user's profile Send private message 
s243a

Joined: 02 Sep 2014
Posts: 801

PostPosted: Wed 10 Jan 2018, 03:07    Post subject:  

Anyway. Posting more source now. Part of my objective is to learn more about how puppy works, so I hope it doesn't bore anyone.

returning to the logs from the failed boot
Code:

1: PDRV= P_BP_ID=fab3b011-746f-448b-85a3-5f7fb7f8e7f6 P_BP_FN=


Comes from line 925 of

/initrd/init
Code:

[ "$PDEBUG" ] && echo "1: PDRV=$PDRV P_BP_ID=$P_BP_ID P_BP_FN=$P_BP_FN"


we see this because it is the only echo statement which starts with "1:"

This statment always gets executed. However, the code to instead have PDEBUG as a boot parmater is commented out:

Lines 857 to 858
Code:

#[ $pdebug ] && PDEBUG=$pdebug
PDEBUG=1

which makes since since there isn't really that much debugging information in this script. However, I suppose if it was a boot option one could have debug mode as one of their boot menu selections.

Here is the part where it searches for the USB Drives

Lines 947 to 959
Code:

if [ "$LOOK_PUP" -o "$LOOK_SAVE" ];then #something to search for
 [ "${PMEDIA:0:3}" != "usb" ] && search_func
 if [ "$P_PART" = "" ];then
  wait_for_usb
  USBDRVS="$(find /sys/block -maxdepth 1 -name 'sd*' -o -name 'sr*' | xargs -n 1 readlink 2>/dev/null | grep '/usb[0-9]' | rev | cut -f 1 -d '/' | rev | tr '\n' '|')"
  [ "$PDEBUG" ] && echo "2: USBDRVS=$USBDRVS -> ${USBDRVS%|}"
  if [ "$USBDRVS" ] ; then
    search_func "${USBDRVS%|}"
  else
    search_func
  fi
 fi
fi


such_func (lines 742 to 783) will if they aren't already defined search for both the location of the main puppy files,

Lines 770 to 779
Code:

   if [ "$LOOK_PUP" ];then
    find_drv_file "$P_BP_FN" "$P_DEF_FN"
    if [ "$ONE_FN" ];then
     PDRV="$ONE_PART,$ONE_FS,$ONE_FN"
     P_MP="$ONE_MP"
     P_PART="$ONE_PART"
     [ "$PDEBUG" ] && echo "5: ONE_PART=$ONE_PART PSUBDIR=$PSUBDIR P_BP_FN=$P_BP_FN P_DEF_FN=$P_DEF_FN"
     break;
    fi
   fi


and also the location of the save file

Lines 761 to 769
Code:

  if [ "$ONE_MP" ];then
   if [ "$LOOK_SAVE" -a "$SAVEPART" = "" ];then
    set_fs_linux "$ONE_FS"
    find_save_file "$ONE_MP" "$ONE_PART" "$ONE_FS"
    if [ "$PUP_SAVES" ];then
     SAVEPART="$ONE_PART"
     [ "$PDEBUG" ] && echo "5: ONE_PART=$ONE_PART filename=${PSUBDIR}/${DISTRO_FILE_PREFIX}save"
    fi
   fi


I'm not sure if these have to be on the same partition


Here is the logic where puppy decides if and where to search for the puppy files and returns an error if it fails:

Lines 927 to 965
Code:

#establish PDRV
P_PART=""; LOOK_PUP=""; LOOK_SAVE=""
if [ "$P_BP_ID" ];then #specified as parameter
 decode_id "$P_BP_ID"
 [ "$ONE_PART" ] && { P_PART="$ONE_PART"; P_BP_ID=""; }
 if [ "$P_PART"  = "" ];then
  wait_for_usb
  decode_id "$P_BP_ID"
  [ "$ONE_PART" ] && { P_PART="$ONE_PART"; P_BP_ID=""; }
 fi
 find_onepupdrv "$P_PART" "$P_BP_FN" "$P_DEF_FN" "p"
 [ "$ONE_FN" ] && { PDRV="$ONE_PART,$ONE_FS,$ONE_FN"; P_MP="$ONE_MP"; }
 [ "$PDEBUG" ] && echo "2: ONE_PART=$ONE_PART ONE_FN=$ONE_FN ONE_MP=$ONE_MP"
elif [ "$PDRV" = "" ];then #not specified anywhere
 #determine what to search for
 [ "$PMEDIA" = "cd" ] && LOOK_SAVE="yes"
 [ "$SAVE_BP_ID" -o "$PSAVEMARK" ] && LOOK_SAVE=""
 LOOK_PUP=yes
 [ "$PDEBUG" ] && echo "2: LOOK_PUP=$LOOK_PUP LOOK_SAVE=$LOOK_SAVE PMEDIA=$PMEDIA"
fi
if [ "$LOOK_PUP" -o "$LOOK_SAVE" ];then #something to search for
 [ "${PMEDIA:0:3}" != "usb" ] && search_func
 if [ "$P_PART" = "" ];then
  wait_for_usb
  USBDRVS="$(find /sys/block -maxdepth 1 -name 'sd*' -o -name 'sr*' | xargs -n 1 readlink 2>/dev/null | grep '/usb[0-9]' | rev | cut -f 1 -d '/' | rev | tr '\n' '|')"
  [ "$PDEBUG" ] && echo "2: USBDRVS=$USBDRVS -> ${USBDRVS%|}"
  if [ "$USBDRVS" ] ; then
    search_func "${USBDRVS%|}"
  else
    search_func
  fi
 fi
fi
[ "$P_BP_ID" ] && { log_part_id "$P_BP_ID"; ONE_PART="$P_BP_ID"; }
[ "$PDEBUG" ] && echo "6: ONE_PART=$ONE_PART ONE_TRY_FN=$ONE_TRY_FN PDRV=$PDRV"
if [ "$PDRV" = "" ];then
 [ "$ONE_TRY_FN" ] || ONE_TRY_FN="$PSUBDIR/$P_DEF_FN"
 fatal_error "$ONE_PART $ONE_TRY_FN not found." "Finding puppy main sfs file."
fi



Again these are just notes to myself but maybe someone else will find it useful. When I learn more there will be more explanation and less code snippets.
Back to top
View user's profile Send private message 
s243a

Joined: 02 Sep 2014
Posts: 801

PostPosted: Wed 10 Jan 2018, 03:16    Post subject:  

bigpup wrote:
If the Grub4dos bootloader is on the same USB hard drive, sdd1 the first partition.

Tahrpup 6.0.6 is all installed on partition sdd4.
Everything including the save.
Nothing is in a directory, just on the partition.

Try this for a save parameter in the boot menu entry.
Code:
psave=sdd4:/tahrsave


This assumes the save is a save folder.

Or using the uuid.
Code:
psave=fab3b011-746f-448b-85a3-5f7fb7f8e7f6/sdd4:/tahrsave


If you use the uuid then you leave out the sdd4. A big downside of using sdd4 is that it won't work if I move the hard drive from one computer to another. I don't want to reboot now because I decompressed initrd.gz as noted above. I must learn how to remake initrd.gz. I found some links to read:

https://www.ibm.com/developerworks/library/l-initrd/
https://www.linuxquestions.org/questions/puppy-71/how-can-i-edit-initrd-gz-in-puppy-2-0x-457738/#post2305513
https://askubuntu.com/questions/777260/how-to-repack-initrd-img/777374
https://www.thegeekstuff.com/2009/07/how-to-view-modify-and-recreate-initrd-img/
https://linux.die.net/man/1/cpio
https://openvz.org/Modifying_initrd_image

I was just making some sourcecode notes tonight because I don't have time tonight to try to modify the script and even if I did I wouldn't know how to repack it yet.

P.S. I doubt that putting sdd4 instead of the uuid would make a difference. If you look at the log in my first post you see:
Code:

mount: can't read '/etc/fstab': No such file or directory
sdd4 on /mnt/pdrv as  mount failed.

So the init script was able to identify the partition from the uuid but the partion wasn't mounted fast enough in the puppy boot process.
Back to top
View user's profile Send private message 
bigpup


Joined: 11 Oct 2009
Posts: 9881
Location: Charleston S.C. USA

PostPosted: Wed 10 Jan 2018, 03:31    Post subject:  

OK,

Wish you luck.

If you come up with anything that makes stuff work better.

Put a post about what you did at Woof-CE on Github.
https://github.com/puppylinux-woof-CE/woof-CE

_________________
I have found, in trying to help people, that the things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected Shocked
Back to top
View user's profile Send private message 
bigpup


Joined: 11 Oct 2009
Posts: 9881
Location: Charleston S.C. USA

PostPosted: Wed 10 Jan 2018, 03:45    Post subject:  

I kind of had a problem with Fatdog 720 not giving time for the drives to be found and identified when trying to find the save.

They have a waitdev= option that can be put into the boot menu entry.
But I do not think it is an option in normal Puppies.

So you can see how to use it.
Here is the menu entry:
Code:
title Fatdog64 (sdc6/Fatdog64720b)
  uuid 6b517a5d-03c6-4635-96c5-659b29518c84
  kernel /Fatdog64720b/vmlinuz   waitdev=5
  initrd /Fatdog64720b/initrd

waitdev=5 says to wait 5 seconds for devices to be found.

Without it, the process goes too fast and all the drives do not get loaded before the save is searched for.
Maybe see what they did to add this optional parameter.

_________________
I have found, in trying to help people, that the things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected Shocked
Back to top
View user's profile Send private message 
s243a

Joined: 02 Sep 2014
Posts: 801

PostPosted: Wed 10 Jan 2018, 04:45    Post subject:  

bigpup wrote:
I kind of had a problem with Fatdog 720 not giving time for the drives to be found and identified when trying to find the save.

They have a waitdev= option that can be put into the boot menu entry.
But I do not think it is an option in normal Puppies.

So you can see how to use it.
Here is the menu entry:
Code:
title Fatdog64 (sdc6/Fatdog64720b)
  uuid 6b517a5d-03c6-4635-96c5-659b29518c84
  kernel /Fatdog64720b/vmlinuz   waitdev=5
  initrd /Fatdog64720b/initrd

waitdev=5 says to wait 5 seconds for devices to be found.

Without it, the process goes too fast and all the drives do not get loaded before the save is searched for.
Maybe see what they did to add this optional parameter.


Thanks for the info. Smile I didn't know about this boot parameter for Fatdog64. If I add a similar parameter then I'll probably give it the same name to make it easier for people switching between puppy and Fatdog64 and visa versa.
Back to top
View user's profile Send private message 
s243a

Joined: 02 Sep 2014
Posts: 801

PostPosted: Sat 13 Jan 2018, 17:17    Post subject:  

bigpup wrote:
I kind of had a problem with Fatdog 720 not giving time for the drives to be found and identified when trying to find the save.

They have a waitdev= option that can be put into the boot menu entry.
But I do not think it is an option in normal Puppies.

So you can see how to use it.
Here is the menu entry:
Code:
title Fatdog64 (sdc6/Fatdog64720b)
  uuid 6b517a5d-03c6-4635-96c5-659b29518c84
  kernel /Fatdog64720b/vmlinuz   waitdev=5
  initrd /Fatdog64720b/initrd

waitdev=5 says to wait 5 seconds for devices to be found.

Without it, the process goes too fast and all the drives do not get loaded before the save is searched for.
Maybe see what they did to add this optional parameter.


So I think that to add the delay all I have to do is this:
add on line 861 of /initrd/init
Code:

[ $waitdev ] && WAITDEV=$waitdev #added by s243a
 export WAITDEV=${WAITDEV:-3}


change lies #21 to #26 of
/initrd/sbin/wait4usb

from
Code:

#i want this to work with kernel that does not have my usb-storage patch, feedback is that 3 secs is enough...
while [ $CNTUSB -lt 3 ];do
 sleep 1
 CNTUSB=$(($CNTUSB+1))
 echo -en "\\033[1;33m.\\033[0;39m" >/dev/console #yellow dot
done


to
Code:

#i want this to work with kernel that does not have my usb-storage patch, feedback is that 3 secs is enough...
while [ $CNTUSB -lt  $WAITDEV ];do
 sleep 1
 CNTUSB=$(($CNTUSB+1))
 echo -en "\\033[1;33m.\\033[0;39m" >/dev/console #yellow dot
done


So that it includes the variable variable waitdev as the condition for the first line of while loop. However, this is a bad hack. I'll come up with some better code hopefully soon.
Back to top
View user's profile Send private message 
s243a

Joined: 02 Sep 2014
Posts: 801

PostPosted: Sun 14 Jan 2018, 02:02    Post subject:  

Okay here is my proposal which I'll try.

I created a function which will repeat the "wait_for_usb" function until the required partition is ready.

Code:

function wait_for_usb_part(){
  xIFS=$IFS
  IFS=' ' #This should be the default but just to be double certain
  [ -e /tmp/flag-usb-ready ] || wait_for_usb #Call wait_for_usb if it hasn't been called yet.
  for (( i=0; i<$USB_TRIES; i++ )); do
     BLKIDOUT='' #not sure if this is necessary but it will force blkid to be called again.
     decode_id $1 #Convert uuid's to partition name
     part_name="$ONE_PART" #this is the result (i.e. the partiation name) returned from decode_id.
     if [ $part_name ] then
       for p in cat /tmp/flag-usb-ready; do #flag-usb-ready conatins the name of all the partitions which are ready for use
         [ $p -eq $part_name ] || break 2
       done;
     fi
     rm /tmp/flag-usb-ready #we got to clear this flag or wait_for_usb won't do anything.
     wait_for_usb     
  done
  IFS=$xIFS
}


the default is three tries. Here is are my two new boot parameters:

Code:

#Specifies how long to wait for the USB drive
[ $waitdev ] && WAITDEV=$waitdev #added by s243a
 export WAITDEV="${WAITDEV:-3}"
#Specifies how how many times to try finding all USB drives
[ $USB_TRIES ] && USB_TRIES=$usb_tries
USBTRIES="${USBTRIES:-3}"


waitdev was already explained. usbtries as just mentioned is how many times to try the wait_for_usb function. I'll report on the results when I'm actually able to test this and probably update the code in this post if no one comments and I detect any errors.

Edit:
I forgot to put where to call this script from:

Starting at line 927 of /initrd/init
Code:

#establish PDRV
P_PART=""; LOOK_PUP=""; LOOK_SAVE=""
if [ "$P_BP_ID" ];then #specified as parameter
 decode_id "$P_BP_ID"
 [ "$ONE_PART" ] && { P_PART="$ONE_PART"; P_BP_ID=""; }
 if [ "$P_PART"  = "" ];then
  wait_for_usb_part  "$P_BP_ID"
  [ "$ONE_PART" ] && { P_PART="$ONE_PART"; P_BP_ID=""; }
 fi

where we replaced
Code:

wait_for_usb
  decode_id "$P_BP_ID"

with
Code:

  wait_for_usb_part  "$P_BP_ID"
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 4797
Location: Republic of Novo Zelande

PostPosted: Mon 15 Jan 2018, 03:01    Post subject:  

Are your findings implying that some puppies fail to find important sfs files on usb drives because they do not wait long enough for the usb drive to come online?

If so, is this implying that the boot process fails to include some checks that a normal running system performs? After all - you never see "file not found" when you try to copy files to or from a usb drive normally.

Surely the running system does not include various random waits or sleeps when copying files - surely there must be some signal that flags a ready drive?
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 2 [24 Posts]   Goto page: Previous 1, 2
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0645s ][ Queries: 14 (0.0044s) ][ GZIP on ]