You are not logged in.

#1 2010-04-14 03:30:29

lamdacore
Member
Registered: 2009-11-05
Posts: 128

[SOLVED] MPD + NTFS partition

So I managed to set up MPD (with mpd.conf in /etc and mpd user).
It works fine with music I put in /var/lib/mpd. (I can add music with a database update. - 'u' in ncmpcpp)

So 2 question:

1. How do I link/add music that is say in my user's home folder?
2. I have most of my music in a ntfs partition and a ntfs external HD (I share with windows). How do I get mpd to access those files?

mpd.conf:

music_directory       "/var/lib/mpd"         # Your music dir.
playlist_directory    "/var/lib/mpd/playlists"
db_file               "/var/lib/mpd/mpd.db"
log_file              "/var/log/mpd/mpd.log"
error_file            "/var/log/mpd/mpd.error"
pid_file              "/var/run/mpd/mpd.pid"
state_file            "/var/lib/mpd/mpdstate"
user                  "mpd"

gapless_mp3_playback            "yes"
save_absolute_paths_in_playlists    "yes"
follow_outside_symlinks    "yes"
follow_inside_symlinks        "yes"

Last edited by lamdacore (2010-04-28 04:02:15)

Offline

#2 2010-04-14 04:21:47

n0dix
Member
Registered: 2009-09-22
Posts: 956

Re: [SOLVED] MPD + NTFS partition

1. I try creating a symlink between your home folder and music directory.

$ sudo ln -s $HOME/music /var/lib/mpd/

And to update the database:

$ sudo mpc update /var/lib/mpd --wait

Offline

#3 2010-04-14 04:24:40

smakked
Member
From: Gold Coast , Australia
Registered: 2008-08-14
Posts: 420

Re: [SOLVED] MPD + NTFS partition

MIne looks like this

music_directory       "/media/Music/Metal/"

thats on a NTFS partition


Certified Android Junkie
Arch 64

Offline

#4 2010-04-14 11:31:19

lamdacore
Member
Registered: 2009-11-05
Posts: 128

Re: [SOLVED] MPD + NTFS partition

Thanks for your replies. I tried both your suggestions, smakked, n0dix. Unfortunately didn't work.
I think it might have something to do with the user permissions.

May be the /etc/fstab can be insightful into what could be modified to get this working.

# 
# /etc/fstab: static file system information
#
# <file system>        <dir>         <type>    <options>          <dump> <pass>
none                   /dev/pts      devpts    defaults            0      0
none                   /dev/shm      tmpfs     defaults            0      0

#/dev/cdrom             /media/cd   auto    ro,user,noauto,unhide   0      0
#/dev/dvd               /media/dvd  auto    ro,user,noauto,unhide   0      0
#/dev/fd0               /media/fl   auto    user,noauto             0      0

/dev/sda3 /home ext3 defaults,noatime 0 1
/dev/sda4 /home/lamdacore/NTFSHome ntfs-3g defaults,noatime 0 1
/dev/sda5 /boot ext2 defaults 0 1
/dev/sda6 / ext3 defaults,noatime 0 1
/dev/sda7 swap swap defaults 0 0

sda4 is where I have my music.

@smakked - since directly pointing to your music folder in your ntfs partition worked, can you put your fstab as well, so I can compare?

cheers.

Last edited by lamdacore (2010-04-14 11:33:02)

Offline

#5 2010-04-15 20:30:09

Henry Flower
Member
Registered: 2010-04-12
Posts: 53

Re: [SOLVED] MPD + NTFS partition

I had a similar problem, which did indeed turn out to be permissions related.  To check, you could try running mpd as your normal user account or as root and see if mpd can access the drive then.   (Health warning: running mpd as root long-term is probably not wise).

Offline

#6 2010-04-16 14:42:13

lamdacore
Member
Registered: 2009-11-05
Posts: 128

Re: [SOLVED] MPD + NTFS partition

I think running mpd root to test would be simpler for me to do than running user (less changes in configs?)
But how do I do that exactly?

What was your final solution?

thanks.

Offline

#7 2010-04-16 18:49:36

Henry Flower
Member
Registered: 2010-04-12
Posts: 53

Re: [SOLVED] MPD + NTFS partition

You alter the user mpd runs as by just changing the line

user                  "mpd"

in mpd.conf - replace mpd with your username or root.   You might need to change permissions of the various /var/lib and /var/log files that mpd uses - if you start mpd in the terminal, I think it will tell you that.   

I'm afraid my interim solution is that I'm still running it as root - security on this computer isn't really a concern for me.   Running mpd as lamdacore (or whatever your username is) would be a more viable long-term solution if you can get that to work. smile

Last edited by Henry Flower (2010-04-16 18:50:08)

Offline

#8 2010-04-18 20:52:28

lamdacore
Member
Registered: 2009-11-05
Posts: 128

Re: [SOLVED] MPD + NTFS partition

It works with root. Not with "lamdacore"

But there has to be a cleaner solution. Or is there no way I can give mpd user access to ntfs partitions?

Offline

#9 2010-04-18 21:13:55

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: [SOLVED] MPD + NTFS partition

Why on earth would you want to use NTFS? I understand you'd like to share your data but MPD (or Linux) will ignore the Windows file system permissions; everything will be root:root - which is exactly why you can run mpd as root but not as a regular user. This works both ways: the Windows filesystem will not understand Linux permissions and ownerships, so you're losing functionality on both ends.

Maybe NTFS-3G can fix that, but I assume you're already using that. Since it's a non-Linux filesystem, you will also be unable to symlink (try copying a Linux symlink to a Windows fiilesystem).

Using non-Linux filesystes is asking for problems. Vfat might work, but it's messy. I wouldn't use that or NTFS though. Not unless I'd absolutely need it.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#10 2010-04-18 22:25:34

lamdacore
Member
Registered: 2009-11-05
Posts: 128

Re: [SOLVED] MPD + NTFS partition

I realize that, but I need to share some folders and files between windows and linux, so I am forced to use ntfs.
Now the only solution I can see is mounting the partition with user ownership if that is possible?

Offline

#11 2010-04-19 10:16:17

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: [SOLVED] MPD + NTFS partition

From the mount manual:

owner  Allow  an  ordinary  (i.e.,  non-root) user to mount the filesystem if he is the owner of the device.  This option implies the options nosuid
           and nodev (unless overridden by subsequent options, as in the option line owner,dev,suid).

Give it a shot I say. And it never hurts to read documentation wink.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#12 2010-04-20 12:36:34

Henry Flower
Member
Registered: 2010-04-12
Posts: 53

Re: [SOLVED] MPD + NTFS partition

OK,
After being spurred on to try to do this thing properly, this is what I came up with today.

My fstab line (for a USB NTFS disk):

/dev/sdb1               /media/samsung  ntfs-3g noauto,users,rw,nodev           0 0

Then I created the /media/samsung folder and gave the audio group read/write permissions.

It seems that non-root users can only mount an ntfs partition if they use a version of ntfs-3g with fuse included, so I replaced ntfs-3g with the version from AUR, having removed from the PKGBUILD file the option "-with-fuse=external" (see this thread: http://bbs.archlinux.org/viewtopic.php?id=44844 ).   I also had to set
the ntfs-3g binary to setuid-root, dealt with here: http://www.tuxera.com/community/ntfs-3g … privileged (note- the instructions say this is discouraged, but it seems using ntfs partitions in linux requires some compromises).
I can now mount the drive as an ordinary user.

Then I set mpd back to run as user mpd, checked the audio group had access to all the mpd folders, and all was well.

One hiccup which you might not have: mpd was unable to access my (external) sound card at first.  To solve this one, I used

chmod 770 /dev/snd -R && chgrp audio /dev/snd -R

As far as I can remember, that's everything. smile

Last edited by Henry Flower (2010-04-20 12:54:26)

Offline

#13 2010-04-20 16:49:00

lamdacore
Member
Registered: 2009-11-05
Posts: 128

Re: [SOLVED] MPD + NTFS partition

Thanks a lot. Will give this a shot soon!

Offline

#14 2010-04-20 18:59:22

bobdob
Member
Registered: 2008-06-13
Posts: 138

Re: [SOLVED] MPD + NTFS partition

When I had my music on an ntfs partition I just mounted it with my uid and gid, like so:

/dev/sdc1  /media/disk ntfs-3g  users,uid=1000,gid=100,fmask=0113,dmask=0002 0 0

It mounted at boot and mpd had no trouble reading from it.

Offline

#15 2010-04-28 04:01:51

lamdacore
Member
Registered: 2009-11-05
Posts: 128

Re: [SOLVED] MPD + NTFS partition

Thanks a lot for all your help.
I did what bobdob suggested. Works like a charm.

cheers.

ps. how do I find the uid of user other than me? (I know I can look up my user's uid and gid using the "id" command)

Last edited by lamdacore (2010-04-28 04:03:12)

Offline

#16 2010-04-28 07:56:57

lamdacore
Member
Registered: 2009-11-05
Posts: 128

Re: [SOLVED] MPD + NTFS partition

Some additional info that may be related to the above solution - if you want to mount an external ntfs/vfat disk with the same uid and gid  flags, when adding the partition to fstab, add using the partition's uuid (would allow it to functions regardless of the order the hard disk is attached to computer)

see -  http://linux.byexamples.com/archives/32 … with-uuid/

Offline

#17 2010-04-28 11:13:27

bobdob
Member
Registered: 2008-06-13
Posts: 138

Re: [SOLVED] MPD + NTFS partition

lamdacore wrote:

Thanks a lot for all your help.
I did what bobdob suggested. Works like a charm.

cheers.

ps. how do I find the uid of user other than me? (I know I can look up my user's uid and gid using the "id" command)

You can get the uid of all users from /etc/passwd, and gid from /etc/group.

Offline

Board footer

Powered by FluxBB