View Single Post
Old 02-24-2012, 02:12 PM   #49
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
WARNING: Although the script shown below worked fine for me and other people, a couple of people reported that their kindles only boot to fastmode now after they repaired their kindles enough to boot to diags using the "display onlly" script provided with data.tar.gz (in first post), and then they used the script below to gather diagnostics information. Of course, the version they used was making a backup copy of mmcblk0p1 (now commented out) and they did not wait for this to complete before rebooting. It SHOULD be safe, but mysterious things happen when your kindle is messed up (especially if you do a hard reset while it is writing to a file). So please use this only at your own risk. Thanks.

Here is the RUNME.sh that I used to dump out a lot of useful information to gmdiags.log on the USB Drive. It might help you diagnose the problem with your main partition:
Code:
#!/bin/sh
(
cd /mnt/us
touch gmdiags.log

eips 5 2 "***    This is /mnt/us/RUNME.sh.   ***"
eips 5 4 "*** Put your custom commands here. ***"

echo "*** `date` ***"
echo "*** export ***"; export
echo "*** idme ***"; idme ?
echo "*** df ***"; df -h
echo "*** mount ***"; mount
echo "*** /etc ***"; ls -al /etc
echo "*** /etc/upstart ***"; ls -al /etc/upstart
echo "*** /usr/local ***"; ls -al /usr/local
echo "*** /usr/local/bin ***"; ls -al /usr/local/bin
echo "*** /usr/local/sbin ***"; ls -al /usr/local/sbin
echo "*** /var/local ***"; ls -al /var/local
echo "*** /var/local/wan ***"; ls -al /var/local/wan
echo "*** /var/local/system ***"; ls -al /var/local/system
echo "*** /mnt/us ***"; ls -al /mnt/us

mntroot rw

echo "*** /var/local/system/mntus.params ***"
cat /var/local/system/mntus.params

#echo "*** mmcblk0p1 files ***"
#mkdir -p /mnt/main
#mount /dev/mmcblk0p1 /mnt/main
#cd /mnt/main
#find 

#echo "*** mmcblk0p2 files ***"
#mkdir -p /mnt/diags
#mount /dev/mmcblk0p2 /mnt/diags
#cd /mnt/diags
#find

#echo "*** rem find ssh ***"
#cd /mnt/main
#find | grep dropbear
#cd /mnt/diags
#find | grep dropbear

umount -d /mnt/diags
umount -d /mnt/main

mntroot ro

echo "*** copy mmcblk0p1 ***"
## only backup the partition that you did NOT boot from
mkdir -p /mnt/us/backups/
cd /mnt/us/backups
#[ -e mmcblk0p1.img ] || dd if=/dev/mmcblk0p1 of=mmcblk0p1.img bs=1024
#[ -e mmcblk0p2.img ] || dd if=/dev/mmcblk0p2 of=mmcblk0p2.img bs=1024
[ -e var_local.tgz ] || tar zcvf var_local.tgz /var/local

ls -al /var/local/system

eips 5 14 "***    Exiting /mnt/us/RUNME.sh    ***"
echo "*** DONE. ***"
echo "*** `date` ***"
echo "**************************"

) 2>&1 >>/mnt/us/gmdiags.log
Notice that you can pipe the output of everything at one by wrapping it in parens, instead of piping every linux command.


The part that dumps out partitions to an image file assumes you booted from diags. To dump diags, you should boot from main. Otherwise the partition image can be corrupted when the running system changes files on it while you are copying the image. But even a little corruption can be fixed with fsck, so dumping both is better than not having them. Just be aware that a clean image should be dumped from a partition not currently being used. And besides, the images are ALWAYS dirty anyway, because the kindle creates them as ext3, then deletes the "lost & found" folder, and never does an fsck, even though it modifies things periodically with "mntroot rw". That could be why doing a "fastboot check system" fails with bad CRC32 (normal for a kindle after any changes to the root filesystem).

EDIT: I commented out the line in the script above that makes a backup copy of mmcblk0p1. This takes a long time. This might be a problem if the kindle battery is low. It would be better if the kindle was plugged into a power adapter while running this script. You need a way to get this new script onto your kindle, but it runs when booting to diags or main, so you just need to let it finish. It worked fine for me, but I did not reboot while it was in progress (like two others said they did). If you WANT a backup image, then uncomment it and WAIT for it to complete, while plugged into a USB power adapter.

Last edited by geekmaster; 02-24-2012 at 05:17 PM.
geekmaster is offline   Reply With Quote