Come posso evitare che uno script di shell pianificato contenente un comando rsync provochi un panico del kernel?

3

Ho un semplice script di shell di backup che viene eseguito ogni giorno alle 1:00. Usa rsync per copiare dodici diverse directory sul disco rigido esterno del mio computer Windows. Ecco un esempio:

rsync -a --delete-after --progress --stats "$HOME/Downloads" "/Volumes/Backups/MacBook Pro"

Funzionava benissimo, ma un giorno il kernel è entrato nel panico. Quindi il giorno dopo. E poi il prossimo. Ho risolto alcuni problemi e ho scoperto che il panico del kernel si verifica solo quando la directory "$ HOME / Documents" è inclusa nell'elenco delle directory di cui eseguire il backup. Ma ecco la cosa bizzarra: se eseguo lo script di backup manualmente, lo script esegue tutto senza il panico del kernel. Qualche idea? Ecco il rapporto:

Sat Jun 23 01:05:10 2012
panic(cpu 4 caller 0xffffff80002c473a): Kernel trap at 0xffffff7f8081a348, type 14=page fault, registers:
CR0: 0x000000008001003b, CR2: 0xffffff802216a000, CR3: 0x00000001c4fd3077, CR4: 0x00000000000606e0
RAX: 0x0000000000000067, RBX: 0xffffff802216005c, RCX: 0xffffff801dee780a, RDX: 0x0000000000000000
RSP: 0xffffff80f05cbb60, RBP: 0xffffff80f05cbbc0, RSI: 0x0000000000000001, RDI: 0xffffff8022169fcc
R8:  0x0000000000000000, R9:  0x0000000000000000, R10: 0x80000001c4fd3077, R11: 0xffffff8023ffc800
R12: 0xffffff802216a000, R13: 0x0000000000000002, R14: 0x000000000000805c, R15: 0x0000000000000034
RFL: 0x0000000000010296, RIP: 0xffffff7f8081a348, CS:  0x0000000000000008, SS:  0x0000000000000010
CR2: 0xffffff802216a000, Error code: 0x0000000000000000, Faulting CPU: 0x4

Backtrace (CPU 4), Frame : Return Address
0xffffff80f05cb810 : 0xffffff8000220792 
0xffffff80f05cb890 : 0xffffff80002c473a 
0xffffff80f05cba40 : 0xffffff80002da0cd 
0xffffff80f05cba60 : 0xffffff7f8081a348 
0xffffff80f05cbbc0 : 0xffffff7f807fd83b 
0xffffff80f05cbc60 : 0xffffff7f807fd8fe 
0xffffff80f05cbcc0 : 0xffffff7f80804bd9 
0xffffff80f05cbd00 : 0xffffff80003192d0 
0xffffff80f05cbd30 : 0xffffff8000308911 
0xffffff80f05cbf50 : 0xffffff80005cd61b 
0xffffff80f05cbfb0 : 0xffffff80002daa13 
      Kernel Extensions in backtrace:
         com.apple.filesystems.smbfs(1.7.2)[82526DF2-3BDB-3898-BA94-F58C5D4E0E01]@0xffffff7f807f2000->0xffffff7f80826fff
            dependency: com.apple.kext.triggers(1.0)[B7CEC019-EA05-3FCB-9E1A-F1CB4A0B2669]@0xffffff7f807ed000

BSD process name corresponding to current thread: rsync

Mac OS version:
11E53

Kernel version:
Darwin Kernel Version 11.4.0: Mon Apr  9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64
Kernel UUID: A8ED611D-FB0F-3729-8392-E7A32C5E7D74
System model name: MacBookPro8,2 (Mac-94245A3940C91C80)

System uptime in nanoseconds: 252434098601163
last loaded kext at 236423088215259: net.tunnelblick.tun    1.0 (addr 0xffffff7f80791000, size 32768)
last unloaded kext at 236897483051934: net.tunnelblick.tun  1.0 (addr 0xffffff7f80791000, size 24576)
loaded kexts:
org.virtualbox.kext.VBoxNetAdp  4.1.10
org.virtualbox.kext.VBoxNetFlt  4.1.10
org.virtualbox.kext.VBoxUSB 4.1.10
org.virtualbox.kext.VBoxDrv 4.1.10
com.apple.filesystems.smbfs 1.7.2
com.apple.driver.AppleHWSensor  1.9.5d0
com.apple.driver.AudioAUUC  1.59
com.apple.driver.AppleMikeyHIDDriver    122
com.apple.driver.AppleUpstreamUserClient    3.5.9
com.apple.driver.AppleMCCSControl   1.0.26
com.apple.driver.AppleHDA   2.2.0f3
com.apple.driver.AppleMikeyDriver   2.2.0f3
com.apple.driver.AppleIntelHD3000Graphics   7.1.8
com.apple.driver.AGPM   100.12.42
com.apple.kext.ATIFramebuffer   7.1.8
com.apple.driver.SMCMotionSensor    3.0.2d6
com.apple.driver.AppleSMCPDRC   5.0.0d0
com.apple.iokit.IOUserEthernet  1.0.0d1
com.apple.iokit.IOBluetoothSerialManager    4.0.5f11
com.apple.Dont_Steal_Mac_OS_X   7.0.0
com.apple.driver.AudioIPCDriver 1.2.2
com.apple.driver.AppleSMCLMU    2.0.1d2
com.apple.driver.AppleMuxControl    3.0.16
com.apple.driver.ACPI_SMC_PlatformPlugin    5.0.0d0
com.apple.ATIRadeonX3000    7.1.8
com.apple.driver.AppleLPC   1.5.8
com.apple.filesystems.autofs    3.0
com.apple.driver.BroadcomUSBBluetoothHCIController  4.0.5f11
com.apple.driver.AppleUSBTCButtons  225.2
com.apple.driver.AppleUSBTCKeyboard 225.2
com.apple.driver.AppleIRController  312
com.apple.AppleFSCompression.AppleFSCompressionTypeDataless 1.0.0d1
com.apple.AppleFSCompression.AppleFSCompressionTypeZlib 1.0.0d1
com.apple.BootCache 33
com.apple.iokit.SCSITaskUserClient  3.2.0
com.apple.driver.XsanFilter 404
com.apple.iokit.IOAHCISerialATAPI   2.0.3
com.apple.iokit.IOAHCIBlockStorage  2.0.3
com.apple.driver.AppleSDXC  1.2.0
com.apple.driver.AppleUSBHub    4.5.0
com.apple.driver.AppleFWOHCI    4.8.9
com.apple.driver.AirPort.Brcm4331   530.4.20
com.apple.iokit.AppleBCM5701Ethernet    3.1.2b2
com.apple.driver.AppleEFINVRAM  1.5.0
com.apple.driver.AppleAHCIPort  2.3.0
com.apple.driver.AppleSmartBatteryManager   161.0.0
com.apple.driver.AppleUSBEHCI   4.5.8
com.apple.driver.AppleACPIButtons   1.5
com.apple.driver.AppleRTC   1.5
com.apple.driver.AppleHPET  1.6
com.apple.driver.AppleSMBIOS    1.8
com.apple.driver.AppleACPIEC    1.5
com.apple.driver.AppleAPIC  1.5
com.apple.driver.AppleIntelCPUPowerManagementClient 193.0.0
com.apple.nke.applicationfirewall   3.2.30
com.apple.security.quarantine   1.3
com.apple.driver.AppleIntelCPUPowerManagement   193.0.0
com.apple.driver.DspFuncLib 2.2.0f3
com.apple.driver.AppleSMBusController   1.0.10d0
com.apple.iokit.IOSurface   80.0.2
com.apple.iokit.IOSerialFamily  10.0.5
com.apple.iokit.IOFireWireIP    2.2.4
com.apple.iokit.IOAudioFamily   1.8.6fc17
com.apple.kext.OSvKernDSPLib    1.3
com.apple.driver.AppleHDAController 2.2.0f3
com.apple.iokit.IOHDAFamily 2.2.0f3
com.apple.driver.ApplePolicyControl 3.0.16
com.apple.driver.AppleGraphicsControl   3.0.16
com.apple.driver.AppleSMC   3.1.3d8
com.apple.driver.IOPlatformPluginLegacy 5.0.0d0
com.apple.driver.AppleSMBusPCI  1.0.10d0
com.apple.driver.IOPlatformPluginFamily 5.1.0d17
com.apple.driver.AppleBacklightExpert   1.0.3
com.apple.iokit.IONDRVSupport   2.3.2
com.apple.kext.triggers 1.0
com.apple.kext.ATI6000Controller    7.1.8
com.apple.kext.ATISupport   7.1.8
com.apple.driver.AppleIntelSNBGraphicsFB    7.1.8
com.apple.iokit.IOGraphicsFamily    2.3.2
com.apple.driver.AppleUSBBluetoothHCIController 4.0.5f11
com.apple.iokit.IOBluetoothFamily   4.0.5f11
com.apple.driver.AppleThunderboltDPInAdapter    1.8.2
com.apple.driver.AppleThunderboltDPAdapterFamily    1.8.2
com.apple.driver.AppleThunderboltPCIDownAdapter 1.2.4
com.apple.driver.AppleUSBMultitouch 227.1
com.apple.iokit.IOUSBHIDDriver  4.4.5
com.apple.driver.AppleUSBMergeNub   4.5.3
com.apple.driver.AppleUSBComposite  4.5.8
com.apple.driver.CoreStorage    182.11.0
com.apple.iokit.IOSCSIMultimediaCommandsDevice  3.2.0
com.apple.iokit.IOBDStorageFamily   1.6
com.apple.iokit.IODVDStorageFamily  1.7
com.apple.iokit.IOCDStorageFamily   1.7
com.apple.iokit.IOSCSIArchitectureModelFamily   3.2.0
com.apple.driver.AppleThunderboltNHI    1.5.5
com.apple.iokit.IOThunderboltFamily 2.0.0
com.apple.iokit.IOUSBUserClient 4.5.8
com.apple.iokit.IOFireWireFamily    4.4.5
com.apple.iokit.IO80211Family   420.3
com.apple.iokit.IOEthernetAVBController 1.0.1b1
com.apple.iokit.IONetworkingFamily  2.1
com.apple.iokit.IOAHCIFamily    2.0.8
com.apple.iokit.IOUSBFamily 4.5.8
com.apple.driver.AppleEFIRuntime    1.5.0
com.apple.iokit.IOHIDFamily 1.7.1
com.apple.iokit.IOSMBusFamily   1.1
com.apple.security.sandbox  177.5
com.apple.kext.AppleMatch   1.0.0d1
com.apple.security.TMSafetyNet  7
com.apple.driver.DiskImages 331.6
com.apple.iokit.IOStorageFamily 1.7.1
com.apple.driver.AppleKeyStore  28.18
com.apple.driver.AppleACPIPlatform  1.5
com.apple.iokit.IOPCIFamily 2.6.8
com.apple.iokit.IOACPIFamily    1.4

EDIT : ecco lo script della shell che sto eseguendo:

#!/bin/bash

target_directory="/Volumes/Backups/MacBook Pro"

directories_to_back_up=(
    "$HOME/Desktop"
    "$HOME/Documents"
    "$HOME/Downloads"
    "$HOME/Pictures/Photo Booth Library"
    "$HOME/.filezilla"
    "$HOME/Library/Application Support/Firefox"
    "$HOME/Library/Application Support/TextMate"
    "$HOME/Library/Mail"
    "$HOME/Library/Preferences"
    "/Applications/MAMP/conf"
    "/Applications/MAMP/htdocs"
);

if [ -d "$target_directory" ]; then
    for directory in "${directories_to_back_up[@]}"
    do
        if [ -d "$directory" ]; then
            echo "The following backup will begin in 10 seconds:"
            echo
            echo "Source: \"$directory\""
            echo "Target: \"$target_directory\""
            sleep 10
            echo

            rsync -a --delete-after --progress --stats "$directory" "$target_directory"
        else
            echo "The following directory was not found:"
            echo
            echo "\"$directory\""
            echo
            echo "Therefore, it was not backed up."
        fi

        echo
        echo "----------------------------------------"
        echo
    done
else
    echo "The backup could not proceed because the following directory was not found:"
    echo
    echo "\"$target_directory\""
fi
    
posta Nick 28.06.2012 - 05:05
fonte

1 risposta

1

Ho notato che hai caricato kBox VirtualBox. Presumo che tu abbia una macchina virtuale in esecuzione durante il backup. Negli ultimi mesi ho avuto panico del kernel (per nulla coerente come il tuo), da diverse app, ma alla fine ho capito che si verificano solo se ho VM in esecuzione e un carico elevato della CPU (come creerebbe rsync).

Non ho idea del perché ancora, ma probabilmente potresti testarlo sul tuo sistema.

Il tuo comando rsync sembra OK. In secondo luogo, il commento dice che dovresti usare launchd piuttosto che cron . Più pulito, più affidabile e una volta creato il plist nel posto giusto, non dovrai preoccuparti di eseguire accidentalmente come root.

C'è una bella app chiamata Lingon che fornisce una GUI per launchd . Molto bello con cui lavorare, anche se sei disposto a modificare manualmente i file plist.

Inoltre, assicurati che la shell specificata nella parte superiore dello script sia uguale alla shell che stai utilizzando in Terminal. Dubbi che è così, ma non si sa mai.

    
risposta data 30.06.2012 - 05:49
fonte

Leggi altre domande sui tag