ADVANCED pup-5xx /sbin/init

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

ADVANCED pup-5xx /sbin/init

#1 Post by Karl Godt »

2 problems occured for me :
1 . : /lib and /bin,/sbin became more than 14MB
2 . : cp -a /bin copied a symlink to busybox , but not my own compiled busybox , which I symlinked after renaming the original busybox .

busybox itself and e2fsck are the main actors for /sbin/init , which if dynamically compiled need libs from /lib .

find@pup511 needs libm.so.6 -> , while find@pup430 not .
ls@pup430 needs libpthread* ......

While pup430 uses 3,5MB of /lib/lib*.so* , pup5xx are using 9-10MB ....

In this thread I want to discuss possibilities and want to present my solutions until now .

One of the main TODOs is to find out , which libs are essentially needed .

So here's the code to filter , which I am using :

Code: Select all

check_space_func(){
####
####KRG check for enough space ...

###Check for Available Test dev node :
if [ "`ls -l /dev/ram8 | cut -b 1-3`" != "brw" -o "`ls -l /dev/ram8 | cut -f 5,6 -d ' '`" != "1, 8" ] ; then
rm -f /dev/ram8 
mknod /dev/ram8 b 1 8
fi

echo -e "\\033[1;34m"'Checking for Compiled RamDisk Size using:'"\\033[0;39m"
MAXSIZEdevRAM1=`mkfs.ext2 -v -b 1024 -i 1024 /dev/ram8 | grep 'blocks' | grep 'inodes' | tr -s ' ' | cut -f 3 -d ' '`
SIZEdevRAMdisk1=$(($MAXSIZEdevRAM1 * 93 / 100))  ###KRG 0.93 is precaution
echo
KERNV=`uname -r`

###Check for /lib/lib*.so* sizes :
echo -e "\\033[1;34m"'Checking Size of /lib/lib*.so* and /lib/ld*.so* ...'
echo -e "\\033[0;39m"
SPACElib=0
LLS=`ls -l /lib/* | grep -o '/lib/.*\->.*' | grep 'firefox' | cut -f 1 -d ' '`
[ "$DebugVal" -ge "2" ] && echo -e "\\033[0;31m"'firefox-libs: '$LLS && echo
LF=`find /lib -maxdepth 1 -name "lib*.so*" -o -name "ld*.so*"`
#Filter not needed files :
LIBF=`echo "$LF" | grep -v "$LLS" | grep -v -E 'libuClibc.*|ld\-uClibc.*|libthread.*|libm\.so\.0|libm\-0.*' | sort`
for i in $LIBF ; do 
SiZElib=`ls -s $i | cut -f 1 -d ' '` 
SPACElib=$(($SPACElib + $SiZElib))
[ "$DebugVal" -ge "2" ] && echo -n "$i"'='"$SiZElib "  ###DBG
[ "$DebugVal" -eq "1" ] && [ "$SiZElib" -ne "0" ] && echo -n "$i"'='"$SiZElib " 
done 
[ "$DebugVal" -ge "2" ] && echo && echo 'total /lib='"$SPACElib"  ###DBG
[ "$DebugVal" -ge "1" ] && echo

echo  -e "\\033[1;34m"'Checking for available RAM ...'
echo -e "\\033[0;39m" 
RAM=`free | grep -i 'mem' | sed 's#^[[:blank:]]*##' | tr -s ' ' | cut -f 2 -d ' '`
FREERAM=`free | grep -i 'mem' | sed 's#^[[:blank:]]*##' | tr -s ' ' | cut -f 4 -d ' '`
RAMLIMITdevRAM2=$(($MAXSIZEdevRAM1 * 2))
echo '                  free counted total RAM:'"$RAM"  ###DBG
echo 'Available RAM (minus Kernel and modules):'"$FREERAM"  ###DBG
echo '     Minimum available free RAM required:'"$RAMLIMITdevRAM2"' ... '  ###DBG

if [ "$SPACElib" -gt "$SIZEdevRAMdisk1" -o "$RAMLIMITdevRAM2" -ge "$FREERAM" ] ; then  #1
echo
echo ";)" 
echo -e "\\033[1;31m"
if [ "$RAMLIMITdevRAM2" -ge "$FREERAM" ] ; then                         #1.1
echo "Needed free RAM is $RAMLIMITdevRAM2 , but free RAM is $FREERAM"
else                                                			        #1.1
echo "/lib/lib*.so* is $SPACElib in KB and larger than the RamDisk compiled for" 
echo -e "\\033[1;32m"  
echo "kernel $KERNV with $SIZEevRAMdisk1 / $MAXSIZEevRAM1 in KB" 
fi  #1.1
echo -e "\\033[0;39m" 
echo -e "\\033[1;31m"  
echo 'fsck omitted !!!' 
echo -e "\\033[1;32m"  
echo 'please do the filesystemcheck via Live CD' 
echo -e "\\033[1;33m"  
echo 'or booting another Puppy or Linux' 
echo -e "\\033[1;36m"  
echo 'type [ reboot ] to reboot' 
echo 'eventually you need to press CTRL+ALT+DELETE to reboot' 
echo 'you may need to check BIOS bootorder also before booting LiveCD' 
echo -e "\\033[0;39m" 
echo  
echo 'dropping to console now , partition still mounted !'
cd /
sleep 2
##BUG-1:15JUN2011##exit
exec chroot . sh  ##BUG-1 fix## 
fi  #1

echo -e "\\033[1;32m" 
echo -e '                                 ... OK :'"\\033[0;39m"$(( $RAM - $FREERAM + $RAMLIMITdevRAM2 ))"\\033[1;32m"' required of '"\\033[0;39m"$RAM
echo -e "\\033[0;39m" 
##### 
}
check_space_func
[edit=15Jun2011]First BUG , which would not occur with more than Kernel+Ramdisk size of RAM >100MB :
The dropping to console by using "exit" is only possible with busybox init running . The exit here in that state would lead to kernel panic . As long as init is not head of all processes , it has to be "exec sh" or "exec chroot . sh" . Bash by default compiles with a PATH that only includes "*/bin" executables and busybox ash both : "*/bin" and "*/sbin" . Calling /sbin executables using "#!/bin/bash" can olny be done by calling the whole path like "exec /sbin/chroot . sh" .
Solutions for this might be "#!/bin/bash --login" , "#!/bin/ash" or setting the PATH variable in the script , which had always worked for me .
Because of some Linux distributions like Debian or Ubuntu put the executables into "/usr/bin:/usr/sbin" it is actually a security feature to not invoke a command by the whole path . One example would be "chroot" which I recognized to be located in some development isos
in "/usr/sbin" like luma-001 by playdayz or dpup-003 by iguleder .[/edit]

The filtering part is this :
################################
###Check for /lib/lib*.so* sizes :
echo -e "\\033[1;34m"'Checking Size of /lib/lib*.so* and /lib/ld*.so* ...'
echo -e "\\033[0;39m"
SPACElib=0
LLS=`ls -l /lib/* | grep -o '/lib/.*\->.*' | grep 'firefox' | cut -f 1 -d ' '`
[ "$DebugVal" -ge "2" ] && echo -e "\\033[0;31m"'firefox-libs: '$LLS && echo
LF=`find /lib -maxdepth 1 -name "lib*.so*" -o -name "ld*.so*"`
#Filter not needed files :
LIBF=`echo "$LF" | grep -v "$LLS" | grep -v -E 'libuClibc.*|ld\-uClibc.*|libthread.*|libm\.so\.0|libm\-0.*' | sort`
for i in $LIBF ; do
SiZElib=`ls -s $i | cut -f 1 -d ' '`
SPACElib=$(($SPACElib + $SiZElib))
[ "$DebugVal" -ge "2" ] && echo -n "$i"'='"$SiZElib " ###DBG
[ "$DebugVal" -eq "1" ] && [ "$SiZElib" -ne "0" ] && echo -n "$i"'='"$SiZElib "
done
[ "$DebugVal" -ge "2" ] && echo && echo 'total /lib='"$SPACElib" ###DBG
[ "$DebugVal" -ge "1" ] && echo
################################

There is a interactive menu for the "DebugVal" , and several functions and lines for splitting /lib into a second ramdisk , which I will post another time .

This box should collect Ideas , on how to work with the huge amount of libs , which I suppose to become more than 13MB in future . I must say , that I had heard about raid arrays but don't know , if one single directory can be splitted over several partitions .
Last edited by Karl Godt on Wed 15 Jun 2011, 17:35, edited 1 time in total.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#2 Post by Karl Godt »

Here now the debug-menu :

Code: Select all

ask_debug_func(){
DebugVal=0
echo -e "\\033[0;39m" 
echo "Do you think $0 DEBUG MODE is required ?"
echo -e -n "\\033[1;34m"
echo "If so , press [ y ] and [ Enter ] for normal debug incl. 'fsck -v' ,"
echo -e -n "\\033[0;39m""\\033[6;7;32m"
echo "    or  press [ Y ] and [ Enter ] for extensive output ,"
echo -e -n "\\033[0;39m" 
echo -e -n "\\033[1;36m"  
echo "which may confuse muchly first and second time ;)"
echo -e "\\033[1;35m" 
echo "If not wait 60sec. or press any other key and or simply [ Enter ]"
echo -e "\\033[7;39m" 
echo -n -e '->'"\\033[0;39m"
read -t 60 K
if [ "$K" = "y" ] ; then
DebugVal=1
echo
echo -e "\\033[0;33m" 
echo 'Debug Mode '"$DebugVal"' turned on'
echo 'Have FUN !'
echo
[ "$DebugVal" -ge "1" ] && echo -n 'DebugVal='"$DebugVal "
elif [ "$K" = "Y" ] ; then
DebugVal=2
echo -e "\\033[0;31m" 
echo 'Debug Mode '"$DebugVal"' turned on'
echo 'Have FUN !'
echo
[ "$DebugVal" = "2" ] && echo -n 'DebugVal='"$DebugVal "
else
echo -e "\\033[0;35m"
echo 'Keeping in Silent Screen Mode'
DebugVal=0
echo 'DebugVal='"$DebugVal "  ###DBG
fi
TimeOut=$(( ($DebugVal + 1) * 60 ))
[ "$DebugVal" -ge "1" ] && echo -e "\\033[0;33m"'TimeOut='"$TimeOut"
echo -e "\\033[0;39m"
}
ask_debug_func
simple , I thing bug-free until now ...

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#3 Post by Karl Godt »

first lines of code of my /sbin/init :

Code: Select all

/bin/busybox mount -t proc none /proc  ###KRG put here for additional df check (wary094 frugal had written /initrd into full install) ###KRG
/bin/busybox mount -o remount,rw /

busybox_init_func(){  ###KRG
/bin/busybox mount -o remount,ro /
/bin/busybox umount /proc
exec /bin/busybox init
}

if [ -d /initrd -a -n "`/bin/busybox df | grep '/initrd'`" ] ; then  ###KRG
echo "$0: Not a full install, continuing with '/bin/busybox init ...'"
busybox_init_func
fi  ###KRG 
also simple ....

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#4 Post by Karl Godt »

I did not like the name fsckme.err , which had changed to fsckme.flg but in my opinion shoud be located in /boot or /etc and be a hidden file , like /etc/.XLOADED .
This function looks for any *FsCkMe.file* using "find -maxdepth 3 -iname ..." :

Code: Select all

errflag_func() {  ###KRG
echo -n -e "\\033[1;33m"'Searching for *fsckme* file 3 levels deep ... '"\\033[0;39m"
ErrFlag=`/bin/busybox find / -maxdepth 3 -type f -iname '*fsckme*' | head -n1`  ###KRG 3 deep for fsckme.file@etc @boot @$HOME ..etc..
if [ -z "$ErrFlag" ] ; then 
echo -e "\\033[1;32m" 'No'
echo -e "\\033[0;39m" 
busybox_init_func
fi
echo -e "\\033[7;31m" 'YES :'"\\033[0;33m"" $ErrFlag"
echo -e "\\033[0;39m"

}
errflag_func  ###KRG 
simple ...

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#5 Post by Karl Godt »

for interactive menus needed USB keyboard kernelmodules + fbcon

Code: Select all

#####KRG for USB keyboards
modprobe ehci_hcd
modprobe uhci_hcd
modprobe ohci_hcd
modprobe usbhid
###KRG loading fbcon :
fbcon_func() {
if [ -n "`modprobe -l | grep 'fbcon'`" ]; then
if [ "`cat /proc/cmdline | grep -E 'vga=ask|vga=0x3[0-9a-fA-F][0-9a-fA-F]|vga=7[0-9][0-9]'`" != "" ]; then
modprobe fbcon  ###modprobe fbcon scrollback:1024K ###for larger scrollback buffer  ###KRG
fi
fi
}
fbcon_func  ###COMMENT if required ; fbcon makes colors little greyish  ###KRG 
simple ...

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#6 Post by Karl Godt »

if youre swithing between IDE and SATA kernels , entries @fsckme.flg might be wrong :

Code: Select all

check_dev_nodes_func(){
#####KRG
###KRG updating fsckme file case switching kernels sda|hda
ROOTDRIVE=`basename $(/bin/busybox rdev | cut -f 1 -d ' ')`  ### | cut -f 1 -d ' ' | sed 's#/dev/##'`
ROOTBLOCKDRIVE=${ROOTDRIVE:0:3}
[ "$DebugVal" -ge "1" ] && echo 'rootdrive='"$ROOTDRIVE"  ###DBG
FS=`mount | grep -w '/' | grep '/dev' | tr -s ' ' | cut -f 5 -d ' '`
PDEV1="$ROOTDRIVE"
DEV1FS="$FS"
[ "$DebugVal" -eq "2" ] && echo $ROOTDRIVE $ROOTBLOCKDRIVE $FS ',' $PDEV1 $DEV1FS
DMESG=`dmesg | grep 'Mounted root' | grep -o 'device.*' | cut -f 2 -d ' ' | sed 's#[[:alpha:][:punct:]]$##`
MAJ=`echo $DMESG | cut -f 1 -d ':'`
Min=`echo $DMESG | cut -f 2 -d ':'`
CATPP=`cat /proc/partitions | sed 's#^[a-zA-Z].*##g ; s#^[[:blank:]][a-zA-Z]##g ; /^$/d' | tr -s ' ' | sed 's#^ ##'`
MAJBL=`echo "$CATPP" | grep -w "$ROOTBLOCKDRIVE" | cut -f 1 -d ' '`
MinBL=`echo "$CATPP" | grep -w "$ROOTBLOCKDRIVE" | cut -f 2 -d ' '`
[ "$DebugVal" -eq "2" ] && echo $DMESG $MAJ $Min ',' $MAJBL $MinBL ',' $CATPP
}
check_dev_nodes_func
this copies /dev/* into ramdisk :
cp -a -r /dev /mnt/ram0/

Code: Select all

check_dev_nodes_funcII(){
  ###KRG: check for existance and correct MAJ Min numbers of absolutely essential devices
  [ ! -b /mnt/ram0/dev/${ROOTBLOCKDRIVE} ] && mknod /mnt/ram0/dev/${ROOTBLOCKDRIVE} b $MAJBL $MinBL 
  [ ! -b /mnt/ram0/dev/${PDEV1} ] && mknod /mnt/ram0/dev/${PDEV1} b $MAJ $Min
  LSRBLDR=`ls -l /mnt/ram0/dev/${ROOTBLOCKDRIVE} | tr -s ' ' | cut -f 5,6 -d ' ' | tr -d ','`
  LSPDEV1=`ls -l /mnt/ram0/dev/${PDEV1} | tr -s ' ' | cut -f 5,6 -d ' ' | tr -d ','`
  MAJLSBLDR=`echo $LSRBLDR | cut -f 1 -d ' '`
  MinLSBLDR=`echo $LSRBLDR | cut -f 2 -d ' '`
  MAJLSPDEV1=`echo $LSPDEV1 | cut -f 1 -d ' '`
  MinLSPDEV1=`echo $LSPDEV1 | cut -f 2 -d ' '`
  [ "$DebugVal" -eq "2" ] && echo  -e "\\033[0;31m"'DRIVES :'$LSRBLDR $MAJLSBLDR $MinLSBLDR ',' $LSPDEV1 $MAJLSPDEV1 $MinLSPDEV1
  if [ "$MAJLSBLDR" != "$MAJBL" -o "$MinLSBLDR" != "$MinBL" ] ; then
  rm /mnt/ram0/dev/${ROOTBLOCKDRIVE} && mknod /mnt/ram0/dev/${ROOTBLOCKDRIVE} b $MAJBL $MinBL
  fi
  if [ "$MAJLSPDEV1" != "$MAJ" -o "$MinLSPDEV1" != "$Min" ] ; then
  rm /mnt/ram0/dev/${PDEV1} && mknod /mnt/ram0/dev/${PDEV1} b $MAJ $Min
  fi
}
  check_dev_nodes_funcII
is not really essential , but in case of corrupted /dev/MAINDRIVE ...

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#7 Post by Karl Godt »

transfering VARIABLES from post 2 and 6 :

Code: Select all

echo "$ROOTDRIVE"','"$FS"',' > /mnt/ram0/etc/fsckme.err  ###KRG
echo 'DebugVal='"$DebugVal" > /mnt/ram0/etc/initdebug.in  ###KRG
echo 'TimeOut='"$TimeOut" >> /mnt/ram0/etc/initdebug.in  ###KRG
simple ...

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#8 Post by Karl Godt »

#creat a ramdisk...
#note, Puppy kernels are compiled with 13MB ramdisk, so need to be careful not to fill it up...
echo -e "\\033[0;35m"'Creating a ramdisk and populating with a Linux environment...'
checking and creating two ramdisks :

Code: Select all

check_ram0_func(){
  if [ ! -b /dev/ram0 -o "`ls -l /dev/ram0 | cut -b 1-3`" != "brw" -o "`ls -l /dev/ram0 | cut -f 5,6 -d ' '`" != "1, 0" ]; then  ###KRG
  echo  -e "\\033[1;31m"'block /dev/ram0 does not exist' 
  rm -f /dev/ram0
  echo -e "\\033[0;39m"'creating now' 
  mknod /dev/ram0 b 1 0
  fi
}
  check_ram0_func
  
  mkfs.ext2 -q -m 5 -b 1024 -i 1024 /dev/ram0
  
make_ram9_func(){
  [ ! -b /dev/ram9 -o "`ls -l /dev/ram9 | cut -b 1-3`" != "brw" -o "`ls -l /dev/ram9 | cut -f 5,6 -d ' '`" != "1, 9" ] && rm -f /dev/ram9 && mknod /dev/ram9 b 1 9  ###KRG
  mkfs.ext2 -q -m 5 -b 1024 -i 1024 /dev/ram9
  sleep 2s
}
  make_ram9_func
  
  mkdir -p /mnt/ram0
  mkdir -p /mnt/ram9  ###KRG
  
  busybox mount -t ext2 /dev/ram0 /mnt/ram0
  busybox mount -t ext2 /dev/ram9 /mnt/ram9  ###KRG
  sleep 2s  ###KRG
had been medium difficult , used "mkfs.ext2 -m 5" instead of "-m 0" ....

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#9 Post by Karl Godt »

#populate the ramdisk...
mkdir -p /mnt/ram0/old_root
mkdir /mnt/ram0/bin
my func for checking busybox :

Code: Select all

busybox_func(){
  ###KRG BUSYBOX
  echo -n -e "\\033[1;34m"'Checking if /bin/busybox is a link to "MyBusybox" : '
  RLF=`readlink -f /bin/busybox`  
  LSLBB=`ls -l /bin/busybox | grep -o '\->.*'`  ###KRG if busybox is a symlink to busybox-version 
  
  if test "$LSLBB" != "" ; then
  echo -e "\\033[1;32m"'YES'
  echo -e "\\033[0;39m"'Copying '"$RLF"' into RamDisk'
  RLBB=`echo $RLF | sed 's#/bin/##'`
  cp -a /bin/"$RLBB" /mnt/ram0/bin/"$RLBB"
  else
  echo -e "\\033[0;32m"'No'
  fi
  echo -e "\\033[0;39m" 
}
  busybox_func

Code: Select all

for ONEBIN in "[" "[[" ash autologinroot basename busybox cat chmod chown clear cp cut date dc dd df dirname dmesg du e3 ed expr false find free grep head kill ln login ls lsmod mkdir mknod more mv nice ntfs-3g pidof pwd readlink rev rm rmdir sed sleep sort stat su sync tail tar touch tr true uname usleep waitmax wc which xargs
  do  ###KRG added e3
   if [ -x /bin/$ONEBIN ] && [ ! -x /mnt/ram0/bin/$ONEBIN ] ;then  ###KRG for symlink busybox
    cp -a /bin/$ONEBIN /mnt/ram0/bin/
    [ "$DebugVal" = "2" ] && echo -n '/bin/'"$ONEBIN "
   else
    if [ "$ONEBIN" != "busybox" -a "`busybox | grep $ONEBIN`" != "" ] ; then  ###KRG
    [ "$DebugVal" = "2" ] && echo -n 'link '"$ONEBIN "
    ln -s busybox /mnt/ram0/bin/$ONEBIN
    fi
   fi
  done
  ln -snf busybox /mnt/ram0/bin/ps ; [ "$DebugVal" = "2" ] && echo -n ' link ps'  
  ln -snf busybox /mnt/ram0/bin/rdev ; [ "$DebugVal" = "2" ] && echo -n ' link rdev' 
  ln -snf busybox /mnt/ram0/bin/sh ; [ "$DebugVal" = "2" ] && echo -n ' link sh'
  ln -snf busybox /mnt/ram0/bin/mount ; [ "$DebugVal" = "2" ] && echo -n ' link mount'
  ln -snf busybox /mnt/ram0/bin/umount ; [ "$DebugVal" = "2" ] && echo -n ' link umount'
  [ "$DebugVal" = "2" ] && echo
spend many hours and days on that ...

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#10 Post by Karl Godt »

now copying /lib into second ramdisk :

Code: Select all

###KRG splitting /lib to second RamDisk :
  mkdir /mnt/ram9/lib  
  echo -e "\\033[1;34m"'Copying Libs ... '
  for i in $LIBF ; do  ###KRG to sort unneeded libs out , see further up ###KRG
  [ "$DebugVal" -ge "1" ] && echo -n -e "\\033[0;33m""$i""\\033[0;39m"' , ' 
  cp -a $i /mnt/ram9/lib/ 
  done  
  [ "$DebugVal" -ge "1" ] && echo -e "\\033[0;39m"
   
  [ "$DebugVal" = "0" ] && cp -a /lib/e2initrd_helper /mnt/ram9/lib/ 2>/dev/null #dunno what this is.  ###KRG me not either
  [ "$DebugVal" -ge "1" ] && echo -e "\\033[0;33m"'Copying /lib/e2initrd_helper .. ' && cp -a /lib/e2initrd_helper /mnt/ram9/lib/
  
  /bin/busybox ln -s /mnt/ram9/lib /mnt/ram0/lib
  mkdir /mnt/ram0/mnt
  mkdir /mnt/ram0/mnt/ram9
$LIBF see post Nr 1 ....

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#11 Post by Karl Godt »

#pivot_root to the ramdisk...
echo -e "\\033[0;35m"'Performing a pivot_root to the ramdisk...'
the pivot_root part :

Code: Select all

[ "$DebugVal" -ge "1" ] && echo -e "\\033[0;33m"'pivot_root now ...'  ###DBG
pivot_root . old_root
[ "$DebugVal" -ge "1" ] && echo -e "\\033[0;33m"'... pivoted'  ###DBG
  
[ ! -d /mnt/ram9 ] && mkdir -p /mnt/ram9  ###KRG needs to be immediately after pivot_root  ###KRG
/bin/busybox mount -o move /old_root/mnt/ram9 /mnt/ram9
/bin/busybox mount -o move /old_root/proc /proc

echo -e "\\033[1;34m"'Unmounting everything beneath /old_root/* ...'
OR=`mount | grep '/old_root/' | cut -f 3 -d ' ' | sort -r`
for i in $OR ; do
[ "$DebugVal" -ge "1" ] && echo -e "\\033[0;33m"'unmounting '"$i"  ###DBG
/bin/busybox umount $i
Err=$?
if [ "$Err" -ne "0" ] ; then
[ "$DebugVal" -ge "1" ] &&  echo -e "\\033[0;33m"'failed , trying lazy .. '  ###DBG 
/bin/busybox umount -l $i
fi
done
I have another /sbin/init that manages the mounting and linking of the second ramdisk slightly different .
The problem is for now , that later "/old_root" gets unmounted but returns an error code of 1 .....

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#12 Post by Karl Godt »

Menu to drop out into rdsh/rdsh0/rdsh6 like pfix=rdsh parameter for frugal installs :

Code: Select all

####KRG Menu for RamDiskShell
echo  
echo -e "\\033[0;32m" 
echo 'Press ANY key and or ENTER to perform fsck'
echo 'Or wait 60s * ($DebugVal + 1)'
echo 'scrolling might be allowed by Shift+PageUP/Down'
echo 'that is cause to have to hit the Enter key'
echo -e "\\033[0;31m" 
echo "or [s] or [r] for drop out into simple rdsh"
echo "or [i] or [b] for drop out into rdsh with busybox init on top"
echo -e "\\033[7;39m" 
echo -n -e '->'"\\033[0;39m"
read -t $TimeOut K
if [ "$K" = "s" -o "$K" = "S" -o "$K" = "r" -o "$K" = "R" ] ; then
echo
echo -e "\\033[0;32m" 
echo 'dropping now into simple rdsh'
echo 'Have FUN !'
echo
echo -e "\\033[0;39m" 
login -f root
exec /sbin/chroot . /bin/sh
  
elif [ "$K" = "i" -o "$K" = "I" -o "$K" = "b" -o "$K" = "B" ] ; then
echo
echo -e "\\033[0;32m" 
echo 'dropping now into busybox init rdsh'
echo -e "\\033[0;33m" 
echo 'Have MORE FUN !'
echo
echo -e "\\033[0;39m" 
echo '#DUMMY' > /etc/rc.d/rc.sysinit
chmod 0775 /etc/rc.d/rc.sysinit
  
exec /sbin/chroot . /bin/sh -c "exec /bin/busybox init" <dev/console >dev/console 2>&1
  
else  
exec /sbin/chroot . /bin/sh -c "exec /bin/busybox init" <dev/console >dev/console 2>&1
fi
#...the ramdisk is setup so that /etc/rc.d/rc.sysinit will run, which does the f.s. check.
medium severe ....

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#13 Post by Karl Godt »

the end of /sbin/init :

Code: Select all

;;
 *)
  echo -e "\\033[1;31m"  #34=blue, 33=yellow, 32=green, 31=red, 35=purple, 36=aquablue, 38=black.
  echo -n "Previous improper shutdown, sorry can only do f.s. check of ext2/3/4."
  echo -e "\\033[0;39m"
  sleep 5s
  mount -o remount,ro /  ###KRG
  exec /bin/busybox init  ###should be something like umount -ar ; reboot ###KRG
 ;;
esac

###END###
the original code does not run reboot here ...

To get it going I added this to the "real" /etc/rc.d/rc.sysinit :

Code: Select all

fsckme_func_0() { 
FSCKME=`find / -maxdepth 3 -type f -iname "*fsckme*"`  ###KRG, for ADvanced /sbin/init
echo $FSCKME  ###DBG
if [ -n "$FSCKME" ] ; then  ###KRG

modprobe ehci_hcd
modprobe ohci_hcd
modprobe uhci_hcd
modprobe usbhid

echo -e "\\033[1;31m"' ... '"$FSCKME"' still exists !'
echo
echo -e "\\033[0;31m"'Want to boot anyway [ B ],[ b ] and [ Enter ] ?'
echo -e "\\033[1;32m"'Reboot [ R ],[ r ] and [ Enter ] ?'
echo -e "\\033[0;32m"'Poweroff [ P ],[ p ] and [ Enter ] ?'
echo -e "\\033[1;34m"'Or simply exit rc.sysinit [ Enter ],[ any other key and Enter ] ?'
echo -e "\\033[1;33m"'         ( timeout 60 sec ... -> exit ) '
echo -e "\\033[7;39m"
echo -n '->'
read -t 60 K
echo -e "\\033[0;39m"
if [ "$K" = "R" -o "$K" = "r" ] ; then
echo 'Rebooting ...'
/bin/busybox umount -ar
/bin/busybox reboot
fi

if [ "$K" = "P" -o "$K" = "p" ] ; then
echo "Pow'ring off the computer ..."
/bin/busybox umount -ar
/bin/busybox poweroff
fi

if [ "$K" = "B" -o "$K" = "b" ] ; then 
echo 'Continuing booting ...'
else
echo 'Exiting /etc/rc.d/rc.sysinit' 
exit
fi
fi
}
fsckme_func_0
This goes to the very beginning and might need a "mount -t proc none /proc" ....

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#14 Post by Karl Godt »

/sbin/init_ramdisk_fsck_/etc/rc.d/rc.sysinit :

Code: Select all

echo '#!/bin/sh
PDEV1=`cat /etc/fsckme.err | cut -f 1 -d ","`  ###KRG
DEV1FS=`cat /etc/fsckme.err | cut -f 2 -d ","`  ###KRG
. /etc/initdebug.in  ###KRG
echo -e "\\033[0;32m" 
echo "Now running in ramdisk, preparing for filesystem check of ${PDEV1}..." 
echo -e "\\033[0;39m" 
[ ! -d /proc ] && mkdir /proc
if [ -z "`mount | grep -o /proc`" ] ; then
[ "$DebugVal" = "0" ] && /bin/busybox mount -t proc none /proc 2>/dev/null  ###KRG added: 2>/dev/null  ###KRG
[ "$DebugVal" -ge "1" ] && /bin/busybox mount -t proc none /proc
fi  
[ "$DebugVal" = "0" ] && /sbin/hwclock --hctosys --localtime 2>/dev/null 
[ "$DebugVal" -ge "1" ] && /sbin/hwclock --hctosys --localtime
echo "unmounting the rootdrive ..."   ###KRG
echo
MOR=`mount | grep "/old_root/"`
for i in `echo "$MOR" | cut -f 3 -d " " | sort -r` ; do
[ "$DebugVal" = "0" ] && /bin/busybox umount $i 2>/dev/null || ErrMor=$?  ###KRG 
[ "$DebugVal" -ge "1" ] && /bin/busybox umount $i || ErrMor=$?
if [ -n "$ErrMor" ] && [ "$ErrMor" -ne "0" ] ; then 
[ "$DebugVal" -ge "1" ] && echo "failed to unmount $i with Error=$ErrMor" && echo
fi
done
if [ -n "`mount | grep -o /old_root`" ] ; then
[ "$DebugVal" = "0" ] && /bin/busybox umount /old_root 2>/dev/null || Err1=$? 
[ "$DebugVal" -ge "1" ] && /bin/busybox umount /old_root || Err1=$?  ###KRG
[ "$DebugVal" -ge "1" ] && echo "Unmounting /old_root: ERROR RETURNCODE=$Err1" && mount && echo  ###DBG
sleep 2s
if [ -n "$Err1" ] && [ "$Err1" -ne "0" ] && [ -n "`mount | grep -o /old_root`" ] ; then  ###KRG
echo "Not so good, was unable to unmount ${PDEV1}. trying lazy now..."
sleep 2s
/bin/busybox umount -l /old_root
Err3=$?
sleep 1s
[ "$DebugVal" -ge "1" ] && echo ERROR RETURNCODE="$Err3"
[ "$DebugVal" -ge "1" ] && echo "Still mounted :" && mount && echo
fi
if [ -n "$Err3" ] && [ "$Err3" -ne "0" ] ; then  ###KRG
echo "Not so good, was unable to unmount ${PDEV1}. trying option force ..."
sleep 2s
/bin/busybox umount -f /old_root
Err5=$?
sleep 1s
[ "$DebugVal" -ge "1" ] && echo ERROR RETURNCODE="$Err5"
[ "$DebugVal" -ge "1" ] && echo "Still mounted :" && mount && echo
fi
[ -n "$Err5" ] && [ "$Err5" -ne "0" ] && echo "Not so good, was unable to unmount ${PDEV1}. Continuing with f.s. check..."
fi
if [ -z "`mount | grep -o /old_root`" ] ; then
echo -e "\\033[1;32m""OK.""\\033[0;32m"" Fscking now ... depending on size of installation, might take awhile""\\033[0;39m"
if [ "$DebugVal" -ge "1" ] ; then
/sbin/e2fsck -v -f /dev/${PDEV1}
else
/sbin/e2fsck -f /dev/${PDEV1}
fi
else
echo -e "\\033[0;31m""Whatever cause ... /old_root or $PDEV1 still mounted!"
echo -e "\\033[0;33m""Performing read-only filesystem check ... ""\\033[0;39m"
[ "$DebugVal" -ge "1" ] && /sbin/e2fsck -n -f -v /dev/${PDEV1}
[ "$DebugVal" = "0" ] && /sbin/e2fsck -n -f /dev/${PDEV1}
fi
/bin/busybox sync
echo
echo -e "\\033[7;32m"
echo "Filesystem check completed!"
echo -e "\\033[0;31m"
mkdir -p /mnt/${PDEV1}  ###KRG removing fsckme.file  ###KRG
busybox mount -t ${DEV1FS} /dev/${PDEV1} /mnt/${PDEV1}
ErrFlag=`find /mnt/${PDEV1} -maxdepth 3 -type f -iname "*fsckme*"`
for i in $ErrFlag ; do
[ "$DebugVal" -ge "1" ] && echo "Removing $i"
rm $i
done
[ -f /mnt/${PDEV1}/etc/.XLOADED ] && rm /mnt/${PDEV1}/etc/.XLOADED
[ -f /mnt/${PDEV1}/tmp/bootcnt* ] && rm /mnt/${PDEV1}/tmp/bootcnt*
rm -f /var/log/X*
rm -f /var/lock/LCK*
rm -f /var/run/*.pid
SOCK=`find /mnt/${PDEV1}/var -mount -type s | tr "\n" " "`
for i in $SOCK ; do
[ "$DebugVal" -ge "1" ] && echo -e "\\033[0;33m""removing ""$i"
rm -f $i
done
PIPE=`find /mnt/${PDEV1}/var -mount -type p | tr "\n" " "`
for i in $PIPE ; do
[ "$DebugVal" -ge "1" ] && echo -e "\\033[0;33m""removing ""$i"
rm -f $i
done
sleep 2
/bin/busybox sync
busybox umount /dev/${PDEV1}  ###KRG
echo -e "\\033[0;36m"
echo "The computer now has to be restarted."
echo -e "\\033[0;35m"
echo "Computer will reboot in 1-3  minutes, else press ENTER for immediate reboot."
echo
echo -e "\\033[0;32m"  ###KRG
echo "Press Any key and or simply ENTER to reboot ,"
echo "or wait 60 sec again ."
echo -e "\\033[0;31m" >/dev/console
echo "or [ r ] for dropout into rdsh :"
echo -e "\\033[7;39m"
echo -n -e "->""\\033[0;39m"
read -t $TimeOut K
if [ "$K" = "r" -o "$K" = "R" ] ; then
echo
echo -e "\\033[0;32m" 
echo "Dropping now"
echo "Have FUN !"
echo
echo -e "\\033[0;39m"
###exec /sbin/chroot . /bin/sh
exit
else
echo -e "\\033[0;39m"  ###KRG
[ "$DebugVal" = "0" ] && /bin/busybox umount /proc 2>/dev/null
[ "$DebugVal" -ge "1" ] && /bin/busybox umount /proc
/bin/busybox reboot
fi' > /mnt/ram0/etc/rc.d/rc.sysinit
  chmod 0755 /mnt/ram0/etc/rc.d/rc.sysinit
unmounting /old_root made me mad many times ... , especially if /old_root/dev is still mounted or /old_root/ramdisk2 . "umount -l" ( lazy ) is much more effective as far as my experience can tell , than "umount -f" ( force ) . The error message is same at '-l' and '-f' option ( can't forcibly umount ... ) .

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#15 Post by Karl Godt »

Now place for the script . It might differ slightly from the code I posted, which I did little cosmetics here and there . It works for me , so please post bugs and suggestions . I only have one working 10Year old IDE PC since my Laptop froze experimenting with the low-usb-driver "ub" , which is also blacklisted @/etc/rc.d/MODULESCONFIG at several puppies , so I am eager to hear where it works and not.
Attachments
ADVANCEDpup5_sbin_init.tar.gz
# tar -ztf ADVANCEDpup5_sbin_init.tar.gz
ADVANCEDpup5_sbin_init/
ADVANCEDpup5_sbin_init/init-1.0-1.1.diff
ADVANCEDpup5_sbin_init/KRG-init-v.1.1
ADVANCEDpup5_sbin_init/TODO
ADVANCEDpup5_sbin_init/README
ADVANCEDpup5_sbin_init/KRG-init-v.1.0
(9.19 KiB) Downloaded 703 times
init_deLuxe.gz
covers connection from initrd.gz to rc.sysinit
some puppies wanted /sys mounted (lhpup443)
checks for fsck-intervals
checks if partition is still clean prior to and if it is boots anyway
if fsck then tries to load files from other Puppies on disk
(13.04 KiB) Downloaded 742 times

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

Interval check

#16 Post by Karl Godt »

After running it a long time now, i think i release version 2 of my /sbin/int .

It has a check for mount intervals and day check intervals :

Code: Select all

ERRFLG_FUNC() {  ###KRG
echo -e "\\033[1;34m"'Checking for unpropper previous shutdown  ... '"\\033[0;39m"
echo -n -e "\\033[1;33m"'Searching for *fsckme* file 3 levels deep ... '"\\033[0;39m"
ErrFlag=`busybox find / -maxdepth 3 -type f -iname '*fsckme*' | head -n1`  ###KRG 3 deep for fsckme.file@etc @boot @$HOME ..etc..
if [ -z "$ErrFlag" ] ; then  ##1
echo -e "\\033[56G\\033[1;5;32m"'Hurray , not found !'"\\033[0;39m"
echo -e "\\033[1;33m"'Checking for filesystem check intervals using'"\\033[0;39m"
LANG=C
VARS=`dumpe2fs $DEVROOTDRIVE | grep -E 'Maximum mount count|Mount count|Next check after|Check interval'`
###+++2011-11-15 had logically removed this ; would have been a bug due interN used further down
interC=`echo "$VARS" | grep 'Check interval' | tr '\n' ' '`
interN=`echo "$interC" | tr -s ' ' | cut -f 3 -d ' ' | grep -o -e '[[:digit:]]*'`
interN=$((interN/60/60/24))
 ###+++2011-11-15
nextch=`echo "$VARS" | grep 'Next check after' | tr '\n' ' '`
nextcM=`echo "$nextch" | tr -s ' ' | cut -f 5 -d ' '`
nextcD=`echo "$nextch" | tr -s ' ' | cut -f 6 -d ' '`
#echo "$nextch" ##+++2012-01-11
nextcY=`echo "$nextch" | tr -s ' ' | cut -f 8 -d ' '` ##+++2012-01-11 major bug !!
todays=`date`
todayY=`echo "$todays" | tr -s ' ' | cut -f 6 -d ' ' | tr -d [[:punct:]]`  ##+++ 2011_11_15 from luci218
todayM=`echo "$todays" | tr -s ' ' | cut -f 2 -d ' ' | tr -d [[:punct:]]`  ##lang dependent pos
todayD=`echo "$todays" | tr -s ' ' | cut -f 3 -d ' ' | tr -d [[:punct:]]`
mntcnt=`echo "$VARS" | grep 'Mount count'| grep -o '[[:digit:]]' | tr -d '\n'`
maxmnt=`echo "$VARS" | grep 'Maximum mount count' | grep -o '[[:digit:]]' | tr -d '\n'`
diffMC=$(( $maxmnt - $mntcnt ))
monthN=`for i in $(seq 1 12) ; do cal $i 1 | head -n 1 | grep -o '[[:alpha:]]*' | sed "s/^/$i /"; done`
monthT=`echo "$monthN" | grep "$todayM"`
montTN=`echo "$monthT" | cut -f 1 -d ' '`
monthC=`echo "$monthN" | grep "$nextcM"`
montCN=`echo "$monthC" | cut -f 1 -d ' '`
val30C=`cal $montCN 1 | grep '[[:digit:]]$' | sed '/^$/d' | tail -n 1 | grep -o -e '[[:digit:]]*$'`
##+++ 2011_11_15 from luci218
val30B=0
for i in `seq $((montCN+1)) $((montTN-1))` ; do
val30i=`cal $i 1 | grep '[[:digit:]]$' | sed '/^$/d' | tail -n 1 | grep -o -e '[[:digit:]]*$'`
val30B=$((val30B+val30i))
done
##+++ 2011_11_15 from luci218
val30T=`cal $montTN 1 | grep '[[:digit:]]$' | sed '/^$/d' | tail -n 1 | grep -o -e '[[:digit:]]*$'`
echo -e "\\033[0;39m"
#echo $LINENO $todayY $nextcY
FSCK=
if [ "$mntcnt" -ge "$maxmnt" ] ; then  ##2
echo -e "\\033[1;33m"'Maximum mount count reached'"\\033[0;39m"
FSCK='yes'
##fi  ##2
#echo $LINEMO
else ##2
if [ "$todayY" -ge "$nextcY" ] ; then #2.1 ##+++2011_11_15 from luci218
#echo $LINENO
if [ "$montTN" = "$montCN" ] ; then #3
#echo $LINENO
if [ "$todayD" -gt "$nextcD" ] ; then  #4
echo -e "\\033[1;33m"'Day interval reached'"\\033[0;39m"
FSCK='yes'
fi #4
#echo $LINENO
else #3
#echo $LINENO
if [ "$montTN" -gt "$montCN" ] ; then #5
MinusTD=$todayD
PlusCD=$(( $val30C - $nextcD ))
##+++2011_10_19 month difference missing val30B
SUM=$(( $MinusTD + $val30B + $PlusCD ))
#echo $LINENO
if [ "$SUM" -gt "$interN" ] ; then #6
echo -e "\\033[1;33m"'Day interval reached'"\\033[0;39m"
FSCK='yes'
fi #6
#echo $LINENO
else #5
FSCK=''
fi #5
#echo $LINENO
fi #3
fi #2.1
fi ##2
#echo $LINENO
if [ -z "$FSCK" ] ; then #7
echo -e "\\033[1;32m"'OK , '"\\033[0;32m""next check '$nextcM $nextcD' or in '$diffMC' mounts""\\033[0;39m"
echo -e "\\033[0;39m"
BUSYBOX_INIT_FUNC
#echo $LINENO
else #7
echo -e "\\033[1;33m"'Filesystem check interval reached :'"\\033[0;39m"
echo -e "\\033[0;33m"'Today : '"\\033[0;33m""$todayM $todayD""\\033[0;33m"' , next check was or would be : '"\\033[0;33m""$nextcM  $nextcD""\\033[0;33m"
echo -e "\\033[0;33m"'mount intervals : '"\\033[0;33m""$mntcnt""\\033[0;33m"' of '"\\033[0;33m""$maxmnt"
echo -e "\\033[0;39m"
fi #7
#echo $LINENO
else #1
echo -e "\\033[1;31m" ' Found : '"\\033[0;39m""\\033[1;5;31m""$ErrFlag"
echo -e "\\033[0;39m"
fi #1
}
Note 1 :
I have put a removal of /var/tmp and /tmp gets moved to /var/tmp/ .
Note 2 :
Due to giving access to keyboard i have put in a lot of the module loading part of rc.sysinit .
Note 3 :
I am working on implementing other filesystem capabilities atm , reiserfs 3x first .
Attachments
init-2.1.bz2
(16 KiB) Downloaded 452 times

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#17 Post by sunburnt »

Wow, the amount of code is staggering, much more than Tiny Core.

And even it has more than is needed for a simplified setup, as it makes
masses of links and has it`s app. loading / unloading method code.

I didn`t catch what your new init code does for Puppy...

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#18 Post by Karl Godt »

sunburnt wrote:Wow, the amount of code is staggering, much more than Tiny Core.

And even it has more than is needed for a simplified setup, as it makes
masses of links and has it`s app. loading / unloading method code.

I didn`t catch what your new init code does for Puppy...
The main purpose is to have an interactive and debugging mode .

Fsck -y automatically repair without questions can mess up things ie move a lot files to /lost+found like windows chkdsk to /found.000 .

On both OS Linux+Win these files get numbered names, so they become nearly impossible to recover correctly, especially the small files . 100 Mb files could be easily thought they may be some .sfs or .iso but how to recover /boot/grub for example if its files get named like

found_001.chk
found_002.chk
.
.
.

If you ever have experienced such on both OS like me you want to make a fsck -n or -i first to get an overview .

Parts of the code are also experimental mounting a sfs found somewhere on disk in case the needed binaries are corrupted too .

I have implemented a check for glibc version which might not be needed .

I could think of the whole put in an initrd.gz for full installs , where it would not need to check /lib for size, pivot_root and that all .

This /sbin/init is intended for people that want not much "Crunchbang" to their HDD .

linuxcbon
Posts: 1312
Joined: Thu 09 Aug 2007, 22:54

#19 Post by linuxcbon »

Nice theory but nobody will use it. Could you please make a puppy derivative with all your scripts ? Can you make them work with busybox ash ?

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#20 Post by Karl Godt »

I am on full installations mainly and there are so many Puppies out and Projects that it should be OK for me not to make a Derivate for now .

I am enjoying my adjustments which are different everywhere with their ugly debugging output . Not sure if that would be successful since such is not common .

I really do like busybox and i don't call it a "crippled whatsever" but ash has some disadvantages to bash :

no arrays
type has no -a option

for example .

Hardware that survived older Puppy versions rc.shutdown for example i think you can busybox poweroff without getting nightmares .

I am not the real minimalist , my RAM stated once with 320 MB . I have configured my kernels with both SATA and IDE inside and enjoing them .

There are some testers out there that complain about empty folders . Who needs them ?

But now i have problems with newer Hardware with Xorg for example . Some kernel configurations i thought would work don't work anymore and am regretting that i thrashed some kernels that did not work back then . My main kernel compiling machine died and i would have to setup a new one .

Today i struggled with testdisk for example after i accidentally did a cp /file /dev/hda which destroyed the MBR . The problem was the extended part of the partitions and after several attempts testdisk was able to dd the (two) partitions in question and the correct one was able to mount to recover but testdisk ordered my disordered physical/numbered partiton table and i had to get grub installed and find me a backup menu.lst and change the root (hdx,y) and root=/dev/hdaz entries .

Such things happen to me every day . Compiling can turn out very troublesome hunting dependencies, fixing the various [qic*]makes, fixing header structures, I mostly compile "./configure" that probably is not Puppy-like (i486) . Must say my HW started with i686 .

And for this particular /sbin/init i need a new HDD to experiment with other filesystems which could be possible since i was able to spare for two new ones; mail came yest/oday at least one can be picked up in some hours .

And i even think that is useless since it seems that really most people run Puppy frugally, which i can not understand since i once started with kernel 2.2 series suse-linux once when such loop mounting probably was not invented back then having had no telephone nor router .

And there is so many testing Puppy.iso ~ twice a week : enjoy them !

And for fsck : Because of my desaster today i had to fsck /dev/hda1 which got the superblock overwritten and for the record : Linux fsck names the files in lost+found "#NUMBER" without an extension .

Another idea i developed today is to add a mbr_backup.txt file to contain fdisk -l, date, and file output so i now which mbr.NUMBER is the one to be used; had grub4dos on hda1 and menu.lst was gone . I really like grub4dos but on toplevel of first drive I never really felt comfortable, and mostly stay with legacy grub .

Post Reply