[Bug] mount-sd.sh is executed to early ( to late) at startup [not relevant]

asked 2014-03-01 15:20:18 +0200

jolladiho gravatar image

updated 2015-03-02 00:23:17 +0200

simo gravatar image

150301: I decide to close this, because it is historic.


After some tests with mount-sd.sh I can confirm a speculation, that this script is called twice at startup.

In an early stage (processid round about 200) and later again (processid >1300).

Thats what it says in early stage: mkdir: cannot create directory `/run/user': Permission denied

It comes from here: su $DEVICEUSER -c "mkdir -p $MNT" #(where: MNT=/run/user/$DEF_UID/media/sdcard)

The folder /run/user does not exist at the early stage. Sometimes the /home folder is also mounted later, than mount-sd.sh is executed the first time.

Ambiences created from pictures on the sdcard will be lost at reboot.

mount-sd.sh should be executed

  1. after /run/user/100000 exists

  2. after /home is mounted

  3. before ambience resouces are checked

  4. before tracker starts (added 20140302)

Hope this is possible.

see also my post in a thread at maemo: http://talk.maemo.org/showthread.php?p=1414837#post1414837

Edit: made a debug script yesterday, here a short output what happens. I am using btrfs filesystem with subvolumes, a subvolume for ther android data path and a symbolic link /home/nemo/MyDocs (N9 retro feeling).

PID=224, ACTION=add
ln -sf /dev/mmcblk1 /dev/sdcard
mkdir: cannot create directory `/run/user/100000': Permission denied
mkdir -p /run/user/100000/media/sdcard, rc=1
 home is mounted.
mount -o subvol=.android /dev/sdcard /data/sdcard/, rc=0
root       158     1 16 15:44 ?        00:00:00 /lib/systemd/systemd-udevd
root       163   158  4 15:44 ?        S      0:00 /lib/systemd/systemd-udevd
root       224   163  2 15:44 ?        S      0:00 /bin/bash /usr/sbin/mount-sd.sh
PID=1318, ACTION=add
ln -sf /dev/mmcblk1 /dev/sdcard
mkdir -p /run/user/100000/media/sdcard, rc=0
mount -o compress /dev/sdcard /run/user/100000/media/sdcard, rc=0
 home is mounted.
su nemo -c "ln -sf /run/user/100000/media/sdcard /home/nemo/MyDocs"
root         1     0  6 15:43 ?        Ss     0:01 /sbin/init --unit=default.target
root      1318     1  1 15:44 ?        Ss     0:00 /bin/bash /usr/sbin/mount-sd.sh

Edit update SailfishOS (I did a factory reset before update): We have a new mount-sd.sh script. It is better than the previous one and handles fat, exfat, ntfs and other filesystems. The developer (no name in script) added ntfs support untested. The script is called only once at startup. But the mystery goes on, may be there are other problems - I don't know after short time of tests.

first some facts

I have a btrfs sdcard with hidden subvolumens and sourced a debug script at the end of mount-sd.sh that mounts the root of sdcard additionaly to /media/work (just to copy old data) and my personal .android subvol to /data/sdcard. No problems with the android disk space - I do not use much android apps! Native SailfishOS is more welcome.

Debug results:

cat /tmp/mount-sd.debug 
PID=1250, ACTION=add, DEVNAME=/dev/mmcblk1
mount -o subvol=/,dirsync,noatime,users /dev/mmcblk1 /media/work, rc=0
mount -o subvol=.android,dirsync,noatime,users /dev/mmcblk1 /data/sdcard/, rc=0
root         1     0  6 23:13 ?        Ss     0:01 /sbin/init --unit=default.target
root      1250     1  0 23:14 ?        Ss     0:00 /bin/bash /usr/sbin/mount-sd.sh add mmcblk1

Do you want to see my debug script here too?

second some mysteries:

  1. The sdcard mount point changed to /media/sdcard/<UUID>/, result: programs have problems to address that path (filemanger, ownkeepass, cargodock). Users like me could never remember the<UUID> part to input it to a path in any program. What is the reason select such a comlex path name?

It would be fine to have a environment variable like MYSDCARD="/media/sdcard/<UUID>/" or some other reference to the sdcard. Or where can we find a reference to the path of the sdcard?

  1. I have two pictures for ambience at /media/sdcard<UUID>/Data/ambience/ (remember I can't remember <UUID>). I can see the pics in the gallery. The pics are in ambience format. I can create an ambience and tag it as favorite. After that I can select the ambiences as expected. After shutdown the ambiences are lost. Only the 9 standard ambiences and the "snow white" and " the first one" are persistent. I have to do all steps from gallery pictures again after every reboot. Ambiences from pictures on the sdcard are lost after shutdown.

  2. This is version should be the 1. non beta! Do you think that this is a "non beta" sdcard use case for smartphone users?

more questions:

Is it possible to expand the memory more flexible with a btrfs formated sdcard?

Can users use the sdcard to save content from SaifishOS apps (for example pictures direct from the camera program) direct to the sdcard?

Is there a concept for sdcard usage?

I would like to help Jolla working on a concept or with my scripting skills.

Edit 20140323: since the mount is to late for pictures on the sdcard for ambiences. Take a look at my posting for a custom mount script (based on my debugs) on TMO: http://talk.maemo.org/showpost.php?p=1418001&postcount=5

edit retag flag offensive reopen delete

The question has been closed for the following reason "question is not relevant or outdated" by jolladiho
close date 2015-03-01 21:55:37.733020


After your post I saw the modifications for exFAT. I have fuse exFAT and a 64GB exFAT card, but the card does not mount automatically after reboot. The official script is not ready yet?

cocof2001 ( 2014-03-21 19:57:04 +0200 )edit

@cocof2001 You can check the journal as root with this command for errors.

journalctl | grep mount
jolladiho ( 2014-03-23 21:45:51 +0200 )edit

mount-sd[1351]: Called to add mmcblk1p1 mount-sd[1352]: Called to add mmcblk1 Mar 24 17:46:03 localhost systemd[1]: mount-sd@mmcblk1p1.service: main process exited, code=exited, status=1 Mar 24 17:46:03 localhost systemd[1]: Unit mount-sd@mmcblk1p1.service entered failed state. Mar 24 17:46:03 localhost systemd[1]: mount-sd@mmcblk1.service: main process exited, code=exited, status=1 Mar 24 17:46:03 localhost systemd[1]: Unit mount-sd@mmcblk1.service entered failed state.

cocof2001 ( 2014-03-24 18:51:37 +0200 )edit

sorry it doesn't says a lot to me - but it is called twice. First time for mmcblk1p1 and second for mmcblk1. And what does

/sbin/blkid /dev/mmcblk1
/sbin/blkid /dev/mmcblk1p1


jolladiho ( 2014-03-24 18:57:50 +0200 )edit

/dev/mmcblk1: PTTYPE="dos" /dev/mmcblk1p1: TYPE="exfat"

cocof2001 ( 2014-03-24 19:08:17 +0200 )edit