mount a sd cart on startup
I am using LD with the image install (Ubuntu 18) I have tried:
add an entry to fstab add an entry to cron to be executed @reboot add a SysVinit service
If I run 'sudo mount -a' it will mount the sd, but I can't make it mount automatically at startup. Any tips?
Why not use the mount option in the APP?
If you don't want Android to mount your SD card during startup so that LP can mount it, check out https://gist.github.com/qianbinbin/e93e19940dda264cc5cd2ebdddbe565e
If you don't want Android to mount your SD card during startup so that LP can mount it, check out https://gist.github.com/qianbinbin/e93e19940dda264cc5cd2ebdddbe565e
Infortunally I can not install magisk root
Why not use the mount option in the APP?
Any tips on how to do that? My sd is listed inside LD as /dev/block/mmcblk1
The mount option in the APP is for folders already mounted by Android, but I'm not sure if it's suitable for a partition: bottom right button -> properties -> mounts, enable it and add a mount point like /sdcard - /mnt/sdcard.
The @reboot option seems not working with LP cron, since it's a non-standard option.
Does mount -a work if a mount point added in fstab?
Does
mount -awork if a mount point added in fstab?
Yes. I had to do this everytime I start LD
whats your sysv script like if you dont mind? did you try /etc/rc.local?
From: jaum20 @.> Sent: Saturday, June 17, 2023 2:11:34 AM To: meefik/linuxdeploy @.> Cc: Binbin Qian @.>; Comment @.> Subject: Re: [meefik/linuxdeploy] mount a sd cart on startup (Issue #1360)
Does mount -a work if a mount point added in fstab?
Yes. I had to do this everytime I start LD
— Reply to this email directly, view it on GitHubhttps://github.com/meefik/linuxdeploy/issues/1360#issuecomment-1595084311, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB36AKG2MGY4CIAZ6QDU4WTXLSOVNANCNFSM6AAAAAAYK7GWAY. You are receiving this because you commented.Message ID: @.***>
I created a /etc/init.d/mount_sd.sh script:
mount UUID=affdaccf-8998-4853-b2da-dd96bb45f78e /home/android/sd
but didn't work.
Fstab is UUID=affdaccf-8998-4853-b2da-dd96bb45f78e /home/android/sd ext4 defaults 0 0
- Does full path (
mount->/usr/bin/mount) work? - Does
mount UUID=affdaccf-8998-4853-b2da-dd96bb45f78e /home/android/sdwork if run manually? - Did you enable the script by
update-rc.d? - Normally sysv scripts don't look like this, did your try
/etc/rc.local?
Does full path (mount -> /usr/bin/mount) work?
Didn't work
- Does
mount UUID=affdaccf-8998-4853-b2da-dd96bb45f78e /home/android/sdwork if run manually?
yes
- Did you enable the script by
update-rc.d?
yes
4. Normally sysv scripts don't look like this, did your try
/etc/rc.local?
there are not rc.local in etc. Must I create it?
there are not rc.local in etc. Must I create it?
Not really, but it's useful when you want to run some scripts during startup. Create /etc/init.d/rc.local and enable it:
#! /bin/sh
### BEGIN INIT INFO
# Provides: rc.local
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Run /etc/rc.local if it exist
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_start() {
if [ -x /etc/rc.local ]; then
[ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)"
/etc/rc.local
ES=$?
[ "$VERBOSE" != no ] && log_end_msg $ES
return $ES
fi
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
Create /etc/rc.local and chmod +x /etc/rc.local:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Mount your SD card here:
/usr/bin/mount UUID=affdaccf-8998-4853-b2da-dd96bb45f78e /home/android/sd
exit 0
You can add some commands in /etc/rc.local before exit 0 to test if it's executed, like /usr/bin/touch /tmp/it_worked.
there are not rc.local in etc. Must I create it?
Not really, but it's useful when you want to run some scripts during startup. Create
/etc/init.d/rc.localand enable it:#! /bin/sh ### BEGIN INIT INFO # Provides: rc.local # Required-Start: $all # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Run /etc/rc.local if it exist ### END INIT INFO PATH=/sbin:/usr/sbin:/bin:/usr/bin . /lib/init/vars.sh . /lib/lsb/init-functions do_start() { if [ -x /etc/rc.local ]; then [ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)" /etc/rc.local ES=$? [ "$VERBOSE" != no ] && log_end_msg $ES return $ES fi } case "$1" in start) do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esacCreate
/etc/rc.localandchmod +x /etc/rc.local:#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. # Mount your SD card here: /usr/bin/mount UUID=affdaccf-8998-4853-b2da-dd96bb45f78e /home/android/sd exit 0You can add some commands in
/etc/rc.localbeforeexit 0to test if it's executed, like/usr/bin/touch /tmp/it_worked.
Thank you for your help, bur didn't worked :(. The SD is not mounted at startup neither /tmp/it_worked is created
OK, maybe something wrong with your sysv service, but you can always mount your SD card (requiring FAT32 or exFAT I guess?) on Android, then mount the directory in the APP.