Jump to content











Photo

Xperia L Bootloop after mounting SD card using Link2SD


  • Please log in to reply
3 replies to this topic

#1 Holmes.Sherlock

Holmes.Sherlock

    Gold Member

  • Team Reboot
  • 1444 posts
  • Location:Santa Barbara, California
  •  
    United States

Posted 24 July 2014 - 05:43 AM

I faced trouble in mounting 2nd partition (ext4) of the SD card using Link2SD in Rooted Xperia L. Like many people have faced. I experienced a Boot-Loop. After taking out the partitioned SD card, fortunately the phone boots fine. Even it boots without any problem with non-partitioned SD card, too.

There is unofficial solution of enabling support for init.d using apps like Init.d Toggler.
But, I find that there already an /etc/init.d directory exists. Inside, there are two scripts, viz. 00stop_ric and 11link2sd.
 

00stop_ric
---------------
#!/system/bin/sh
/system/xbin/busybox pkill /sbin/ric
mount -o remount,rw /
rm /sbin/ric
mount -o remount,ro /
/system/xbin/busybox pkill /sbin/ric


11link2sd
--------------
#!/system/bin/sh
#added by link2sd
LOG=/data/link2sd-11link2sd.log
echo "$(date) mounting..." > $LOG
sleep 2
mount -t ext4-o rw /dev/block/
vold/179:34/data/sdext2 1>>$LOG
2>>$LOG

mount -t ext4-o rw /dev/block/
mmcblk1 p2 /data/sdext2 1>>$LOG
2>>$LOG

mount >> $LOG
echo "$(date) mount finished" >> $LOG


I failed to find any reference to this problem in the FAQ section of official website.

 

I solved the problem using Init.d Toggler.

But, I find it surprising why it boot-loop-ed initially, i.e. when init.d was disabled. It could fail to mount the partition, that is acceptable. But, how come just the presence of /etc/init.d/11link2sd script make it boot-loop?

Even before trying Link2SD, I had both /etc/init.d and /etc/init.d/00stop_ric script present. There are the leftover from the Getroot method I applied to root my Xperia. So, neither the phone not having init.d support nor the creation of init.d folder can be the cause of boot-loop.

Definitely, either the presence of /etc/init.d/11link2sd script or something else which we are missing (Developer of Link2SD, Akpinar should be able to correctly answer) is/are the cause of boot-loop.

What Link2SD exactly does while creating Mount script?



#2 Holmes.Sherlock

Holmes.Sherlock

    Gold Member

  • Team Reboot
  • 1444 posts
  • Location:Santa Barbara, California
  •  
    United States

Posted 27 July 2014 - 07:06 PM

  • What is Link2SD?

    Link2SD is an app for Android 2.0+ users on their phone to move applications to the SD card by dual-partitioning the card. First partition gets mounted as external SD and remains available for general use, while the second partition (preferably formatted with an *NIX type file-system, e.g. ext2, ext3, ext4 etc.) holds executable(.apk), data, dalvik-cache(.dex) and library files(.so) for linked/moved application.

    Link2SD mounts the second partition of your SD card as /data/sdext2 and makes OS mounts it at boot time. When you select an application and press "Create Link" button you can select which files of the application will be linked and moved to SD card. Apk, dex and lib files can be moved and you can select all three or any two of three or even only one of them. Depending on what you select, Link2SD moves apk file, dalvik-cache (.dex) file and lib files (.so) to SD card's second partition and creates symbolic links in original directories. Phone must be Rooted, of course.
  • How does mounting of second SD partition work?

    After the partitioned SD card is put in the phone, Link2SD asks you to select the file-system of the second partition on SD, just chose the one you used. Once /system/etc/init.d/11link2sd script is created, you have to restart the phone.
  • What is init.d support and why is it needed?

    init.d directory is the container of start-up scripts in a *NIX type system. These scripts are execute during system boot.

    Link2SD relies on the execution of /system/etc/init.d/11link2sd script which, in turn, mounts the second partition of SD card as /data/sdext2.
  • What is the Boot-Loop problem?

    The SD card storage is dual-partitioned and put in the phone. Then, Link2SD generates mount script for the second partition of SD card and phone needs to be re-started. Some phones, e.g. Sony Xperia-L runs into infinite boot-sequence a.k.a. boot-loop. In this state, phone boot sequence starts, manufacturer logo is displayed proceeds for a few seconds and restarts. Only solution is to long press the power button or taking out the battery to switch the phone off.

    Interestingly, if the dual-partitioned SD card is taken out and the phone is booted without SD card inserted, it boots normally.
  • What did I do with my Xperia-L so that it started boot-looping?
    • Rooted Xperia using Rootkit method. It leaved /system/etc/install_recovery.sh and /system/etc/init.d/00stop_ric scripts on the phone's file-system. (Script code listed below). I am using the rooted phone for months without any trouble.
    • Using an un-partitioned 32GB microSD card, formatted with FAT32, in the phone.
    • Deciding to give a try to Link2SD, I dual-partitioned the SD using Minitool Partition Manager. First partition was formatted with FAT32 while the second one was formatted with ext4. Sizes of partitions were around ~25GB and ~4.5GB respectively.
    • Installed Link2SD on phone.
    • Switched the phone OFF.
    • Put the dual-partitioned SD back in the phone slot.
    • Switched the phone ON.
    • Opened Link2SD app.
    • Link2SD immediately recognized the second partiton, asking me for its file-system type.
    • Selected ext4 from the list.
    • Link2SD generated the mount script and prompted for restart.
    • Restarted the phone.
    • Boot-Loop!!!
    • Switched the phone OFF by taking out battery.
    • Took the dual-partitioned memory card out.
    • Switched the phone ON.
    • Phone starts normally!!!
  • How did I solve the problem?
    • I installed Init.d Toggler app as described here.
    • As described here, I experienced the problem of first partition not being mounted. The error was related to SD Card being empty or the file-system damaged.
    • I re-formatted the first partition of SD with NTFS.
    • Installed Paragon exFAT, NTFS & HFS+ app.
    • Now, the first partition got mounted.
  • What does Init.d Toggler do?
    • Appends the following command at the end of /system/etc/install_recovery.sh: /system/bin/sysinit
    • Creates /system/bin/sysinit script.
    • Creates /system/etc/init.d directory to put the start-up scripts in.
  • Does REALLY lack of init.d support cause boot-loop problem?

    As the Init.d Toggler solution says,

    One of the requeriments to use the Link2SD is the support to init.d scripts. Most of the custom roms support this, but not the stock one, giving a boot loop.

I doubt that to be the "real" problem underlying the hood. Why?
  • How come lack of init.d support cause the mount script /system/etc/init.d/11link2sd malfunction? At most, what could have happened is, it would NOT mount the second partition, that's it. Right? But, isn't it surprising to crash or the like during boot?
  • As stated, even prior to installing Link2SD, there always existed /system/etc/init.d/00stop_ric, which contains almost similar set of commands as that of mount script /system/etc/init.d/11link2sd created by Link2SD. It used to work like a charm. I guess, because of init.d support not being there in stock ROM, the script had never been executed before I used Init.d Toggler.
  • Had the lack of init.d support been the reason of boot-loop, how did the phone manage itself to boot normally with the dual partitioned SD card taken out? Please note that, the mount script was still residing in init.d directory.
  • To be noted that, Xperia L (Stock ROM) boots fine with a dual-partitioned SD card put in, though it never mounts the second partition.
At this point, can anyone help me investigate the root-cause behind the boot-loop problem? Can anyone come up with any idea or satisfactory answer to the query? Does anyone have any idea on how to approach the issue at hand?
  • Please find the relevant scripts below.
00stop_ric

#!/system/bin/sh
/system/xbin/busybox pkill /sbin/ric
mount -o remount,rw /
rm /sbin/ric
mount -o remount,ro /
/system/xbin/busybox pkill /sbin/ric
11link2sd

#!/system/bin/sh
#added by link2sd
LOG=/data/link2sd-11link2sd.log
echo "$(date) mounting..." > $LOG
sleep 2
mount -t ext4 -o rw /dev/block/vold/179:34 /data/sdext2 1>>$LOG 2>>$LOG

mount -t ext4 -o rw /dev/block/mmcblk1p2 /data/sdext2 1>>$LOG 2>>$LOG

mount >> $LOG
echo "$(date) mount finished" >> $LOG
install-recovery

#!/system/bin/sh

# If you're implementing this in a custom kernel/firmware,
# I suggest you use a different script name, and add a service
# to launch it from init.rc

# Launches SuperSU in daemon mode only on Android 4.3+.
# Nothing will happen on 4.2.x or older, unless SELinux+Enforcing.
# If you want to force loading the daemon, use "--daemon" instead

/system/xbin/daemonsu --auto-daemon &

# Some apps like to run stuff from this script as well, that will 
# obviously break root - in your code, just search this file
# for "install-recovery-2.sh", and if present, write there instead.

/system/bin/sysinit
sysinit

#!/system/bin/sh

export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
/system/bin/logwrapper /system/xbin/run-parts /system/etc/init.d 
link2sd-11link2sd

Wed Jul 23 16:23:57 IST 2014 mounting...
mount: Device or resource busy
mount: Device or resource busy
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/secure tmpfs rw,relatime,mode=700 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,relatime,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 rw,nosuid,nodev,relatime,noauto_da_alloc,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 rw,nosuid,nodev,relatime,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 rw,nosuid,nodev,relatime,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/ftmd /ftmd ext4 rw,nosuid,nodev,relatime,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/LTALabel /lta-label ext4 rw,nosuid,nodev,relatime,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/ftma /ftma ext4 ro,relatime,nobarrier,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/modem /firmware vfat ro,relatime,uid=1000,gid=1000,fmask=0337,dmask=0227,codepage=cp437,iocharset=iso8859-1,shortname=lower,errors=remount-ro 0 0
/dev/block/mmcblk1p1 /storage/sdcard1 fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0
/dev/block/vold/179:34 /data/sdext2 ext4 rw,relatime,data=ordered 0 0
/dev/block/vold/259:0 /storage/sdcard0 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/259:0 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /storage/sdcard0/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
/dev/block/dm-0 /mnt/asec/uk.co.aifactory.chessfree-2 ext4 ro,dirsync,nosuid,nodev,noatime 0 0
/dev/block/dm-1 /mnt/asec/com.wave18.adbwireless-1 ext4 ro,dirsync,nosuid,nodev,noatime 0 0
/dev/block/dm-2 /mnt/asec/com.rerware.android.MyBackupRoot-1 ext4 ro,dirsync,nosuid,nodev,noatime 0 0
/dev/block/dm-3 /mnt/asec/com.rootuninstaller.free-2 ext4 ro,dirsync,nosuid,nodev,noatime 0 0
Wed Jul 23 16:23:59 IST 2014 mount finished


#3 computermacgyver

computermacgyver
  • Members
  • 1 posts
  •  
    United States

Posted 09 January 2016 - 07:44 AM

The problem in my experience has to do with the order of execution of the 00stop_ric script and the 11link2sd script.

If the SD card is mounted before RIC is stopped, the phone will reboot. I solved the problem by combining the two scripts into one script that first killed RIC and then mounted the partition. With this change, I was able to have the second partition on my SD card be ext4.

 

Background:

I believe the RIC service is left-over as a result of the root method used (I was lazy and used a root kit that did not require unlocking the bootloader). RIC is some Sony protection service and if running any attempt to remount the /system partition will cause the tablet/phone to reboot. FolderMount has similar behavior but thankfully addresses the question in the FAQ, which then lead me to a fuller discussion on XDA.



#4 Holmes.Sherlock

Holmes.Sherlock

    Gold Member

  • Team Reboot
  • 1444 posts
  • Location:Santa Barbara, California
  •  
    United States

Posted 09 January 2016 - 11:01 AM

The problem in my experience has to do with the order of execution of the 00stop_ric script and the 11link2sd script.

If the SD card is mounted before RIC is stopped, the phone will reboot. I solved the problem by combining the two scripts into one script that first killed RIC and then mounted the partition. With this change, I was able to have the second partition on my SD card be ext4.

 

I wonder why the prefix (00 and 11) do not retain the order of execution.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users