Changeset 2444 in MondoRescue for branches/2.2.10/mindi


Ignore:
Timestamp:
Sep 30, 2009, 4:44:40 AM (16 years ago)
Author:
Bruno Cornec
Message:
  • priority given to env var for tmpdir
  • fuse FS excluded from tmpdir computation
  • Improves udev timeout handling
  • fuse device is needed at restore time for sshfs
  • Avoids comment analysis in the new code handling deplist.d
  • Avoids error message if some ssh conf files do not exist
  • Improvements on sshfs/ssh management in restore mode
  • Include now all minimal requirements for sshfs
  • Fix udev support in init for Mandriva 2009.1 (udevadm settle is blocking)
  • Improve deplist.d/* files
  • adds libnss for ssh support in boot disk
  • Solve a memory management issue in DSF module (strtok => mr_strtok)
  • DSF now also supports partitions in addition to full disks
  • Adds debug in open_and_list_dir
  • Improve user management for NetFS cases
  • ssh in the restore env needs some dlopened libs (libnss_compat|files)
  • Warning emited in case of duplicate mountpoints or devices in fstab found
  • Use only the AWK veriable everywhere and not the awk command
  • Simplify GetInitrdFilesystemToUse which doesn't need to detect everything, but just know if it's initramfs (new mode) or a compressed FS ext2/3 (older mode) as initrd is anyway re-made by mindi. Should fix #353

(Backport from 2.2.9)

Location:
branches/2.2.10/mindi
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mindi/deplist.d/base.conf

    r2409 r2444  
    3232
    3333/usr/bin/bzip2
     34# is a link => No additional place
    3435/usr/bin/bunzip2
    3536/usr/bin/lzop
     37/usr/bin/lzma
    3638
     39/bin/bash
    3740/bin/date
    3841/sbin/ctrlaltdel
  • branches/2.2.10/mindi/deplist.d/minimal.conf

    r2410 r2444  
    77
    88# Base Unix commands
    9 /bin/bash
    109/bin/mt
    1110/bin/awk
     
    1615/bin/df
    1716/usr/bin/loadkeys
     17/sbin/pidof
    1818
    1919# Compression
    20 /bin/gunzip
    2120/bin/gzip
    2221
     
    3433/sbin/mount.fuse
    3534/usr/bin/fusermount
     35/usr/bin/ssh
     36# Required by ssh as dlopened
     37/usr/lib/libnss_compat.so
     38/usr/lib64/libnss_compat.so
     39/usr/lib/libnss_files.so
     40/usr/lib64/libnss_files.so
     41/etc/ssh
    3642/usr/bin/ulockmgr_server
    3743/sbin/mount.cifs
     
    5864/sbin/udev
    5965/sbin/udevstart
     66/sbin/create_static_dev_nodes
    6067/etc/init.d/functions
    6168
  • branches/2.2.10/mindi/deplist.d/net.conf

    r2410 r2444  
    66# SSH support
    77/usr/sbin/sshd
    8 /usr/bin/ssh
    98/usr/bin/scp
    109
  • branches/2.2.10/mindi/mindi

    r2428 r2444  
    1919KERVER=$KERVERRUN
    2020
    21 ADDITIONAL_BOOT_PARAMS="devfs=nomount noresume selinux=0 barrier=off"
     21# In case of problem with udev you can try to add udevdebug
     22ADDITIONAL_BOOT_PARAMS="devfs=nomount noresume selinux=0 barrier=off udevtimeout=10"
    2223
    2324MINDI_REV=PBREV
     
    471472        [ "$r" -ne "0" ] && LogAll "$incoming not found"
    472473        res=$(($res+$r))
    473 #       echo "'$incoming' generates filelist '$filelist'" >> $LOGFILE
     474#       LogFile "'$incoming' generates filelist '$filelist'"
    474475        for fname in $filelist ; do
    475476            [ "$fname" != "" ] && echo "$fname" >> $tempfile
     
    611612
    612613# Check kernel filesystem capabilites for accessing initrd image
     614# Could be ext2 FS (old mode) or initramfs (new mode)
    613615#
    614616# Interface definition:
     
    646648    if [ $? -eq 0 ]; then
    647649        lvScanRes=`gzip -cd $lvKernelImage | strings | grep -E "$lcMagicCramfs|$lcMagicExt2fs|$lcMagicExt3fs|$lcMagicInitfs"`
    648     else
    649         # Since 2.6.30 kernel can use lzma and bzip2 in addition to gzip for initramfs compression
    650         # get offet of gzip magic "1f8b0800" in file (or 1f8b9e ??)
    651         lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "1f8b0800")}'`
    652         if [ $lvOffset -eq 0 ]; then
    653             # get offet of bzip2 magic "425a" in file
    654             lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "425a")}'`
    655             if [ $lvOffset -eq 0 ]; then
    656                 # get offet of lzma magic "5d00" in file
    657                 lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "5d00")}'`
    658                 if [ $lvOffset -eq 0 ]; then
    659                     Die "No magic compression pattern found in file $lvKernelImage. Terminating."
    660                 else
    661                     comp="lzma"
    662                 fi
    663             else
    664                 comp="bzip2"
    665             fi
     650
     651        # determine which filesystem to use for initrd image: ext2|3fs, gzip'ed cpio (initramfs) or cramfs
     652        if [ `echo $lvScanRes | grep -Ec "$lcMagicExt2fs"` -eq 1 ]; then
     653            lvUseFilesystem="ext2fs"
     654        elif [ `echo $lvScanRes | grep -Ec "$lcMagicExt3fs"` -eq 1 ]; then
     655            lvUseFilesystem="ext3fs"
     656        elif [ `echo $lvScanRes | grep -Ec "$lcMagicInitfs"` -eq 1 ]; then
     657            lvUseFilesystem="initramfs"
     658        elif [ `echo $lvScanRes | grep -Ec "$lcMagicCramfs"` -eq 1 ]; then
     659            lvUseFilesystem="cramfs"
    666660        else
    667             comp="gzip"
    668         fi
    669 
    670         lvOffset=`expr $lvOffset / 2`
    671         LogFile "  GetInitrdFilesystemToUse(): $comp magic found in $lvKernelImage at lvOffset $lvOffset.\n"
    672 
    673         # scan kernel image for initrd filessystem support
    674         lvScanRes=`dd ibs=1 skip=$lvOffset if=$lvKernelImage obs=1M 2>/dev/null | $comp -dc 2> /dev/null | strings | grep -E "$lcMagicCramfs|$lcMagicExt2fs|$lcMagicExt3fs|$lcMagicInitfs"`
    675     fi
    676 
    677     # determine which filesystem to use for initrd image: ext2fs, gzip'ed cpio (initramfs ) or cramfs
    678     if [ `echo $lvScanRes | grep -Ec "$lcMagicExt2fs"` -eq 1 ]; then
    679         lvUseFilesystem="ext2fs"
    680     elif [ `echo $lvScanRes | grep -Ec "$lcMagicExt3fs"` -eq 1 ]; then
    681         lvUseFilesystem="ext3fs"
    682     elif [ `echo $lvScanRes | grep -Ec "$lcMagicInitfs"` -eq 1 ]; then
     661            lvUseFilesystem="UNSUPPORTED"
     662        fi
     663
     664    else
     665        # In that case, we are after 2.6.30 and use the supported initramfs
    683666        lvUseFilesystem="initramfs"
    684     elif [ `echo $lvScanRes | grep -Ec "$lcMagicCramfs"` -eq 1 ]; then
    685         lvUseFilesystem="cramfs"
    686     else
    687         lvUseFilesystem="UNSUPPORTED"
    688     fi
    689 
     667    fi
    690668    # say what we are using
    691     LogFile "  GetInitrdFilesystemToUse(): Filesytem to use for initrd is $lvUseFilesystem.\n"
     669    LogFile "  GetInitrdFilesystemToUse(): Filesytem to use for initial ramdisk is $lvUseFilesystem.\n"
    692670
    693671    # return file system to use
     
    734712    if [ -e "/vmfs/volumes" ]; then
    735713        # For VMWare ESX 3 get the device names of these volumes
    736         vdf -P | grep -E '/vmfs/volumes' | awk '{print $1}'
     714        vdf -P | grep -E '/vmfs/volumes' | $AWK '{print $1}'
    737715    fi
    738716    return
     
    12971275        else
    12981276            if [ "$partition_format" = "dos" ] || [ "$partition_format" = "msdos" ] ; then
    1299                 LogFile "Stupid bastard..."
     1277                LogFile "vfat should be used instead of dos/msdos as a partition format"
    13001278                partition_format="vfat"
    13011279            fi
     
    13061284}
    13071285
     1286CheckMountlist() {
     1287    local file=$1
     1288    # Coherency verification
     1289    ML0=`cat $file | wc -l`
     1290    ML1=`$AWK '{print $1}' $file | sort -u | wc -l`
     1291    ML2=`$AWK '{print $2}' $file | sort -u | wc -l`
     1292    if [ "$ML0" -ne "$ML1" ]; then
     1293        LogFile "--------------------------------------------"
     1294        echo "WARNING: Duplicate device entry in mountlist" | tee -a $LOGFILE
     1295        LogFile "--------------------------------------------"
     1296    fi
     1297    if [ "$ML0" -ne "$ML2" ]; then
     1298        LogFile "--------------------------------------------"
     1299        echo "WARNING: Duplicate mountpoint entry in mountlist" | tee -a $LOGFILE
     1300        LogFile "------------------------------------------------"
     1301    fi
     1302}
    13081303
    13091304MakeSureNumberIsInteger() {
     
    18221817touch $mpincfile
    18231818if [ -a $MODPROBE_CONF ]; then
    1824     includes=$(awk '/^[ \t]*include[ \t]+/ {if(NF>=2){print $2}}' $MODPROBE_CONF|sort -u)
     1819    includes=$($AWK '/^[ \t]*include[ \t]+/ {if(NF>=2){print $2}}' $MODPROBE_CONF|sort -u)
    18251820    if [ -n "$includes" ]; then
    18261821        for include in $includes
     
    19301925    TOTAL_BIGDIR_SIZE=`du -sk $bigdir | cut -f1`
    19311926    MakeMountlist $MINDI_TMP/mountlist.txt
     1927    CheckMountlist $MINDI_TMP/mountlist.txt
    19321928    mkdir -p $bigdir/tmp
    19331929    cp -f $MINDI_TMP/mountlist.txt $bigdir/tmp/mountlist.txt 2>> $LOGFILE || Die "Cannot copy mountlist.txt from $MINDI_TMP to data disk"
     
    19431939    fi
    19441940    cat $bigdir/tmp/mountlist.txt >> $LOGFILE
     1941    LogFile "-----------------------------------"
     1942
     1943    LogFile -en "$FILES_IN_FILELIST" > $bigdir/FILES-IN-FILELIST
    19451944    echo -en "$LAST_FILELIST_NUMBER" > $bigdir/LAST-FILELIST-NUMBER 2>> $LOGFILE
    19461945    if [ _"$MONDO_SHARE" != _"" ]; then
     
    19681967    while [ "$incoming" != "" ]; do
    19691968        # We take the full path name of the dyn. lib. we want
    1970         incoming=`echo "$incoming" | awk '{if (match($1,/\//)) {print $1} else {if (match($3,/\//)) print $3} fi}'`
     1969        incoming=`echo "$incoming" | $AWK '{if (match($1,/\//)) {print $1} else {if (match($3,/\//)) print $3} fi}'`
    19711970        for f in $incoming ; do
    19721971            # echo modified file name if one of the parent dir is a link
     
    22362235        # We want to use the real mount and all the supported variants (nfs, cifs, ...)
    22372236        rm -f bin/mount $MINDI_TMP/busy.lis
    2238         mountlis=`grep -E "mount|fuse|ssh" $DEPLIST_FILE $DEPLIST_DIR/* | cut -d: -f2`
    2239         for f in $MINDI_LIB/rootfs/bin/busybox $mountlis ; do
    2240             if [ -f $f ]; then
    2241                 LocateDeps $f >> $MINDI_TMP/busy.lis
    2242             fi
     2237        mountlis=`grep -E "mount|fuse|ssh" $DEPLIST_FILE $DEPLIST_DIR/* | grep -v " *#.*" | cut -d: -f2 | sort -u`
     2238        LocateDeps $MINDI_LIB/rootfs/bin/busybox $mountlis >> $MINDI_TMP/busy.lis
     2239        # Special for libs
     2240        for f in `grep -E "libnss" $DEPLIST_FILE $DEPLIST_DIR/* | grep -v " *#.*" | cut -d: -f2`; do
     2241            echo "`ReadAllLink $f`" >> $MINDI_TMP/busy.lis
    22432242        done
     2243        # Initial / are trucated by tar
    22442244        tar cf - $mountlis `sort -u $MINDI_TMP/busy.lis` 2>> $MINDI_TMP/$$.log | tar xf - || LogAll "Problem in mount analysis" $MINDI_TMP/$$.log
    22452245        rm -f $MINDI_TMP/busy.lis
    22462246    fi
     2247
     2248    # Copy of files mandatory for ssh to automate mount if sshfs is used
     2249    mkdir $mountpoint/.ssh
     2250    cp -rp ~root/.ssh/*.pub ~root/.ssh/config ~root/.ssh/known* $mountpoint/.ssh 2> /dev/null
     2251    echo > $mountpoint/tmp/myssh << EOF
     2252ssh -o StrictHostKeyChecking=no $*
     2253EOF
     2254    chmod 755 $mountpoint/tmp/myssh
    22472255
    22482256    # Copy of files mandatory for ld.so
     
    23962404    mkdir -p $mountpoint/proc
    23972405    echo "$BOOT_SIZE" > $mountpoint/tmp/$BOOT_SIZE.siz
     2406
     2407    LogFile "---------------------------"
     2408    LogFile "Content of initial ramdisk:"
     2409    LogFile "---------------------------"
     2410    (cd $mountpoint ; ls -Rla ) >> $LOGFILE
     2411    LogFile "---------------------------"
     2412
    23982413    # Determine what filesystem to use for initrd image
    23992414    LogFile "Call GetInitrdFilesystemToUse() with parameter ${kernelpath} to get filesystem to use for initrd."
     
    25962611LogFile "-------------"
    25972612lsmod >> $LOGFILE
    2598 MODULES="`cat /proc/modules | awk '{print $1}'`"
     2613MODULES="`cat /proc/modules | $AWK '{print $1}'`"
    25992614if [ -x /usr/sbin/esxcfg-module ]; then
    26002615    LogFile "-------------"
     
    26042619    LogFile "-------------"
    26052620    /usr/sbin/esxcfg-module -l >> $LOGFILE
    2606     MODULES="$MODULES `/usr/sbin/esxcfg-module -l | awk '{print $1}'`"
     2621    MODULES="$MODULES `/usr/sbin/esxcfg-module -l | $AWK '{print $1}'`"
    26072622fi
    26082623LogFile "FORCE_MODS:"
     
    26692684    elif [ "$1" = "--locatedeps" ] ; then
    26702685        [ ! "$2" ] && Die "Please specify the binary to look at"
    2671         LocateDeps $2
     2686        LocateDeps $*
    26722687        # Avoids logfile content for mondo
    26732688        export MONDO_SHARE=""
     
    26822697        [ ! "$2" ] && Die "Please specify the output file"
    26832698        MakeMountlist $2
     2699        CheckMountlist $2
    26842700        # Avoids logfile content for mondo
    26852701        export MONDO_SHARE=""
     
    28182834    MakeMondoConfigFile $MINDI_TMP/mondo-restore.cfg
    28192835    MakeMountlist $MINDI_TMP/mountlist.txt
     2836    CheckMountlist $MINDI_TMP/mountlist.txt
    28202837    mkdir -p $MINDI_TMP/small-all/tmp
    28212838    cd $MINDI_TMP/small-all
  • branches/2.2.10/mindi/rootfs/etc/passwd

    r2428 r2444  
     1root::0:0::/:/bin/bash
    12halt:x:7:0:halt:/sbin:/sbin/halt
    2 operator:x:11:0:operator:/root:/bin/bash
    3 root::0:0::/root:/bin/bash
     3operator:x:11:0:operator:/:/bin/bash
    44shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
    55sync:x:5:0:sync:/sbin:/bin/sync
     
    88daemon:x:2:2:daemon:/sbin:
    99adm:x:3:4:adm:/var/adm:
    10 lp:x:4:7:lp:/var/spool/lpd:
    11 mail:x:8:12:mail:/var/spool/mail:
    12 postmaster:x:14:12:postmaster:/var/spool/mail:/bin/bash
    13 news:x:9:13:news:/usr/lib/news:
    14 uucp:x:10:14:uucp:/var/spool/uucppublic:
    1510man:x:13:15:man:/usr/man:
    1611guest:x:405:100:guest:/dev/null:/dev/null
  • branches/2.2.10/mindi/rootfs/etc/udev-links.conf

    r1804 r2444  
    5656
    5757M null      c   1 3
     58M fuse      c   10 229
  • branches/2.2.10/mindi/rootfs/sbin/init

    r2382 r2444  
    301301    fi
    302302    # Depending on udevd version it gives back the hand or not :-(
    303     if [ ! "`ps | grep udevd`" ]; then
     303    ps | grep udevd 2> /dev/null 1> /dev/null
     304    if [ $? -ne 0 ]; then
    304305        /sbin/udevd --daemon &
     306        echo "Waiting for udev to start..."
    305307        sleep 5
    306308    fi
     
    309311        /sbin/udevtrigger
    310312    fi
     313    echo "Waiting for udev to discover..."
    311314    create_dev_makedev
    312315    # Newer version use udevadm for that
    313     if [ -x /sbin/udevadm ]; then
    314             /sbin/udevadm settle --timeout=10
    315     elif [ -x /sbin/udevsettle ]; then
    316         /sbin/udevsettle
     316    if [ -x /sbin/udevsettle ]; then
     317        /sbin/udevsettle --timeout=10
     318    elif [ -x /sbin/udevadm ]; then
     319        /sbin/udevadm trigger
     320        /sbin/udevadm settle --timeout=10
    317321    fi
    318322    # It seems we need to have more static devs on some distro were
  • branches/2.2.10/mindi/rootfs/sbin/start-netfs

    r2382 r2444  
    8181    if [ "$proto" = "sshfs" ]; then
    8282        LogIt "Mounting SSHFS share ($netfsmount) on /tmp/isodir..."
    83         sshfs -o ro $netfsmount /tmp/isodir
     83        # We need a correct console for ssh
     84        ln -sf /dev/console /dev/tty
     85        sshfs -o ro,StrictHostKeyChecking=no $netfsmount /tmp/isodir
    8486    elif [ "$proto" != "" ]; then
    8587        LogIt "Mounting Network share ($netfsmount) on /tmp/isodir..."
Note: See TracChangeset for help on using the changeset viewer.