coreos / bugs

Issue tracker for CoreOS Container Linux
https://coreos.com/os/eol/
147 stars 30 forks source link

add mount.cifs #571

Closed crawford closed 6 years ago

crawford commented 9 years ago

Issue by epipho Thursday May 08, 2014 at 16:45 GMT Originally opened as https://github.com/coreos/coreos-overlay/issues/595


For those of us that need to share files with a windows host.

crawford commented 9 years ago

Comment by cnelson Thursday May 22, 2014 at 18:41 GMT


Agreed. The kernel module is in the OS, but not the mount tool. Very helpful for vagrant users on windows

crawford commented 9 years ago

Comment by brianredbeard Friday May 23, 2014 at 03:04 GMT


After a bit of research in order to get mount.cifs, we'll need to add cifs-utils, to add cifs-utils, we'll need all of Samba (I think you can see where this is going). Unfortunately (at this time, never say never) we aren't ready to give that mouse that cookie.

crawford commented 9 years ago

Comment by cnelson Friday May 23, 2014 at 14:46 GMT


Are you sure about that? Seems to run ok for me with zero deps:

Build cifs-utils in a container and copy it into /tmp on the host.

$ docker run -t -i -v /tmp:/host_tmp fedora /bin/bash
# yum groupinstall -y "Development Tools" "Development Libraries"
# yum install -y bzip2
# curl http://ftp.samba.org/pub/linux-cifs/cifs-utils/cifs-utils-6.3.tar.bz2 | bunzip2 -c - | tar -xvf -
# cd cifs-utils-6.3/
# ./configure && make
# cp mount.cifs /host_tmp/
# exit

Works fine!

$ sudo mkdir /mnt/foo
$ sudo /tmp/mount.cifs //198.51.100.23/foo /mnt/foo -oguest
$ mount | grep /mnt/foo

//198.51.100.23/foo on /mnt/foo type cifs (rw,relatime,vers=1.0,cache=strict,domain=TEST,uid=0,noforceuid,gid=0,noforcegid,addr=198.51.100.23,unix,posixpaths,serverino,acl,rsize=1048576,wsize=65536,actimeo=1)

lib requirements

$ ldd /tmp/mount.cifs 
    linux-vdso.so.1 (0x00007fffe09fe000)
    libcap.so.2 => /lib64/libcap.so.2 (0x00007fb55c5ec000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fb55c23f000)
    libattr.so.1 => /lib64/libattr.so.1 (0x00007fb55c039000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fb55c7f2000)

If you still don't want to include it because of bloat (totally understandable), at least there's a recipe for folks who want to build it themselves :)

crawford commented 9 years ago

Comment by euskadi31 Tuesday Jan 13, 2015 at 12:55 GMT


:+1:

crawford commented 9 years ago

Comment by StephenOTT Thursday Jan 22, 2015 at 00:46 GMT


:+1:

crawford commented 9 years ago

Comment by sylus Thursday Jan 22, 2015 at 00:46 GMT


:+1:

crawford commented 9 years ago

Comment by sylus Thursday Jan 22, 2015 at 18:28 GMT


Currently Azure with its "Azure File Service" only supports SMB with CIFS so in order to get a shared mount with CoreOS this will be needed.

crawford commented 9 years ago

Comment by saschagottfried Saturday Jan 24, 2015 at 13:17 GMT


Exactly, cifs-utils >= 6.0 is required to connect using SMB version 2.1. Managed the mount to "Azure File Service" this week using Ubuntu 14.04.1 that ships with a recent version. Found this issue while my investigation if CoreOS provides this requirement.

$ sudo dpkg -p cifs-utils

Package: cifs-utils
Priority: optional
Section: otherosfs
Installed-Size: 256
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Version: 2:6.0-1ubuntu2
Replaces: smbfs (<< 2:4.0~rc1-1)
Depends: samba-common, libc6 (>= 2.17), libkeyutils1, libkrb5-3 (>= 1.10+dfsg~), libtalloc2 (>= 2.0.4~git20101213), libwbclient0 (>= 2:3.6.0~pre3)
crawford commented 9 years ago

Comment by euskadi31 Thursday Jan 29, 2015 at 16:46 GMT


1844c45c4d98 / # USE="net-fs/samba -server" emerge -av net-fs/cifs-utils

[ebuild  N    ] sys-apps/keyutils-1.5.9-r1  USE="{-test}" ABI_X86="(64) (-32) (-x32)" 
[ebuild  NS   ] app-text/docbook-xml-dtd-4.2-r2 [4.1.2-r6]
[ebuild  N    ] sys-libs/libcap-ng-0.7.4  USE="-python -static-libs" PYTHON_TARGETS="python2_7 python3_3 -python3_4" 
[ebuild  N    ] dev-libs/iniparser-3.1-r1  USE="-doc -examples -static-libs" ABI_X86="(64) -32 (-x32)" 
[ebuild  N    ] dev-libs/libev-4.15-r1  USE="-static-libs" ABI_X86="(64) -32 (-x32)" 
[ebuild  N    ] dev-libs/libverto-0.2.5-r1  USE="libev threads -glib -libevent -static-libs -tevent" ABI_X86="(64) (-32) (-x32)" 
[ebuild  N    ] sys-libs/talloc-2.1.0-r1  USE="python -compat" ABI_X86="(64) (-32) (-x32)" PYTHON_TARGETS="python2_7" 
[ebuild  N    ] sys-libs/tdb-1.3.0-r1  USE="-python" ABI_X86="(64) -32 (-x32)" PYTHON_TARGETS="python2_7" 
[ebuild  N    ] app-crypt/mit-krb5-1.13  USE="keyutils pkinit threads -doc -openldap (-selinux) {-test} -xinetd" ABI_X86="(64) (-32) (-x32)" 
[ebuild  N    ] virtual/krb5-0-r1  ABI_X86="(64) (-32) (-x32)" 
[ebuild  N    ] sys-libs/tevent-0.9.21-r1  USE="-python" ABI_X86="(64) (-32) (-x32)" PYTHON_TARGETS="python2_7" 
[ebuild  N    ] net-fs/cifs-utils-6.1-r1  USE="acl ads caps caps-ng -creds" 
[ebuild  N    ] net-fs/samba-3.6.24  USE="acl aio client netapi pam readline smbclient winbind -addns -ads -avahi -caps -cluster -cups -debug -dmapi -doc -examples -fam -ldap -ldb -quota (-selinux) -server -smbsharemodes -swat -syslog" ABI_X86="(64) (-32) (-x32)" 
crawford commented 9 years ago

Comment by IbnSaeed Sunday Mar 01, 2015 at 14:07 GMT


any update ?

crawford commented 9 years ago

Comment by IbnSaeed Sunday Mar 01, 2015 at 14:12 GMT


Can someon list the steps needed to run cfutils on ubuntu or debian ?

crawford commented 9 years ago

Comment by carpenike Sunday May 31, 2015 at 15:43 GMT


So I've got the mount.cifs file created and it works manually. As far as I'm aware, I cannot use a units file to mount the CIFS share ala http://blog.scottlowe.org/2015/02/20/config-mount-nfs-coreos/, as I don't have the mount.cifs binary in /sbin, right?

Can I use a service file to auto mount at boot? Any other recommendations?

crawford commented 9 years ago

Comment by djmaze Sunday May 31, 2015 at 22:51 GMT


@carpenike: Yes, you should probably use a one-shot service which fetches (if not present) and runs mount.cifs. At least that's what I am doing. (Consider running a docker container for getting the binary, as explained above).

To start on boot, you need to setAfter=network.target in the Unit section and WantedBy=multi-user.target in the Install section.

If the mount is needed by one or more particular services, you might as well do the mount on demand. Just add a Requires and an After with the mount service in the depending service(s).

crawford commented 9 years ago

Comment by carpenike Sunday May 31, 2015 at 23:43 GMT


Do you have a service file already? I tried getting one working earlier and will post it when I get home if you don't.

Sent from my Windows Phone


From: Martin Honermeyermailto:notifications@github.com Sent: ‎5/‎31/‎2015 6:51 PM To: coreos/coreos-overlaymailto:coreos-overlay@noreply.github.com Cc: Ryan Holtmailto:ryan@ryanholt.net Subject: Re: [coreos-overlay] add mount.cifs (#595)

@carpenikehttps://github.com/carpenike: Yes, you should probably use a one-shot service which fetches (if not present) and runs mount.cifs. At least that's what I am doing.

To start on boot, you need to setAfter=network.target in the Unit section and WantedBy=multi-user.target in the Install section.

If the mount is needed by one or more particular services, you might as well do the mount on demand. Just add a Requires and an After with the mount service in the depending service(s).

— Reply to this email directly or view it on GitHubhttps://github.com/coreos/coreos-overlay/issues/595#issuecomment-107254904.

crawford commented 9 years ago

Comment by carpenike Monday Jun 01, 2015 at 02:42 GMT


Excellent... this seems to work. Any tweaks recommended? How can I get the service to download the mount.cifs file at startup?

[Unit] Description=Mount Share service After=network.target

[Service] Type=oneshot RemainAfterExit=yes TimeoutStartSec=0 ExecStart=/home/core/bin/mount.cifs //10.9.18.10/share /mnt/share -o username=administrator,domain=storage,password=password,uid=0,gid=0

crawford commented 9 years ago

Comment by djmaze Saturday Jun 06, 2015 at 12:06 GMT


@carpenike: You can run a docker image in ExecStartPre to get you the mount.cifs binary. I found this one. The following copies the binary to /opt/bin:

ExecStartPre=/usr/bin/docker run -v /opt/bin:/target sigma/mount.cifs-copy /target
crawford commented 9 years ago

Comment by cusspvz Wednesday Jul 01, 2015 at 13:08 GMT


+1 for including CIFS on releases.

Hacks are nasty and decrease system stability

crawford commented 9 years ago

Comment by so0k Thursday Jul 09, 2015 at 14:33 GMT


@djmaze The sigma/mount.cifs_copy image is 1.1GB, I've reduced it to 5MB in so0k/mount.cifs_copy

crawford commented 9 years ago

Comment by djmaze Thursday Jul 09, 2015 at 14:43 GMT


@so0k: Cool stuff!

sepiroth887 commented 9 years ago

btw, the binary from ubuntu:14.04 cifs-utils (mount.cifs) is compatible with coreOS. I started out using the mount.cifs_copy image but later just tried it and it works just fine.

Using it for really simple use cases so not sure whether all features have the required libraries. Tested on 766.(3-5).0

jotunskij commented 8 years ago

+1

If you want to use Azure with CoreOS, this is probably a requirement.

phagunbaya commented 8 years ago

+1

bobintornado commented 8 years ago

+1

Since the kernel is already supporting CIFS since release 899.1.0 (also CEPH, NFS and 9P), I think it make senses to add in the support from the tooling side.

Plus it's a must to have to run a CoreOS Kubernete cluster on Azure.

edevil commented 8 years ago

I'm also interested in mounting Azure shares on my CoreOS kubernetes nodes.

monaka commented 8 years ago

Off topic: @edevil I found an hacky workaround against this issue and tried to run K8s nodes. But there have the another issue. You must apply a patch to K8s if you want to use Azure File.

monaka commented 8 years ago

I put the workaround on https://gist.github.com/monaka/5cb1f33e5317e29285843f158a387c9b . This will enable to execute "mount -tcifs" (So you're close to azureFile volumes on K8s). Hope some helps.

jcrowthe commented 7 years ago

@monaka Any update to this issue? I am exploring using Azure File storage with CoreOS, which still requires SMB support.

monaka commented 7 years ago

@jcrowthe The issue was fixed if you want to use CIFS on K8s (Hyperkube). See https://github.com/kubernetes/kubernetes/commit/3aaf0a86e3bc80da39d348db0f6d675132f71fbb

And the workaround I posted above will work (probably).

veeresh1982 commented 7 years ago

Is they any plan/ETA to get mount.cifs installed on coreos ?

rasmus commented 6 years ago

Would really like to get get an ETA/no-go on this one? A "priority/P1" from two years ago doesn't really bode well.

dtretyakov commented 6 years ago

@crawford, it's really valuable when using CoreOS in Azure to be able to mount Azure File Shares to the host.

What problem prevents adding cifs-utils into CoreOS distributions?

r7vme commented 6 years ago

Good evening.

Just adding huge +1 to have mount.cifs in CoreOS.

I think this now affects many people that run CoreOS + Kubernetes on Azure and will be using Azure File backend.

Workarounds with putting mount.cifs into /opt/bin does not work, becuase Kubernetes uses mount -t cifs. By default mount will look only in /sbin for helpers. In CoreOS /sbin is read-only, which makes impossible to make mount -t cifs work.

To test that this is the case, i did following hack:

mkdir /sbin2
cp -a /sbin/* /sbin2
# remove symlink
rm -r /sbin
mv /sbin2 /sbin
# Copy mount.cifs binary from kubelet container
docker cp k8s-kubelet.service:/sbin/mount.cifs /sbin
ppettina commented 6 years ago

Two PRs have been made to address this issue. Is there anything particular preventing them being reviewed? +1 for adding mount.cifs