Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch - access denied when trying to mount NAS share for roms etc. #1922

Open
jdalmanza opened this issue Jan 15, 2024 · 10 comments
Open

switch - access denied when trying to mount NAS share for roms etc. #1922

jdalmanza opened this issue Jan 15, 2024 · 10 comments
Assignees

Comments

@jdalmanza
Copy link

when following the steps to mount a NAS share for roms as described in the lakka documentation:
https://www.lakka.tv/doc/Serving-ROMs-from-a-NAS/

When you reach the step to enable the storage-{path}.mount service you get an Access denied error:

Lakka:~ # systemctl enable storage-nas.mount
Failed to enable unit: Access denied

This issue is present on 4.3 and still an issue in the 5.x nightly builds (tested on 15-JAN nightly build)

@Ntemis
Copy link
Collaborator

Ntemis commented Jan 15, 2024

Thank you for the report!

@Ntemis Ntemis closed this as completed in 9684885 Jan 15, 2024
@jdalmanza
Copy link
Author

@Ntemis , i tried this on the 17-JAN build and got he same results
logset attached, please let me know if you need anything else
log-2024-01-24-00.51.52.zip

@synthic
Copy link
Contributor

synthic commented Feb 5, 2024

Searching for this issue yields results relating to selinux, but I don't think that applies here. Still, you can try to run systemctl daemon-reexec before the enable command and see if that helps.

@jdalmanza
Copy link
Author

jdalmanza commented Feb 5, 2024

lakka (official): devel-20240123161432-37de45a (Switch.aarch64)

lakka-switch:~ # ls /storage/.config/system.d/
README multi-user.target.wants openvpn.service.sample
cifs.mount.sample nfs.mount.sample storage-nas.mount
lakka-switch:~ # systemctl daemon-reexec
lakka-switch:~ # systemctl enable storage-nas.mount
Failed to enable unit: Access denied

lakka-switch:~ # cat /storage/.config/system.d/storage-nas.mount
[Unit]
Description=cifs mount script
Requires=network-online.service
After=network-online.service
Before=retroarch.service

[Mount]
What=//xxx.xxx.xxx.xxx/retroarch
Where=/storage/nas
Options=username=xxx,password=xxx,rw
Type=cifs

[Install]
WantedBy=multi-user.target
lakka-switch:~ #

@synthic
This exact file works on all my other lakka devices 4.3 and 5.x the switch build is the only one that fails

@Ntemis
Copy link
Collaborator

Ntemis commented Feb 6, 2024

ow! missed the switch part. Reopening and assigning to the proper person

@GavinDarkglider
Copy link
Collaborator

GavinDarkglider commented Mar 17, 2024

lakka (official): devel-20240123161432-37de45a (Switch.aarch64)

lakka-switch:~ # ls /storage/.config/system.d/ README multi-user.target.wants openvpn.service.sample cifs.mount.sample nfs.mount.sample storage-nas.mount lakka-switch:~ # systemctl daemon-reexec lakka-switch:~ # systemctl enable storage-nas.mount Failed to enable unit: Access denied

lakka-switch:~ # cat /storage/.config/system.d/storage-nas.mount [Unit] Description=cifs mount script Requires=network-online.service After=network-online.service Before=retroarch.service

[Mount] What=//xxx.xxx.xxx.xxx/retroarch Where=/storage/nas Options=username=xxx,password=xxx,rw Type=cifs

[Install] WantedBy=multi-user.target lakka-switch:~ #

@synthic This exact file works on all my other lakka devices 4.3 and 5.x the switch build is the only one that fails

This works for me, just need to set protocol version in options line..... testing against samba version packaged in libreelec/lakka, the needed protocol version is 2.1, though that is depending on your server.

Options=username=xxx,password=xxx,rw,vers=2.1 was the only required change

Oh, I missed the enable part..... yeah, no idea why that isnt working, though if I had to guess, it has to do with the fact it is trying to change permissions on a file on a fat partition, which it cant.

you can start the service manually, but probably will never be able to enable it on boot, due to this limitation, without creating a new image, and including the mount in the image.....

Actually.... I might be able to work around this issue, though, I cant promise it will work, if it tries to connect mount before wifi comes up, I would still expect it to fail on boot.

@GavinDarkglider
Copy link
Collaborator

GavinDarkglider commented Mar 17, 2024

Ok, figured out what is going on here....... Not really sure how to fix it properly though..... I might be able to hack something together, but this comes down to how systemd enables services(Creates Symlinks in a bunch of folders, to the service/mount file). Unfortunatly, fat32/exfat do not support symbolic links at all, hince the access denied when trying to enable it.

This issue has probably existed since the first version of lakka on the switch(Before I re-ported/upstreamed), and no one noticed it, because no one else was trying to add systemd unit files to storage and enable them. lol.

That being said, I am going to test some stuff, and see if I can work around the issue for you, probably wont be the cleanest fix ever, but the other option is moving storage to a proper linux partition on the SDcard which kind of ruins the magic of what lakka does for the average switch user. That and for something like libreelec, that will be absolutly needed for things like VPN bring up...... so .....

@jdalmanza
Copy link
Author

actually that makes a lot of sense about the symlinks.
So, let's say that the switch version cannot mount a nas share like a service as the other builds do, how hard would it be to offer an easy way to easily mount a cifs/samba share via the gui. i figure folks that know what they are doing can probably mount manually via the command line or even maybe edit the fstab if that is allowed.
I'm willing to close this out with that explanation as-is and maybe turn it into a feature request for a gui enabled nas mount function?

@GavinDarkglider
Copy link
Collaborator

actually that makes a lot of sense about the symlinks. So, let's say that the switch version cannot mount a nas share like a service as the other builds do, how hard would it be to offer an easy way to easily mount a cifs/samba share via the gui. i figure folks that know what they are doing can probably mount manually via the command line or even maybe edit the fstab if that is allowed. I'm willing to close this out with that explanation as-is and maybe turn it into a feature request for a gui enabled nas mount function?

The reality is, this should be fixed, to keep uniformity with all builds. While I agree with you this should be added to the gui, which is also possible, and then have it start the services for systemd, if the user enables them at boot time......

that is kind of a dirty hack though. Currently, you should be able to use the mount file you created....... systemctl start storage-nas.mount you just cant set it to start on boot.

@GavinDarkglider
Copy link
Collaborator

GavinDarkglider commented Mar 17, 2024

The not so pretty way to work around this would be to call a script in this file: https://github.com/libretro/Lakka-LibreELEC/blob/Lakka-v5.x/packages/lakka/retroarch_base/retroarch/scripts/retroarch-config

then you can put the systemctl command in a script on your sdcard, and still start it before retroarch starts. That being said, it would still need a new image, so let me play with some more messed up, but also more uniform options, that might fix the issue, as that would be ideal.

The more uniform way is to see if mergerfs's newish symlink support works across file systems, and to do some trickery in initramfs...... in which case, I can create the symlinks in an ext4 based image, and overlay the filesystems like we do with the retroarch configs. which in therory should "properly" fix the issue. Assuming I understand how this new support actually works. lol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants