[How-To] [Link2SD] Solve "mount: No such file or directory" error on stock ROM

Search This thread

Warre101

Member
Nov 7, 2015
21
3
Bruges
It looks like your mount script works and link2sd can correctly access the partition once mounted, but either init.d is not running your script or the mount command isn't working at the time that init.d runs. I have no experience with android 6 so I don't know for sure what the problem is from what you're posting.

Can you test if the 11link2sd.txt script actually runs at boot? There are a couple of reasons why it might not be running: a problem with the file permissions or maybe Android doesn't like that ".txt" extension. Can you add a line to that script that writes a simple log file with the echo command?
 

dededefix

Member
Dec 12, 2016
12
0
Hi Warre101, I deeply apologised for my very late answer, I had some personal issues, and then as I needed my phone I re-did the merge proposed by Android and forgot to answer you. ?
I think the issue was in the order of booting: I mean the script did run at boot, but after another thing which had as a result the partition mounted (I could see it) but not writable (like you can see but not touch). But, as I needed my phone to be working, I reflashed my ROM, and reinstalled everything, then did again themerge proposed by Android, and it seems to be fine. I say seem because sometime I still have the error message "no more space", when it is quite empty in reality, but let's say it's working enough for my current use, and I will probably look for a solution when it will be a critical issue again ? Anyway, thanks a lot for your answer and having taken the time to think about it !
 

Warre101

Member
Nov 7, 2015
21
3
Bruges
Hi Warre101, I deeply apologised for my very late answer, I had some personal issues, and then as I needed my phone I re-did the merge proposed by Android and forgot to answer you.
I think the issue was in the order of booting: I mean the script did run at boot, but after another thing which had as a result the partition mounted (I could see it) but not writable (like you can see but not touch). But, as I needed my phone to be working, I reflashed my ROM, and reinstalled everything, then did again themerge proposed by Android, and it seems to be fine. I say seem because sometime I still have the error message "no more space", when it is quite empty in reality, but let's say it's working enough for my current use, and I will probably look for a solution when it will be a critical issue again ? Anyway, thanks a lot for your answer and having taken the time to think about it !

No worries, good to see it's working for you! If the problem is that the partition isn't writable, you might possibly be able to solve the problem by re-mounting it with write permission. I've never done this myself however...
 

Medeon

Senior Member
Dec 26, 2017
102
22
Dordrecht
I do suggest that anybody who tries to do the same thing first check the init-link2sd.sh file for that /dev/block/mmcblk1p2 bit, to make sure it''s the same.
Thanks for the effort of posting this solution. I've tested this on my phone but it is still not working unfortunatly. How or in what directory do I find the init-link2sd.sh file?
 

Warre101

Member
Nov 7, 2015
21
3
Bruges
Thanks for the effort of posting this solution. I've tested this on my phone but it is still not working unfortunatly. How or in what directory do I find the init-link2sd.sh file?

On my phone, it was located in:
/data/data/com.buak.Link2SD/files/init-link2sd.sh
which is the data folder of the Link2SD app. This was a long time ago on an old device though, so it may be different in your case.
 

torres1948

Member
Oct 8, 2018
20
0
[How-To] [Link2SD] Solve "mount: No such file or directory" error on stock ROM

I rooted my Galaxy S3 Mini (GT-i8190) (following seedrom193's tutorial), but I'm still on the stock Android ROM.

I was trying to use Link2SD with a correctly partitioned SD card (10GB primary FAT32 + 4GB primary ext2), but got the following error, which showed every time I tried to recreate mount scripts:
"Mount script cannot be created. mount: No such file or directory"
Also, on every reboot, I would get a "Mount warning" from Link2SD, requiring me to "quick reboot" my phone. After that (second) reboot, Link2SD would work correctly, but shortcuts on my home screen to linked apps were missing.

After much googling I figured that maybe the problem was caused by my (stock) ROM not having init.d support. So I used this method to add init.d:
http://forum.xda-developers.com/showthread.php?t=1933849

Init.d worked properly, but I still got the same error in Link2SD. Then, I used Root Explorer to look at my file system (any other root browser would work too I guess) and found the cause. Here's the contents of /data/data/com.buak.Link2SD/files/init-link2sd.sh, which I *guess* is a copy of the script Link2SD is trying to get to run at boot:
Code:
set +e
echo "$(date) mounting..." > $LOG
sleep 4
mount -t ext2 -o rw [COLOR="Red"][B]/dev/block/vold/179:98[/B][/COLOR] /data/sdext2 1>>$LOG 2>>$LOG

mount -t ext2 -o rw /dev/block/mmcblk1p2 /data/sdext2 1>>$LOG 2>>$LOG

mount >> $LOG
echo "$(date) mount finished" >> $LOG

Apparently, the device node /dev/block/vold/179:98 does not exist, because Android's vold mounting system doesn't automatically mount the second partition of the SD card. This causes the "mount: No such file or directory" error on the first mount command. However, the second mount command (from /dev/block/mmcblk1p2) should work. For some reason, this error seems to keep Link2SD from installing the boot script.

So, I decided to create an init.d script of my own. Using Root Explorer, I created and edited a file named "11link2sd" in /system/etc/init.d/ and inserted the following text:
Code:
#!/system/bin/sh
sleep 4
mount -t ext2 -o rw /dev/block/mmcblk1p2 /data/sdext2

This solved the problem for me, and I can now use Link2SD without needing the extra quick reboot. I figured I'd share my solution in case anybody else had the same problem. I do suggest that anybody who tries to do the same thing first check the init-link2sd.sh file for that /dev/block/mmcblk1p2 bit, to make sure it''s the same.
It's great, but my device has no path such as /system/etc/init.d/ ? So, what I can do?
Yours, torres1948.
 

Warre101

Member
Nov 7, 2015
21
3
Bruges
It's great, but my device has no path such as /system/etc/init.d/ ? So, what I can do?
Yours, torres1948.
I'm assuming you have a newer device than the Galaxy S3 mini that I tested this on, with a more recent version of Android. It's possible that the location of init.d has changed. Unfortunately I can't try this out on my current device, it's not rooted. Also, considering how long ago I wrote this guide, a lot of things in it will probably not work or require a different approach. Please be careful not to break anything!
 

torres1948

Member
Oct 8, 2018
20
0
I'm assuming you have a newer device...
Dear Sir, I found several facts:
1. I must use ext4 for formatting second partition of my SD card - Have done it.
2. blkid command shows both devices:
/dev/block/mmcblk1p2 UUID="..." TYPE="ext4"
/dev/block/mmcblk1p1 UUID="..." TYPE="vfat"
3. link2sd asks which format used for second partition and modifies script to use partition type (ext4) for mounting the /dev/block/mmcblk1p2 as /data/sdext2
4. I tried in terminal this command and I saw the result of mounting ...
So I understood the script doesn't run after booting.
I should place the script so that it will run after boot. My knowledge of Android not enough to determine where I should insert it.
Techniсal descriptions:
tablet - Lenovo Tab 3 8 Plus (TB-8703X)
OS - Android MarshMallow v 6.0.1.
Root - Magisk v 24.3
I looked several articles about using user script as boot-script, but places where I can insert our scripts do not exist on my device. The only way is using Magisk guide ref:
May you help me to manage with this task or can you advice me to whom I may address?
Yours,
torres1948
 

Warre101

Member
Nov 7, 2015
21
3
Bruges
So I understood the script doesn't run after booting.
I should place the script so that it will run after boot.
Indeed, what's still missing is a way to run terminal commands automatically at boot. In my original guide I linked to another guide with a method to add init.d support to achieve this. But reading further down in that guide, it seems that this method no longer works on more recent versions of android such as yours. However...
Magisk might give you a different opportunity to run commands at boot. If I read this correctly:
https://forum.xda-developers.com/t/...-need-of-custom-kernels.1933849/post-76592455
There's a way to run commands at boot included with Magisk, using a file called post-fs-data.d located in /magisk/.core/

I'm not able to test this myself so there's no guarantee this will work but you could try adding your commands to that file.
 

torres1948

Member
Oct 8, 2018
20
0
using a file called post-fs-data.d
Dear Sir;
I 've wrote small script (just one string 'echo "$(date) boot-check inside..." >/storage/FFD3-CAA2/txt.txt ' and test it inserting in
/data/adb/post-fs-data.d,
/system/etc/init.lct.bootcheck.sh
and found: none of these places work on start. I guess adb and lct defines on which event the script is called. Test shows theese event doesn't happen.
So, I failed seeking somewhat like init.d as you mentioned. If you have init.d may you send me a sample, I want to seek file whitch contains specially selected string in your init.d. I reckon I might find some common fragment?

Yours,
torres1948.
 

Warre101

Member
Nov 7, 2015
21
3
Bruges
Dear Sir;
I 've wrote small script (just one string 'echo "$(date) boot-check inside..." >/storage/FFD3-CAA2/txt.txt ' and test it inserting in
/data/adb/post-fs-data.d,
/system/etc/init.lct.bootcheck.sh
and found: none of these places work on start. I guess adb and lct defines on which event the script is called. Test shows theese event doesn't happen.
So, I failed seeking somewhat like init.d as you mentioned. If you have init.d may you send me a sample, I want to seek file whitch contains specially selected string in your init.d. I reckon I might find some common fragment?

Yours,
torres1948.
Do you have a directory /magisk/.core on your device? From what I read, post-fs-data.d should be in that folder
 

torres1948

Member
Oct 8, 2018
20
0
Do you have a directory /magisk/.core on your device? From what I read, post-fs-data.d should be in that folder
No, there is not the /magisk/.core, first o all no folder /magisk. I have the folder /data/adb/post-fs-data.d, I suppose it works if adb demon start, really I don't know the schedule of starting processes... .
Yours, Radmir
 

Warre101

Member
Nov 7, 2015
21
3
Bruges
No, there is not the /magisk/.core, first o all no folder /magisk. I have the folder /data/adb/post-fs-data.d, I suppose it works if adb demon start, really I don't know the schedule of starting processes... .
Yours, Radmir
Unfortunately I won't be able to help you any further then, as I'm not familiar with Magisk myself. Possibly you will have more luck in a subforum that deals with Magisk specifically. Sorry...
 

torres1948

Member
Oct 8, 2018
20
0
Unfortunately I won't be able to help you any further then, as I'm not familiar with Magisk myself. Possibly you will have more luck in a subforum that deals with Magisk specifically. Sorry...
Dear Sir,
I afraid the magisk offers does not work. Now I find the script /system/etc/init.qcom.post_boot.sh. It really is calling after boot. In the end of it I added call of my own script:
sh /storage/FFD3-CAA2/boot-chk.sh
It contains next commands:
echo "blkid:">>/storage/FFD3-CAA2/txt.txt
blkid>>/storage/FFD3-CAA2/txt.txt
echo "mount:">>/storage/FFD3-CAA2/txt.txt
mount >>/storage/FFD3-CAA2/txt.txt
I reboot and found:
Script worked, but blkid output was empty
Output of mount contains:
/dev/block/vold/public:179,65 /mnt/media_rw/FFD3-CAA2 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
this is the first partition of external SD.
The second must have dev/block/vold/public:179,66.
Blkid shows there are not both of /dev/block/mmcblk1p1, /dev/block/mmcblk1p2
So the script generated by Link2SD failed cause the necessary devices absent.
My intention is to insert command which make necessary devices visible to blkid.
Do you know what is the name of such command and its syntax?
Excuse me for bothering you of my routine problems. If you have no time you may leave me no answer. I will stop the communication.
Yours,
torres1948.
 

Warre101

Member
Nov 7, 2015
21
3
Bruges
Dear Sir,
I afraid the magisk offers does not work. Now I find the script /system/etc/init.qcom.post_boot.sh. It really is calling after boot. In the end of it I added call of my own script:
sh /storage/FFD3-CAA2/boot-chk.sh
It contains next commands:
echo "blkid:">>/storage/FFD3-CAA2/txt.txt
blkid>>/storage/FFD3-CAA2/txt.txt
echo "mount:">>/storage/FFD3-CAA2/txt.txt
mount >>/storage/FFD3-CAA2/txt.txt
I reboot and found:
Script worked, but blkid output was empty
Output of mount contains:
/dev/block/vold/public:179,65 /mnt/media_rw/FFD3-CAA2 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
this is the first partition of external SD.
The second must have dev/block/vold/public:179,66.
Blkid shows there are not both of /dev/block/mmcblk1p1, /dev/block/mmcblk1p2
So the script generated by Link2SD failed cause the necessary devices absent.
My intention is to insert command which make necessary devices visible to blkid.
Do you know what is the name of such command and its syntax?
Excuse me for bothering you of my routine problems. If you have no time you may leave me no answer. I will stop the communication.
Yours,
torres1948.
Rest assured that your questions aren't bothering me, but I'm in way over my head here - it's been years since I last worked with a rooted phone and a lot of things have changed since then. There's a lot I don't understand anymore! I'm not even sure Link2SD works at all on a device as recent as yours, even if you get the mount working at boot...

Just off the top of my head, here are a couple of things that could be going wrong (but I don't know how to fix any of it):
- your script might be correctly running at boot, but too late, after link2sd has already started
- the syntax of the mount command could be wrong, causing it to fail or produce incorrect results
- link2sd might be looking in the wromg place for the mounted partition, or be entirely incompatible with your version of Android
 

torres1948

Member
Oct 8, 2018
20
0
O, no! It seems, I found my mistakes. First of all the mount point /data/sdext2 exists and is accessible for read and write. The script generated successfully. The difference from starting is changing type of second partition on ext4, that's all. Now I got a Failure[-6] during moving the app to SD card. If you know where I can get the description of Error -6, let me know. The module link2sd_b is executable, but I don't know what is it's target. So I decided to search other ways to solve my problem.
Regards,
torres1948
 

torres1948

Member
Oct 8, 2018
20
0

Additionally:

Dear Sir, I agree with you my Android Marshmallow has no init.d module and none of versions of Link2sd will work on it.
I tested about 30 apps from Google Play. Most of then transfers files from internal memory to SD card, not apps. Some of them transfers apps if their OS allows to transfer, really it exploits the OS ability to transfer, my OS has no. And part of remaining use the init.d module.
AppMgrIII only transfers small part of apps (I saw only 8 apps from 193 able to transfer, among them Titanium Backup, but after process of moving my device begin work abnormal, I forced to restore device from TWRP copy. Additionally the moved 8 apps uses only 364 MB from 59 GB and prevents other using it. . That is ridiculous!
I am thinking about flashing my ROM with custom firmware, such as Lineage OS, Pixel, Havoc; but I don't know if they have init.d.
Thank your for advices and help, I understand I should to buy more better tablet.
Yours,
torres1948.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    [How-To] [Link2SD] Solve "mount: No such file or directory" error on stock ROM

    I rooted my Galaxy S3 Mini (GT-i8190) (following seedrom193's tutorial), but I'm still on the stock Android ROM.

    I was trying to use Link2SD with a correctly partitioned SD card (10GB primary FAT32 + 4GB primary ext2), but got the following error, which showed every time I tried to recreate mount scripts:
    "Mount script cannot be created. mount: No such file or directory"
    Also, on every reboot, I would get a "Mount warning" from Link2SD, requiring me to "quick reboot" my phone. After that (second) reboot, Link2SD would work correctly, but shortcuts on my home screen to linked apps were missing.

    After much googling I figured that maybe the problem was caused by my (stock) ROM not having init.d support. So I used this method to add init.d:
    http://forum.xda-developers.com/showthread.php?t=1933849

    Init.d worked properly, but I still got the same error in Link2SD. Then, I used Root Explorer to look at my file system (any other root browser would work too I guess) and found the cause. Here's the contents of /data/data/com.buak.Link2SD/files/init-link2sd.sh, which I *guess* is a copy of the script Link2SD is trying to get to run at boot:
    Code:
    set +e
    echo "$(date) mounting..." > $LOG
    sleep 4
    mount -t ext2 -o rw [COLOR="Red"][B]/dev/block/vold/179:98[/B][/COLOR] /data/sdext2 1>>$LOG 2>>$LOG
    
    mount -t ext2 -o rw /dev/block/mmcblk1p2 /data/sdext2 1>>$LOG 2>>$LOG
    
    mount >> $LOG
    echo "$(date) mount finished" >> $LOG

    Apparently, the device node /dev/block/vold/179:98 does not exist, because Android's vold mounting system doesn't automatically mount the second partition of the SD card. This causes the "mount: No such file or directory" error on the first mount command. However, the second mount command (from /dev/block/mmcblk1p2) should work. For some reason, this error seems to keep Link2SD from installing the boot script.

    So, I decided to create an init.d script of my own. Using Root Explorer, I created and edited a file named "11link2sd" in /system/etc/init.d/ and inserted the following text:
    Code:
    #!/system/bin/sh
    sleep 4
    mount -t ext2 -o rw /dev/block/mmcblk1p2 /data/sdext2

    This solved the problem for me, and I can now use Link2SD without needing the extra quick reboot. I figured I'd share my solution in case anybody else had the same problem. I do suggest that anybody who tries to do the same thing first check the init-link2sd.sh file for that /dev/block/mmcblk1p2 bit, to make sure it''s the same.