|
|
2014-03-02
, 00:51
|
|
Posts: 1,547 |
Thanked: 7,503 times |
Joined on Apr 2010
@ Czech Republic
|
#72
|
| The Following User Says Thank You to MartinK For This Useful Post: | ||
|
|
2014-03-04
, 09:49
|
|
|
Posts: 2,351 |
Thanked: 5,243 times |
Joined on Jan 2009
@ Barcelona
|
#74
|
|
|
2014-03-04
, 14:55
|
|
Posts: 202 |
Thanked: 440 times |
Joined on Jul 2012
@ Germany - Potsdam
|
#75
|
Can you show the parent process for each of the calls? Though I suspect now that one is udev while the other is systemd (because it seems that there's a systemd unit that will call mount-sd.sh, probably to workaround some issue like the one you have).
PID=224, ACTION=add ln -sf /dev/mmcblk1 /dev/sdcard ID_FS_TYPE=btrfs mkdir: cannot create directory `/run/user/100000': Permission denied mkdir -p /run/user/100000/media/sdcard, rc=1 home is mounted. mount -o subvol=.jolla/Desktop /dev/sdcard /home/nemo/Desktop/, rc=0 mount -o subvol=.jolla/Documents /dev/sdcard /home/nemo/Documents/, rc=0 mount -o subvol=.jolla/Downloads /dev/sdcard /home/nemo/Downloads/, rc=0 mount -o subvol=.jolla/Music /dev/sdcard /home/nemo/Music/, rc=0 mount -o subvol=.jolla/Pictures /dev/sdcard /home/nemo/Pictures/, rc=0 mount -o subvol=.jolla/Playlists /dev/sdcard /home/nemo/Playlists/, rc=0 mount -o subvol=.jolla/Public /dev/sdcard /home/nemo/Public/, rc=0 mount -o subvol=.jolla/Templates /dev/sdcard /home/nemo/Templates/, rc=0 mount -o subvol=.jolla/Videos /dev/sdcard /home/nemo/Videos/, rc=0 mount -o subvol=.android /dev/sdcard /data/sdcard/, rc=0 ---callstack--- UID PID PPID C STIME TTY TIME CMD 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 ---end--- PID=1318, ACTION=add ln -sf /dev/mmcblk1 /dev/sdcard ID_FS_TYPE=btrfs 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" ---callstack--- 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 ---end---
| The Following User Says Thank You to meemorph For This Useful Post: | ||
|
|
2014-03-18
, 08:31
|
|
Posts: 24 |
Thanked: 7 times |
Joined on Nov 2011
|
#76
|
|
|
2014-03-18
, 09:04
|
|
Posts: 738 |
Thanked: 819 times |
Joined on Jan 2012
@ Berlin
|
#77
|
|
|
2014-03-18
, 10:26
|
|
Posts: 594 |
Thanked: 1,094 times |
Joined on Aug 2012
@ Rhine
|
#78
|
|
|
2014-03-19
, 20:41
|
|
Posts: 281 |
Thanked: 659 times |
Joined on Aug 2013
@ Finland
|
#79
|
#!/bin/bash
# The only case where this script would fail is:
# mkfs.vfat /dev/mmcblk1 then repartitioning to create an empty ext2 partition
DEF_UID=$(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2)
DEF_GID=$(grep "^GID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2)
DEVICEUSER=$(getent passwd $DEF_UID | sed 's/:.*//')
MNT=/media/sdcard
MOUNT_OPTS="dirsync,noatime,users"
ACTION=$1
DEVNAME=$2
if [ -z "${ACTION}" ] || [ -z "${DEVNAME}" ]; then
exit 1
fi
systemd-cat -t mount-sd /bin/echo "Called to ${ACTION} ${DEVNAME}"
if [ "$ACTION" = "add" ]; then
eval "$(/sbin/blkid -c /dev/null -o export /dev/$2)"
if [ -z "${UUID}" ] || [ -z "${TYPE}" ]; then
exit 1
fi
# This hack is here to delay mounting the sdcard until tracker is ready
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$DEF_UID/dbus/user_bus_socket
count=1
while true; do
test $count -ge 64 && break
MINER_STATUS="$(dbus-send --type=method_call --print-reply --session --dest=org.freedesktop.Tracker1.Miner.Files /org/freedesktop/Tracker1/Miner/Files org.freedesktop.Tracker1.Miner.GetStatus | grep -o 'Idle')"
STORE_STATUS="$(dbus-send --type=method_call --print-reply --session --dest=org.freedesktop.Tracker1 /org/freedesktop/Tracker1/Status org.freedesktop.Tracker1.Status.GetStatus | grep -o 'Idle')"
test "$MINER_STATUS" = "Idle" -a "$STORE_STATUS" = "Idle" && break
systemd-cat -t mount-sd /bin/echo "Waiting $count seconds for tracker"
sleep $count ;
count=$(( count + count ))
done
test -d $MNT/${UUID} || mkdir -p $MNT/${UUID}
chown $DEF_UID:$DEF_GID $MNT $MNT/${UUID}
touch $MNT/${UUID}
case "${TYPE}" in
vfat|exfat)
mount ${DEVNAME} $MNT/${UUID} -o uid=$DEF_UID,gid=$DEF_GID,$MOUNT_OPTS,utf8,flush,discard || /bin/rmdir $MNT/${UUID}
;;
# NTFS support has not been tested but it's being left to please the ego of an engineer!
ntfs)
mount ${DEVNAME} $MNT/${UUID} -o uid=$DEF_UID,gid=$DEF_GID,$MOUNT_OPTS,utf8 || /bin/rmdir $MNT/${UUID}
;;
*)
mount ${DEVNAME} $MNT/${UUID} -o $MOUNT_OPTS || /bin/rmdir $MNT/${UUID}
;;
esac
test -d $MNT/${UUID} && touch $MNT/${UUID}
systemd-cat -t mount-sd /bin/echo "Finished ${ACTION}ing ${DEVNAME} of type ${TYPE} at $MNT/${UUID}"
else
DIR=$(mount | grep -w ${DEVNAME} | cut -d \ -f 3)
if [ -n "${DIR}" ] ; then
umount $DIR || umount -l $DIR
systemd-cat -t mount-sd /bin/echo "Finished ${ACTION}ing ${DEVNAME} at ${DIR}"
fi
fi
|
|
2014-03-20
, 09:34
|
|
Posts: 24 |
Thanked: 7 times |
Joined on Nov 2011
|
#80
|
mount-sd.sh was overwritten by the update, so obviously you need to add the lines to mount your folders again (step 6 of first post)...
but the really bad part after the update is:
at first look, it seems that mount-sd.sh is now called for the first time later than before (now after the "ambiance-stuff"), which is really totally annoying.
the only workaround, i have for now:
copy the ambiance to the "traditional home-folder" (not on sdcard), so it can be accessed at bootup.
i hope, i or someone else finds a better solution (or this will be gone with the next update).
I am using btrfs filesystem and some subvolumes. If I do not distinguish between early and late call I get some mount messages (already in use - I think - or equal to that) at startup. After startup I can find the files mount-sd.early.done and mount-sd.late.done in the /tmp folder. The early file contains a low processid (ex. 230), the other a higher id (ex. 1303).
I also have a symbolic link "/home/nemo/MyDocs -> /run/user/100000/media/sdcard". If I create an ambience from a picture that is saved in "MyDocs", I lose the ambience at reboot. Thats why I think, SailfishOS checks the ambience files between the early and the late call of mount-sd.sh. Ambiences from pictures in the other folders, that are mounted as subvolumes in early stage (~/Pictures) are persistent. So this is a problem of mounting the sdcard to "/run/user/100000/media/sdcard". If you do a mount to a self defined mountpoint (ex. /mnt/microsd) everything is done early. My question is: when is the folder "/run/user/100000/media/sdcard" available at startup?
Edit: mkdir: cannot create directory `/run/user': Permission denied
This is the problem of the mount-sd.sh. 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.
On shutdown, all subvolumes should be unmounted. That's why I put a while loop at the end of mount-sd.sh. Mine looks oversized at the moment, but it should work with other filessystems too, added a filesystem check with "file -s". If you want to use it with btrfs (at your own risk - it is experimental), you have to change the "mount -o subvol=.jolla/xxxx ${SDCARD} /home/nemo/xxxx" parts for your needs. The first mount should be done with or without compress option, just as you like it.
how I created my btrfs sdcard as root after a factory reset
#!/bin/bash SDCARD=/dev/sdcard EARLYDONE="/tmp/mount-sd.early.done" LATEDONE="/tmp/mount-sd.late.done" DEF_UID=$(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) DEF_GID=$(grep "^GID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) DEVICEUSER=$(getent passwd ${DEF_UID} | sed 's/:.*//') LATEMNT=/run/user/${DEF_UID}/media/sdcard if [ "${ACTION}" = "add" ]; then if [ -f ${LATEDONE} ]; then echo "$0: nothing to do!" else # try only the late mount again if [ -f ${EARLYDONE} ]; then if [ -b /dev/mmcblk1p1 ]; then ID_FS_TYPE=$(file -s /dev/mmcblk1p1 | tr '[:upper:]' '[:lower:]' | cut -d " " -f2) elif [ -b /dev/mmcblk1 ]; then ID_FS_TYPE=$(file -s /dev/mmcblk1 | tr '[:upper:]' '[:lower:]' | cut -d " " -f2) else exit $? fi su ${DEVICEUSER} -c "mkdir -p ${LATEMNT}" case "${ID_FS_TYPE}" in vfat|ntfs|exfat) mount ${SDCARD} ${LATEMNT} -o uid=${DEF_UID},gid=${DEF_GID} [ $? = 0 ] && echo "$$" >> ${LATEDONE} ;; *) mount ${SDCARD} ${LATEMNT} if [ $? = 0 ]; then echo "$$" >> ${LATEDONE} chown ${DEVICEUSER}: ${LATEMNT} fi ;; esac # first call, try both: early and late mount else # create device if [ -b /dev/mmcblk1p1 ]; then ln -sf /dev/mmcblk1p1 ${SDCARD} ID_FS_TYPE=$(file -s /dev/mmcblk1p1 | tr '[:upper:]' '[:lower:]' | cut -d " " -f2) elif [ -b /dev/mmcblk1 ]; then ln -sf /dev/mmcblk1 ${SDCARD} ID_FS_TYPE=$(file -s /dev/mmcblk1 | tr '[:upper:]' '[:lower:]' | cut -d " " -f2) else exit $? fi su ${DEVICEUSER} -c "mkdir -p ${LATEMNT}" case "${ID_FS_TYPE}" in vfat|ntfs|exfat) mount ${SDCARD} ${LATEMNT} -o uid=${DEF_UID},gid=${DEF_GID} [ $? = 0 ] && echo "$$" >> ${LATEDONE} ;; btrfs) mount -o compress ${SDCARD} ${LATEMNT} if [ $? = 0 ]; then echo "$$" >> ${LATEDONE} chown ${DEVICEUSER}: ${LATEMNT} fi mount -o subvol=.jolla/Desktop,compress ${SDCARD} /home/nemo/Desktop/ mount -o subvol=.jolla/Documents ${SDCARD} /home/nemo/Documents/ mount -o subvol=.jolla/Downloads ${SDCARD} /home/nemo/Downloads/ mount -o subvol=.jolla/Music ${SDCARD} /home/nemo/Music/ mount -o subvol=.jolla/Pictures ${SDCARD} /home/nemo/Pictures/ mount -o subvol=.jolla/Public ${SDCARD} /home/nemo/Public/ mount -o subvol=.jolla/Templates ${SDCARD} /home/nemo/Templates/ mount -o subvol=.jolla/Videos ${SDCARD} /home/nemo/Videos/ [ -d /data/sdcard ] && mount -o subvol=.android ${SDCARD} /data/sdcard/ ;; *) mount ${SDCARD} ${LATEMNT} if [ $? = 0 ]; then echo "$$" >> ${LATEDONE} chown ${DEVICEUSER}: ${LATEMNT} fi ;; esac echo "$$" >> ${EARLYDONE} fi fi else # unmount all umount ${SDCARD} myret=$? while [ $myret = 0 ] do echo -n "." umount ${SDCARD} myret=$? done umount -l ${LATEMNT} rm -f ${SDCARD} # clear status flags rm -f ${LATEDONE} rm -f ${EARLYDONE} fiLast edited by meemorph; 2014-03-01 at 13:14.