SpazeDog / mounts2sd

Android SD-Ext Script+App
GNU General Public License v3.0
78 stars 27 forks source link

Phone does not boots after init.d was created #3

Open skyh opened 11 years ago

skyh commented 11 years ago

After enabling mounts2sd init.d, phone does not boots normally. Only recovery.

Config: Motorola Droid (Milestone) A853 OpenRecovery 2ndboot CyanogenMod 7 Steps to reproduce: mounts2sd enable busybox -> reboot mounts2sd enable init.d -> reboot = fail

No others ext-sd software was installed.

dbergloev commented 11 years ago

The script has been tested on CM7, 9, 10.1, and 10.2 with success, so I will need a little more details. A logcat from the boot would be nice.

skyh commented 11 years ago

I can't run logcat because phone can't boot. Logcat in recovery contains only BATTD and usbd info messages. I have original 05mountsd script from init.d. Here it is:

#!/system/bin/sh
#
# mount ext partition from sd card

# skip mount if power-up reason is charge only
if grep -Fq "POWERUPREASON : 0x00000100" /proc/bootinfo
then
    setprop cm.mountsd.done 1;
    exit 0;
fi

BB="logwrapper busybox";

if [ "$SD_EXT_DIRECTORY" = "" ];
then
    SD_EXT_DIRECTORY=/sd-ext;
fi

# find SD Card
for MMC_NUM in `seq 0 9`;
do
    MMC_TYPE=`cat /sys/block/mmcblk$MMC_NUM/device/type`
    if [ "$MMC_TYPE" = "SD" ];
    then
        # 2nd partition of sdcard should be the sd-ext if exist
        SD_EXT_PART=/dev/block/mmcblk${MMC_NUM}p2
        break
    fi
done

if [ -b "$SD_EXT_PART" ];
then
    log -p i -t mountsd "Checking filesystems..";

    # fsck the sdcard filesystem first
    if [ -x `which e2fsck` ];
    then
        e2fsck -y $SD_EXT_PART
        e2fsk_exitcode=$?
    else
        echo "executable e2fsck not found, assuming no filesystem errors"
        e2fsk_exitcode=0
    fi

    # set property with exit code in case an error occurs
    setprop cm.e2fsck.errors $e2fsk_exitcode;
    if [ "$e2fsk_exitcode" -lt 2 ];
    then
        # mount and set perms
        $BB mount -o noatime,nodiratime,barrier=1 -t auto $SD_EXT_PART $SD_EXT_DIRECTORY;
        if [ "$?" = 0 ];
        then
            $BB chown 1000:1000 $SD_EXT_DIRECTORY;
            $BB chmod 771 $SD_EXT_DIRECTORY;
            log -p i -t mountsd "$SD_EXT_DIRECTORY successfully mounted";
        else
            log -p e -t mountsd "Unable to mount filesystem for $SD_EXT_DIRECTORY!";
        fi
    else
        log -p e -t mountsd "Unable to repair filesystem, disabling apps2sd";
    fi
fi
setprop cm.mountsd.done 1;
dbergloev commented 11 years ago

This is not my script. So either you are not using Mounts2SD, or you have multiple sd-ext scripts installed. Install the Mounts2SD application (I would go with the Beta release, much better) and install the script from within the application settings. This will also auto remove any existing sd-ext script.

skyh commented 11 years ago

I use app. This was an example of default CM script. I will try to split your script and run slices separately.

dbergloev commented 11 years ago

You could do something else instead. Just add an init.d script that is executed before M2SD which prints logcat to a file.

#!/system/bin/sh

(
    logcat > /data/log.txt
) & 

killall logwrapper

exit 0

Now just let it run for a minute or so, then reboot into recovery and grab /data/log.txt

skyh commented 11 years ago

OK, I will do it. There is another strange thing. I replaced 10mounts2sd with default script and phone still is dead %)

skyh commented 11 years ago

I replaced 10mounts2sd with default script and phone still is dead %)

Oh, I forgot about chmod+chown. Default script works fine

skyh commented 11 years ago

log.txt http://pastebin.com/bsANKN6D

dbergloev commented 11 years ago

Great, but could you enable debug and try again. It will provide more log information

echo 1 > /data/property/m2sd.enable_debug
skyh commented 11 years ago

log.txt m2sd.enable_debug=1 https://gist.github.com/skyh/ddbaf1a190e8b06e1d53 (pastebin limits pastes over 500 kB)

dbergloev commented 11 years ago

Is this an official CM7 ROM? Could you provide a listing of /data and /sd-ext so that I can see which files and folders are in these locations?

skyh commented 11 years ago

Go to IM? My skype is andrey.skyh.ivlev

skyh commented 11 years ago

or any other realtime messaging

skyh commented 11 years ago

/sd-ext (mounted as /sddata from recovery) https://gist.github.com/skyh/3b2b28cd05d45925e328 /data https://gist.github.com/skyh/037a290c030563c4ece4

skyh commented 11 years ago

Logs after re-partitioning SD-card and clean CM7 + Mounts2SD (from Google Play) installation. https://gist.github.com/skyh/44d83f66dcf9d8962f93

dbergloev commented 11 years ago

That is strange, but could you try with the beta version instead? It's a new and different script. It's not that important if the old one works or not, as it is soon to be replaced.

skyh commented 11 years ago

Beta log, https://gist.github.com/skyh/5541d28c0235f4e2635b

dbergloev commented 11 years ago

So one script hangs while the other create boot loop issues. I think this has to do with the init.d work-around for service implemented init.d methods. Both scripts uses different work-arounds.

Try enabling safe-mode

echo 0 > /data/property/m2sd.disable_safemode

This will disable the work-arounds

Or you could implement a proper init.d method with Init.d Injector

skyh commented 11 years ago

Safe mode does not helps. And I don't understand how to use init.d injector. I think it would be good to add a warning to Milestone users :)

dbergloev commented 11 years ago

Could you provide a link to your ROM's XDA Thread? I would like to take a closer look on how this ROM is structured, because it should work.

EDIT:

Maybe you should try this version instead. I forgot that I have already had this issue once with a beta test user who helped me correct a lot of issues. However, these updates has not yet been uploaded to the XDA Thread, which I forgot. So the beta version on XDA is not the newest version. Sorry :)

skyh commented 11 years ago

XDA thread [ROM] CyanogenMod 7.2.4f (Android 2.3.7) http://forum.xda-developers.com/showthread.php?t=941346 I don't use APK from XDA, I use eclipse-builded StatusActivity.apk from github sources. I will try this 3.0.2_beta4 :)

skyh commented 11 years ago

Logcat from beta4, https://gist.github.com/skyh/0a2369ff2c47db657cd3. During boot process phone become very hot and used almost 100% of battery.

dbergloev commented 11 years ago

Okay thanks. I will have a look at your ROM some time to day, and see if the answer is somewhere to be found. There must be some specific structure in that ROM that M2SD is not built to handle correctly.

dbergloev commented 11 years ago

I have looked at your ROM, and the ROM in it self does not look any different than any other regular CM release. However, I can not find anything in your kernel which executes the init.d directory? Do you manually add this support in some way?

I think you should give init.d injector a go. You can download it from here. It quite simple to use.

  1. Reboot into recovery
  2. Choose to flash a zip from your sdcard
  3. Select the init.d injector zip package
  4. This will open an Aroma installer. From here, just select the first option to inject current boot.img
  5. Done. Just reboot your device and see if this will sort out your issue.

(And of cause, backup first)

skyh commented 11 years ago

No, I didn't. Just installed as described in CM manual.

Пользователь Daniel Bergløv notifications@github.com писал:

I have looked at your ROM, and the ROM in it self does not look any different than any other regular CM release. However, I can not find anything in your kernel which executes the init.d directory? Do you manually add this support in some way?


Reply to this email directly or view it on GitHub: https://github.com/SpazeDog/mounts2sd/issues/3#issuecomment-22922618

dbergloev commented 11 years ago

Just strange that init.d is nowhere to be found, and still it get's executed. But still, init.d injector might be the answer.

skyh commented 11 years ago

There is error at step 4 after choosing "Inject boot partition" and pressing "Start Injector"

Starting injector v.0.2.1.4
/tmp/aroma-data/injector/injector.sh: line 38: /tmp/busybox: No such file or directory
Using /tmp/aroma-data/busybox as the toolbox for this script
[[: missing ]]
Using configuration file global.conf
[[: missing ]]
[[: missing ]]
[[: missing ]]
[: missing ]
[[: missing ]]
[[: missing ]]
/tmp/aroma-data/injector/injector.sh: line 188: inject-flash-current: command not found
/tmp/aroma-data/injector/injector.sh: line 188: inject-flash-current: command not found
Extracting the device boot.img
/tmp/aroma-data/injector/injector.sh: line 201: /tmp/aroma/injector/tools/bin/dump_image: No such file or directory
It was not possible to extract the boot.img from the device!
Cleaning up old files and directories
dbergloev commented 11 years ago

Strange, Init.d Injector has worked on all sorts of devices. It has been a long time since anyone have had any issues with it. For you, it looks like it does not create any variables or is able to locate any binary in the package, except busybox.

I will have a look and see if I can spot something that would produce this.

dbergloev commented 11 years ago

Still working in injector (decided to just rebuild it). However, there might be a chance that the latest release of M2SD will work for you. I have done a lot of compatibility fixes to ensure better compatibility with different devices and ROM's. It might have fixed your issue as well.