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 Tue 16 Sep 2014, 15:51
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Problem with new Remaster script
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [13 Posts]  
Author Message
stemsee


Joined: 27 Jun 2013
Posts: 362
Location: London

PostPosted: Thu 21 Aug 2014, 04:47    Post subject:  Problem with new Remaster script
Subject description: sfsdirect - 3 minute remaster in ram!
 

I have arrived at a new remaster script which simply squashes the system running in ram with extra sfs and savefile included. The problem I now experience is that the reulting sfs causes kernel panic at switchroot. I tried changing permissions to proc tmp mnt sys but didn't help. So I am appealing to those more knowledgeable than myself to point out what is going wrong!

Code:
#!/bin/sh
#sfsdirect remastering suite by stemsee copyright Marcos Contant 2014

. /etc/DISTRO_SPECS
echo "SfS direct is a live remaster system which works in either ram or device.
Make sure that your system has enough ram or uses a swap for the remaster, or
specify path and drive. e.g. mnt sda2.

Do you want to work in ram? y or n"
read ram
case $ram in
    y) if [ -d /tmp/quaddirs ]; then
   rm -r /tmp/quaddirs
   rm /tmp/*.sfs
   mkdir -p /tmp/quaddirs/{mnt,tmp,sys,proc}
   else
   mkdir -p /tmp/quaddirs/{mnt,tmp,sys,proc}
   fi
   chmod 777  /tmp/quaddirs/tmp
   chmod 755  /tmp/quaddirs/sys
   chmod 755  /tmp/quaddirs/mnt
   chmod 755  /tmp/quaddirs/proc
   if [ -d /aufs ]; then
   ln -fnrsv /tmp/quaddirs/tmp /tmp/quaddirs/run
   fi
   mksquashfs  /* /tmp/quaddirs/* /tmp/$DISTRO_NAME.sfs -e /run /proc /tmp /mnt /initrd /sys /aufs /archive /root/.cache /root/.Trash/* /root/Downloads/* /root/.history /root/.bash_history /root/.Skype /etc/resolv.conf /root/.XLOADED /etc/.XLOADED /etc/blkid-cache /etc/reslove.conf /lib/modules /lib/firmware -noappend
   echo "'$DISTRO_NAME.sfs has been created in /tmp. Where do you want to save it to?
   Enter the path e.g. /mnt/sda2/"
   read savepart
   mv -f /tmp/$DISTRO_NAME.sfs $savepart
   echo "All done!" && exit;;

   n)  if [ -d /tmp/quaddirs ]; then
   rm -r /tmp/quaddirs
   mkdir -p /tmp/quaddirs/{mnt,tmp,sys,proc}
   else
   mkdir -p /tmp/quaddirs/{mnt,tmp,sys,proc}
   fi
   chmod 777  /tmp/quaddirs/tmp
   chmod 755  /tmp/quaddirs/sys
   chmod 755  /tmp/quaddirs/mnt
   chmod 755  /tmp/quaddirs/proc
   if [ -d /aufs ]; then
   ln -fnrsv /tmp/quaddirs/tmp /tmp/quaddirs/run
   else
   echo "Input path and drive and directory e.g. mnt sda2"
   read path drive
   mount /dev/$drive /$path/$drive
   mksquashfs /* /tmp/quaddirs/* /$path/$drive/$DISTRO_NAME.sfs -e /proc /tmp /mnt /initrd /proc /sys /aufs /archive /root/.cache /root/.Trash /root/Downloads/* /root/.history /root/.bash_history /root/.Skype /etc/resolv.conf /root/.XLOADED /etc/.XLOADED /etc/blkid-cache /etc/reslove.conf /lib/modules /lib/firmware  -noappend
   echo "All done!"
   fi && exit;;
   *) echo "You didn't enter anything relevant! Exiting script." && exit;;
esac

Last edited by stemsee on Sat 23 Aug 2014, 11:52; edited 3 times in total
Back to top
View user's profile Send private message MSN Messenger 
mavrothal


Joined: 24 Aug 2009
Posts: 1615

PostPosted: Thu 21 Aug 2014, 05:17    Post subject:  

/proc and /sys get 555 permissions *after* the kernel is done writing in them. 555 makes the dirs not writable hence the kernel panic (I think)
Change them to 755 and see if this solves it.

PS: you may also need the /run directory that depending on your booting process may cause panic as udev needs it to make devices.
BTW, how the directories on the remastered sfs compare to the original sfs?

_________________
Kids all over the world go around with an XO laptop. They deserve one puppy (or many) too Very Happy
Back to top
View user's profile Send private message 
stemsee


Joined: 27 Jun 2013
Posts: 362
Location: London

PostPosted: Thu 21 Aug 2014, 10:30    Post subject:  

How do they compare? In terms of permissions? I started listing all permissions in running system to compare with remastered directory, but rightclick->properties-> shows a graphic status of permissions I do not know how they are translated numerically! Except by experimenting on a NewDir in Downloads, which I was doing until I got distracted somehow and stopped. Is there a table showing puppy dir permissions in number format?

Also I thought that /run was not a used dir in puppy linux! DebianDog yes, fatdog 700 has a symlink /run linked to /tmp . But i wont hurt to have it there!
Back to top
View user's profile Send private message MSN Messenger 
saintless


Joined: 11 Jun 2011
Posts: 2436
Location: Bulgaria

PostPosted: Thu 21 Aug 2014, 10:56    Post subject:  

stemsee wrote:
Is there a table showing puppy dir permissions in number format?

Try this one:
Code:
ls -l | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/) \
             *2^(8-i));if(k)printf("%0o ",k);print}'

Or this:
Code:
stat -c '%a %n' /tmp /root

_________________
Farewell, Nooby, you will be missed...
Back to top
View user's profile Send private message MSN Messenger 
mavrothal


Joined: 24 Aug 2009
Posts: 1615

PostPosted: Thu 21 Aug 2014, 11:02    Post subject:  

There plenty of articles for linux permissions like this one or this one
Running
Code:
ls -l /initrd/pup_ro2

in a running puppy, will show the default directories and permissions in a puppy sfs.

_________________
Kids all over the world go around with an XO laptop. They deserve one puppy (or many) too Very Happy
Back to top
View user's profile Send private message 
stemsee


Joined: 27 Jun 2013
Posts: 362
Location: London

PostPosted: Thu 21 Aug 2014, 11:24    Post subject:  

ok....thanks guys! Another lesson to learn and apply ...

Saintless's code lists with numerically represented permissions ie tmp=777 etc!

Perfect.
Back to top
View user's profile Send private message MSN Messenger 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11062
Location: Arizona USA

PostPosted: Thu 21 Aug 2014, 16:24    Post subject:  

Stemsee, is your problem solved? Does the remastered iso work now?
Back to top
View user's profile Send private message 
stemsee


Joined: 27 Jun 2013
Posts: 362
Location: London

PostPosted: Fri 22 Aug 2014, 03:28    Post subject:  

@Flash

It didn't solve the issue! But i have to look at mksquashfs -e (exclude) option to make sure tmp mnt sys proc are excluded from the running system, and only those from /tmp/quaddirs/* are added to the sfs.

But try it ... maybe it will work on your distro!
Back to top
View user's profile Send private message MSN Messenger 
stemsee


Joined: 27 Jun 2013
Posts: 362
Location: London

PostPosted: Fri 22 Aug 2014, 06:09    Post subject:  

I have an idea what might be the error. Namely, when creating new mnt in /tmp/quaddirs/ must also create subdirs for mount points - sda1-8 sr0-3 home and ram1, just remastering now. Also experimenting with -read-queue and -write-queue to speed things up.
Back to top
View user's profile Send private message MSN Messenger 
stemsee


Joined: 27 Jun 2013
Posts: 362
Location: London

PostPosted: Fri 22 Aug 2014, 13:20    Post subject:  

Nah - that didn't make any difference either. I wonder if it has to do with uuid or guid?

So i was trying to void using an inermeiary directory that you copy into first but now I will use one in ram --- see if that works.
Back to top
View user's profile Send private message MSN Messenger 
amigo

Joined: 02 Apr 2007
Posts: 2247

PostPosted: Fri 22 Aug 2014, 13:38    Post subject:  

I think you need to investigate the 'standard' perms/ownerships used by other distros in order to get a clear idea of what is needed. And, the same to find out what should not be included in a clone of a system. There should be nothing copied from kernel-gernerated content, that is, /proc /sys and /run should never be copied over. And, /mnt should also not be copied if it contains non-system mounts.

Trying to clone a puppy system is quite difficult to figure out because best-practices are completely ignored or contravened.

Normally, you should be able to just cd into / and:
Code:
cp -a list-of-dirs destination

where list-of-dirs excludes the above mentioned dirs. This is the list I always use -I often clone a running system:
bin lib opt root var etc home sbin srv usr
These:
dev media mnt tmp boot proc run sys
should be handled with care. dev should only be copied if static device files are being used. boot is often mounted on another filesysetm so your clone may or may not need that content. mnt and media should be empty dirs or empty dir structures. proc sys tmp and run should be empty dirs on the cloned system

Normal best-practices usage of the filesystem hierarchy *would* make this possible also under puppy.

I have written two tools which convert perms from octal to human and human to octal which I can provide here if needed in the end. But, the problems booting are owning to improper perms and content, I'm afraid.
Back to top
View user's profile Send private message 
stemsee


Joined: 27 Jun 2013
Posts: 362
Location: London

PostPosted: Fri 22 Aug 2014, 14:07    Post subject:  

Thanks amigo

That makes sense! I believe I have figured out the right way to do it! Avoiding the pitfalls you mention. As i am sure it is kernel-generated content. So I will use the mksquashfs command specifying several more folders for source, namely /initrd/pup_ro2 /initrd/pup_rw /initrd/pup_* (any mounted sfs greater than zero) It must work I think!! And no intermediary directory just more careful excludes
Back to top
View user's profile Send private message MSN Messenger 
amigo

Joined: 02 Apr 2007
Posts: 2247

PostPosted: Sat 23 Aug 2014, 03:17    Post subject:  

The contents of /initrd should also not be copied as they are setup during boot.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [13 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
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.0957s ][ Queries: 12 (0.0209s) ][ GZIP on ]