Solved: Solution to SMB "Operation not permitted"
|
11th Dec, 2013, 12:28 PM
Post: #1
|
|||
|
|||
Solution to SMB "Operation not permitted"
Hello people.
I'm new here -- in fact today I just tried out XBian for the first time. I'd used RaspBMC for a few months before now, but I'd found a few issues that had popped up in recent builds that seemed to be mum from the devs about fixes (not bashing them, I'm sure they're busy with other things), so I was looking for something else. The first major issue I noticed with XBian was the inability to add SMB/CIFS shares. More accurately, my inability to add them, as I'm not sure if this is occurring with everybody. Having used Linux and other Unix-like systems since the mid-1990's, however, a workaround wasn't too hard for me to find. In searching for solutions to this problem, I noticed others having similar issues. They found some OK solutions (such as restarting xbmc as root), but I think there's a cleaner way. In this post I'll highlight what to do if you run across them. My particular problem: When I'd go to add my SMB share via Videos -> Files -> Add, then selecting Windows Network (SMB), I could browse my workgroup, find the Windows machine with the configured CIFS share, but when clicking on it I would receive a window with the text "Operation not permitted". To me, this looked like XBian is simply populating the window contents with the direct output of some shell command that it's executing on the back end. In fact, there's lots of things you can execute on the command line of any Linux system that would spit out the same error. This usually occurs when a user does not have sufficient permissions to execute a specific action -- I'm guessing that whatever XBian is attempting to do in the background (mount the CIFS share?) is being executed as the "xbian" user, and not a user with sufficient privileges to do that specific action, and thus the error. Other workarounds: When looking for solutions to this initially, I'd found some other suggestions including updating packages (eh... maybe) and re-launching the underlying xbmc process as root via the command line (no). I don't like these approaches for a few reasons: 1) My packages were already up to date (I'm running the latest XBian build at the time of this posting, which seems to pull in the standard Raspbian repos as well as some of its own), and the two packages suggested to be updated in other posts should not affect this behavior anyways, and 2) Relaunching the xbmc process as root is a brute-force maneuver. It's the strong-arm solution -- sure, it works, but it's almost like cheating. It also just feels wrong being a long-time user of unix-like systems, and there was no obvious way to make XBian repeat this behavior on boot (maybe updating some init scripts, but I didn't look into it that far, because I didn't like the solution). Plus, the actual "xbmc" process that was being talked about, I couldn't find in the latest build of XBian anyways... so screw it. My proposed workaround: My proposed workaround is rather simple, but does require just a little bit of command-line-fu. If you're scared of a command line, you may want to enlist the help of somebody who's not, just to be sure. I'm happy to help others work through these problems, but preferably not because of basic usage issues with a Linux command prompt in general. First, make sure you're receiving some sort of "Operation not permitted" error when you attempt to add an SMB share via the normal method using the XBMC GUI. This may also apply to NFS shares, as well, but I didn't test that. Second, make sure you've got SSH enabled on your XBian pi, and then SSH into it with the 'xbian' user. The default password is available via a google search (unless you've changed it). How to SSH will be out of the scope of this thread. Third, sudo to the root user and make your directory structure for your mounted shares. In general, these shares seem to be mounted under the "/media" directory normally (if things were working as intended), so we'll be working from there. Make a directory under "/media" which will be named whatever you'd like to call your share. Note that in my example below, I will be mounting two shares; one for "Movies", and one for "TV", so I'll make those two directories accordingly: Code: xbian@xbian ~ $ sudo su Fourth, try to mount your share manually from the command line, as root. If this works, proceed to the next step. If it doesn't work, then it's very likely that there is either a connectivity issue between the XBian pi device and the device hosting the SMB/CIFS share, or there are permissions issues with the user you are connecting to the share as. Check those on the Windows host and try again, or examine event logs on the Windows side (outside of scope for this post). The below example is for mounting an SMB/CIFS share. Mounting an NFS share is similar, but you would replace "cifs" with "nfs". Make sure you replace "USERNAME" and "PASSWORD" in the below examples with your username and password on the Windows host you are connecting to. Similarly, replace the IP address of the Windows host with what you are connecting to. Code: root@xbian:/media# mount -t cifs -o ro,username=USERNAME,password=PASSWORD //10.100.3.10/Media/Movies Movies/ ...if you didn't see any output, great. The command worked. You should be able to cd into the directory you just mounted, do an ls, and see all of your content. If that worked, then move on to the next step. If it didn't, then check connectivity, permissions, etc. on the remote Windows host. Make another directory and mount other shares as needed for your environment. Fifth, let's make sure that Xbian mounts this share every time it boots up. For this, we simply need to make an entry in /etc/fstab for every share we need to mount to get to our media. Before doing this, we'll make a file called "smbcredentials" under /home/xbian. This file will contain the username and password for the Windows share, and will be set to only be readable by root. Remember to substitute "USERNAME" and "PASSWORD" with your appropriate values: Code: root@xbian:/media# cd /home/xbian Once that file has been created, make an entry in /etc/fstab for each share that we need to mount. Remember that in my case I'm using two, you may be using one or 50, I don't know, but make the appropriate entries. Below is my example -- note that the two bottom lines (under the snarky comment) are the lines I added to the file: Code: root@xbian:/home/xbian# cat /etc/fstab Remember to substitute your own values in for the IP address, and if you're attempting to do this with NFS and not CIFS, you should change "cifs" to "nfs", obviously. Sixth, reboot. Type "reboot" at the command line. Your Xbian pi should come back up after a minute or two, and when it does it should have automatically mounted the shares that you put into /etc/fstab. You can check this with "df" once the Xbian comes back up from the reboot: Code: xbian@xbian ~ $ df -h ...here I can see that the shares are indeed mounted as intended. Great! Finally, go back into XBMC on your TV, and add the source -- EXCEPT, don't add the source as SMB. Add it as a local file -- choose "Root Filesystem" from the list, and then navigate to /media. You should see the shares you just mounted. Add each one individually, and Xbian should categorize them as normal. I hope this helps. I know I was a little frustrated by Xbian seemingly not running with enough permission to mount these shares direct from the GUI, but a little command line fu and nothing is impossible. Enjoy! |
|||
15th Dec, 2013, 04:12 AM
Post: #2
|
|||
|
|||
RE: Workaround for SMB "Operation not permitted" and other remote filesystem issues
Changed title
Please read before you post How to post a log file If you liked my help, click on "Thanks" to show your appreciation.
|
|||
16th Apr, 2019, 06:37 AM
Post: #3
|
|||
|
|||
RE: Solution to SMB "Operation not permitted"
(11th Dec, 2013 12:28 PM)beeftube Wrote: I hope this helps. I know I was a little frustrated by Xbian seemingly not running with enough permission to mount these shares direct from the GUI, but a little command line fu and nothing is impossible. Thanks - Having the same problem, but can't even do the commands you specify w/o sudo.. Once using sudo, it did seem to work, but definitely makes me wonder why this is necessary, and why others aren't having the same problem? What am I doing wrong? I tried SMB shared on a linux based NAS and on my Win10 box, and I get the same errors on both.. |
|||
« Next Oldest | Next Newest »
|
Possibly Related Threads... | |||||
Thread: | Author | Replies | Views: | Last Post | |
[PROBLEM] connecting to SMB server: "operation not permitted" | kegepet | 4 | 22,574 |
28th Apr, 2013 05:53 AM Last Post: mk01 |