SD Card is not mounted, import fails: one of root causes found


#1

Hi all,

I just want to share fix for a bug that was annoying me for a long time.

This will probably affect you only if you have a smartphone with locale settings with number delimiter set to comma “,” instead of dot “.”.
I’m using my My Passport Wireless Pro usually only for SD card backups while traveling.
I’ve noticed that sometimes my WD My Passport Wireless Pro stops recognizing SD cards and not being able to do an SD card backup.
Finally I’ve decided to troubleshoot this issue prior to my next journey.
Luckily this device is linux-based box with SSH access.
I found that device is detecting SD card without issues, but later it’s fails at mount step with next error:
ufsd: failed to mount “mmcblk0p1”. bad option “bias=”
I’ve checked mount script and found that it’s caused by invalid value stored in /etc/timezone_offset file.
I have an android phone with Russian locale settings, with comma being used number delimiter by default.
WD My Passport Wireless Pro updates /etc/timezone_offset each time you’re accessing it through mobile app or web interface.
After you’re logging in using web interface everything works fine and /etc/timezone_offset is populated with “3” value and mount procedure works well, SD card import is started, but when I start mobile app and connect to device, /etc/timezone_offset if populated with “3,00” value, which is not correctly processed inside FW, since FW expect number delimiter to be a dot “.”, instead of comma “,”.

As a big picture it was seen that after you’re logging to device using web interface, SD card import starts working, but when you’re logging in to device using mobile app, SD card import stops working.
To make device to work again, simplest was is to login using web interface again, but I have a patch for REST api inside My Passport Wireless Pro.

How to patch you device to work correctly (you need to know how to use SSH and vi):

  1. login using SSH to your My Passport Wireless Pro
  2. open /var/www/rest-api/api/System/src/System/DateTime/Model/Configuration.php file using vi
  3. apply next patch around line 105:
    $output = $retVal = null;
    - $cmdString = "echo " . $changes['time_zone_offset'] . " > /etc/timezone_offset";
    + $timezone_offset = $changes['time_zone_offset'];
    + $timezone_offset = preg_replace('/,/', '.', $timezone_offset);
    + $cmdString = "echo " . $timezone_offset . " > /etc/timezone_offset";
    exec_runtime("sudo bash -c '($cmdString)'", $output, $retVal, false);

This patch will replace all commas to dots in REST api that changes timezone_offset each time you’re logging into your device using either web interface or mobile app.

Hope this will help someone to solve their issues too and hope WD will integrate this patch into new FW update.

Here is a patched version of Configuration.php: http://ge.tt/9Qj4QEr2

Regards,
Dmitry


Bug and fix for firmware v1.04.17
#2

Hi Dimitry,

good catch! I’ve found the same the issue and in the hurry before leaving for vacations I’ve fixed the scripts using /etc/timezone_offset but I didn’t manage to find the who was writing it :wink:


#3

Yeah, nasty bug.
I’ve did not check this community forum, so I’ve been debugging this issue by myself.
Originally I thought that not that many countries are using comma as a decimal separator, but later checked wikipedia and found that there are a lot of countries that use comma instead of dot.
Hope this will last issue with WD MPWP and finally I’ll be able to use if without trouble.
In last firmware they’ve also removed “move” functionality, leaving only “copy”, so I needed to hack also that staff to enable “move” functionality again.
Such good HW with such buggy FW and application, shame on WD QA.


#4

good hw, buggy fw, but at least it’s easy to hack and to customize :wink:
I’ve created a custom image with your fix:

https://framadrop.org/r/DJJnZPp2Xl#/b6y9otwaKarb3TabMolK4W1zk3WcJZPxWYd8ojJFlU=


#5
$ ssh mypassport
root@mypassport.local's password: 
[root@MyPassport ~]# ls
[root@MyPassport ~]# cat /etc/timezone_offset 
2

after having opened the MyClous app on my phone:

[root@MyPassport ~]# cat /etc/timezone_offset 
2.00
[root@MyPassport ~]# cat /etc/version
1.04.17-fix-tz1

:slight_smile:


#6

Hi,
i’ve run into the same bug (Android in France with german settings…) and your fix saved my day! Great work.
For instance i only applied the solution provided by ggrandou, i did not attack via vi (not too accustomed with this editor :wink: ) .
I will give the custom update a try when i’ll return from my vacation at Madagascar :sunglasses:.

Thanks again :grin:
Wilhelm


#7

Shouldn’t this be a problem WD fixes for us. I’m no technician and "hacking’ into the software of MyPassport is something I don’t understand.