BB 0.6.2.1 and link2sd 1.5.5 on OG Droid

Discussion in 'Bugless' started by buellboy9, Apr 20, 2011.

  1. buellboy9
    Offline

    buellboy9 Member

    Joined:
    Mar 31, 2010
    Messages:
    428
    Likes Received:
    5
    Trophy Points:
    18
    Ratings:
    +6
    I used ROM Manager to partition my SD Card, and link2sd to move my apps from the phone's memory to the new /ext2 partition and that seems to be working great.

    However, after a reboot... EVERYTHING IS GONE. I seriously doubt that is the way it's SUPPOSED to happen. Has anyone else used this combination of software/hardware? I'd like to get this working properly because it leaves the phone memory 50% unused and I haven't had an FC occur since. I can even mount the phone in the car dock, listen to music while the navigator gets me where I'm going without stopping the music permanently (which was happening ALL the time previously).

    And yes, I did NOT move the link2sd program itself to the /ext2 partition. I also left all "Live Walpapers" and "Widget" apps on the phone as well. I may've been born at night, but I wasn't born LAST night.

    Thanks,:motdroidhoriz:
  2. sbenson
    Offline

    sbenson Silver Member

    Joined:
    Jan 19, 2011
    Messages:
    2,370
    Likes Received:
    61
    Trophy Points:
    113
    Location:
    Virginia/DC Metro Area
    Ratings:
    +61
    I am wondering this as well.

    I was on CM nightlies for a while and got fed up with bugs, so I switched back to bugless. On CM, I had link2sd working perfectly with prime's custom mounting script. But now I have the same issue with my apps disappearing after a reboot. However, if I go into the link2sd app and choose to "Quick Reboot", all of my apps come back and work just fine. What's causing this?
  3. buellboy9
    Offline

    buellboy9 Member

    Joined:
    Mar 31, 2010
    Messages:
    428
    Likes Received:
    5
    Trophy Points:
    18
    Ratings:
    +6
    link2sd was just updated to 1.6. I haven't rebooted the phone yet (waiting for the battery to charge back up to 100% first).
  4. buellboy9
    Offline

    buellboy9 Member

    Joined:
    Mar 31, 2010
    Messages:
    428
    Likes Received:
    5
    Trophy Points:
    18
    Ratings:
    +6
    Crap. No difference. Does anyone know how to get in touch with the link2sd developer?
  5. sbenson
    Offline

    sbenson Silver Member

    Joined:
    Jan 19, 2011
    Messages:
    2,370
    Likes Received:
    61
    Trophy Points:
    113
    Location:
    Virginia/DC Metro Area
    Ratings:
    +61
    Did you try a "Quick Reboot" from the link2sd menu?
  6. buellboy9
    Offline

    buellboy9 Member

    Joined:
    Mar 31, 2010
    Messages:
    428
    Likes Received:
    5
    Trophy Points:
    18
    Ratings:
    +6
    Yes, that restored all of the links, but I was hoping the latest update would've eliminated the need for that extra step.
  7. sbenson
    Offline

    sbenson Silver Member

    Joined:
    Jan 19, 2011
    Messages:
    2,370
    Likes Received:
    61
    Trophy Points:
    113
    Location:
    Virginia/DC Metro Area
    Ratings:
    +61
    Also, did you flash prime's link2sd script? That could be your problem. Here: http://bit.ly/gpGpKX

    Do you have Root Explorer? If so, copy the 11link2sd file from /ect/init.d and place it on your sd card. Boot into recovery, flash primes script and then reboot. Then copy the 11link2sd file back into /ect/init.d. Reboot and everything should work fine. If not, do a "Quick Reboot" from within link2sd app. If the links are still broken, you may have to reinstall everything, then re-link. After re-linking it should stick with the help of primes script. This is how I did it and it's been working great ever since.

    Edit: Sorry, I forgot you were on bugless. Maybe Pete can tell you how to make this work.
  8. buellboy9
    Offline

    buellboy9 Member

    Joined:
    Mar 31, 2010
    Messages:
    428
    Likes Received:
    5
    Trophy Points:
    18
    Ratings:
    +6
    You got that working? According to your first post (above), it wasn't working when you switched back to BB from CM?
  9. buellboy9
    Offline

    buellboy9 Member

    Joined:
    Mar 31, 2010
    Messages:
    428
    Likes Received:
    5
    Trophy Points:
    18
    Ratings:
    +6
    Thanks anyway.

    Well... yeah... this IS the Bugless forum, right? Thanks though. If not Pete, then I'm hoping someone could point me to the link2sd author.
  10. sbenson
    Offline

    sbenson Silver Member

    Joined:
    Jan 19, 2011
    Messages:
    2,370
    Likes Received:
    61
    Trophy Points:
    113
    Location:
    Virginia/DC Metro Area
    Ratings:
    +61
    Yeah, I had a dur moment

    uploadfromtaptalk1303569045870.jpg

    Sent from my Droid using DroidForums
  11. neoaeon
    Offline

    neoaeon New Member

    Joined:
    Mar 27, 2011
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    I've found this issue across all ROMs.

    What I've discovered is the init script that does the SD mounting is in a race condition against system_server.

    If system_server beats them to the /data directories then it has already grabbed ahold of that FD and won't let go. Since the link points no where, or in the case of bind mounts, the empty directory underneath the mount, there are no apps to enumerate.

    I wrote my own App2Ext4 init script for CM ROMs that sort of remedies the situation by checking for system_server in the empty un-bound directories and kills it if it finds it. It basically causes a single "boot loop" (you see the boot animation twice), but you'll stop losing the apps on the Launcher, and most importantly widgets won't have to be set back up.

    The remaining bug is if you lose the race and system_process wins, and you have to kill it to keep the Launcher and Apps sane; you'll lose some login information, and I can't figure out where it's stored.

    Twitter logs out
    Facebook stops syncing
    More than a few mobile banking apps "forget" things


    Not sure what version this is, I play with it alot, but this gives the basic gist.

    Code:
    #!/system/bin/sh
    # App2Ext4
    
    A2E4ERROR=0
    A2E4LOGFILE="/data/local/tmp/a2e4.log"
    A2E4SYSLOG="true"
    
    # Cut log to last 50 lines
    [ "${A2E4LOGFILE}" != "" ] && [ -f ${A2E4LOGFILE} ] && sed -e ':a' -e '$q;N;51,$D;ba' -i ${A2E4LOGFILE}
    
    # Dump logs to file, syslog, and console
    logdump() {
      [ "${A2E4LOGFILE}" != "" ] && echo "App2Ext4: ${1}" >> ${A2E4LOGFILE}
      [ "${A2E4SYSLOG:=false}" == "true" ] && log -p i -t App2Ext4 -- "${1}"
      echo "App2Ext4: ${1}"
    }
    
    # Mount the sd-ext, should only be called if missing.
    mountsdext() {
      # load ext4
      if [ -f /system/lib/modules/ext4.ko ]; then
        modprobe ext4
      else
        logdump "FAILURE: can not find ext4 kernel module"
        A2E4ERROR=$((A2E4ERROR+1))
        exit $A2E4ERROR
      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
        logdump "INFO: Checking filesystems"
    	# fsck the sdcard filesystem first
        if [ -x `which e2fsck` ]; then
          e2fsck -y $SD_EXT_PART
          e2fsk_exitcode=$?
        else
          logdump "INFO: 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, don't -t ext3 so ext4 will do the work for 2,3&4
          mount -o noatime,nodiratime,barrier=1 $SD_EXT_PART $SD_EXT_DIRECTORY
          if [ "$?" = 0 ]; then
            chown 1000:1000 $SD_EXT_DIRECTORY
            chmod 771 $SD_EXT_DIRECTORY
            logdump "SUCCESS: $SD_EXT_DIRECTORY successfully mounted"
          else
            logdump "FAILURE: Unable to mount filesystem for $SD_EXT_DIRECTORY!"
            A2E4ERROR=$((A2E4ERROR+1))
            exit $A2E4ERROR
          fi
        else
            logdump "FAILURE: Unable to repair filesystem, disabling apps2sd"
            A2E4ERROR=$((A2E4ERROR+1))
            exit $A2E4ERROR
        fi
      fi
    
    }
    
    # Check mount proc
    # + Checks to see if system_server beat us to this mount point, kills it if so
    chkpsmount() {
      if [ "${1}" != "" ]; then
        TGT=$1
      else
        TGT=/data/app
      fi
      for i in $(fuser -m ${TGT}); do
        PNAME=$(ps -p ${i} |tail -n +2|awk '{print $13}')
        if [ "${PNAME}" == "system_server" ]; then
          logdump "WARNING: ${PNAME}:${i} beat us to the mount, killing ${i}"
          kill ${i}
        fi
      done
    }
    
    logdump "+ $(date)"
    
    # Start FS registration
    if [ ${A2E4ERROR:=0} -eq 0 ]; then
      sync
      setprop cm.filesystem.ready 0
    fi
    
    if [ "$SD_EXT_DIRECTORY" = "" ]; then
      SD_EXT_DIRECTORY=/sd-ext
    fi
    
    if [ "$(egrep -q $SD_EXT_DIRECTORY /proc/mounts;echo $?)" != "0" ]; then
      logdump "INFO: $SD_EXT_DIRECTORY is not mounted, attemping to mount"
      mountsdext
      if [ "$(egrep -q $SD_EXT_DIRECTORY /proc/mounts;echo $?)" != "0" ]; then
        logdump "FAILURE: $SD_EXT_DIRECTORY is not mounted, exiting"
        A2E4ERROR=$((A2E4ERROR+1))
        exit $A2E4ERROR
      fi
    fi
    
    # Apps
    if [ "$(egrep -q "/data/app" /proc/mounts;echo $?)" != "0" ]; then
      [ ! -d $SD_EXT_DIRECTORY/app ] && mkdir $SD_EXT_DIRECTORY/app
      chown system:system $SD_EXT_DIRECTORY/app
      chmod 0771 $SD_EXT_DIRECTORY/app
      chkpsmount /data/app
      mount -o bind $SD_EXT_DIRECTORY/app/ /data/app
    
      if [ "$(egrep -q "/data/app" /proc/mounts;echo $?)" = "0" ]; then
        logdump "SUCCESS: $SD_EXT_DIRECTORY/app mounted on /data/app"
      else
        logdump "FAILURE: $SD_EXT_DIRECTORY/app failed to mount"
    	A2E4ERROR=$((A2E4ERROR+1))
        exit $A2E4ERROR
      fi
    	
    else
      logdump "WARNING: $SD_EXT_DIRECTORY/app was already mounted"
    fi
    
    # Apps-private
    if [ "$(egrep -q "/data/app-private" /proc/mounts;echo $?)" != "0" ]; then
      [ ! -d $SD_EXT_DIRECTORY/app-private ] && mkdir $SD_EXT_DIRECTORY/app-private
      chown system:system $SD_EXT_DIRECTORY/app-private
      chmod 0771 $SD_EXT_DIRECTORY/app-private
      chkpsmount /data/app-private
      mount -o bind $SD_EXT_DIRECTORY/app-private /data/app-private
    
      if [ "$(egrep -q "/data/app-private" /proc/mounts;echo $?)" = "0" ]; then
        logdump "SUCCESS: $SD_EXT_DIRECTORY/app-private mounted on /data/app-private"
      else
        logdump "FAILURE: $SD_EXT_DIRECTORY/app-private failed to mount"
        A2E4ERROR=$((A2E4ERROR+1))
        exit $A2E4ERROR
      fi
    	
    else
      logdump "WARNING: $SD_EXT_DIRECTORY/app-private was already mounted"
    fi
    
    # Complete FS registration
    if [ ${A2E4ERROR:=0} -eq 0 ]; then
      sync
      setprop cm.filesystem.ready 1
    fi
    
    logdump "- $(date)"
    
  12. buellboy9
    Offline

    buellboy9 Member

    Joined:
    Mar 31, 2010
    Messages:
    428
    Likes Received:
    5
    Trophy Points:
    18
    Ratings:
    +6
    Interesting, but your script was written for CM and not BB, right?
Search tags for this page
blackberry link2sd
,
link2sd 1.5.5
,
link2sd bb
,
link2sd blackberry
,
link2sd for bb
,

link2sd for blackberry

,

link2sd not allowed to su

,
mount script not created su
,
not allowed to su link2sd
,

og droid