Cvmfs on WLS 2 ubuntu

Hi!

For the CMS open data workshop last year, we experimented with different approaches for cvmfs access, and one of them is to have it installed locally and mounted to a CMS open data docker container. I had that working at the time of the workshop in October, and now I’m trying this again. But now, mounting it as a shared volume to the container fails

    $ docker run -it --rm --volume "/cvmfs:/cvmfs:shared" cmsopendata/cmssw_5_3_32 /bin/bash
    docker: Error response from daemon: path /cvmfs is mounted on /cvmfs but it is not a shared mount.

If I leave out “shared”, the volume is not properly mounted

    $ docker run -it --rm --volume "/cvmfs:/cvmfs" cmsopendata/cmssw_5_3_32 /bin/bash
    Setting up CMSSW_5_3_32
    CMSSW should now be available.
    [21:56:07] cmsusr@f4b60152e633 ~/CMSSW_5_3_32/src $ ls /cvmfs
    [21:56:18] cmsusr@f4b60152e633 ~/CMSSW_5_3_32/src $

Is there something that has changed, i.e was it installed differently earlier, or is this something totally unrelated? The container image is the same as I used in October and the commands are from my notes at that time so I know that they were working then. The cvmfs install on my laptop has been updated since that time.

If you need more information, I’m happy to provide it. Many thanks for the help!

Best, Kati

PS:

For the sake of completeness, to install, I did the following:

wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest_all.deb
sudo dpkg -i cvmfs-release-latest_all.deb
rm -f cvmfs-release-latest_all.deb
sudo apt-get update
sudo apt-get install cvmfs

and then, in addition

$ sudo /usr/sbin/automount --pid-file /var/run/autofs.pid
/usr/sbin/automount: program is already running.
$ sudo cvmfs_config wsl2_start
[WSL2] automounter already running
$ cvmfs_config probe
Probing /cvmfs/cms.cern.ch... OK
Probing /cvmfs/cms-opendata-conddb.cern.ch... OK
Probing /cvmfs/cms-bril.cern.ch... OK
$ ls /cvmfs/cms.cern.ch
CMS@Home          cc8_amd64_gcc9             external             slc5_amd64_gcc434  slc6_amd64_gcc530    slc7_amd64_gcc630
...

If I recall correctly the automount command was a fix needed earlier, and indeed now the wsl2_start command is enough.

I had exactly this question yesterday. And on mattermost I was told that because of the way docker is working on windows it is not possible to have CVMFS via docker on WSL2. Do I understand your update at the end correctly, that with the separate installation it works via docker container, or do you still have an issue?

Hi, yes, I still have an issue and it does not mount because of “shared”. According to my notes, I had it working on WSL2 using Docker Desktop and Ubuntu linux in October. I would like to track what has changed since then and understand if it is something on the cvmfs installation side (e.g. owner of the local /cvmfs area) or on the docker side. The image I’m using is the same but other updates have surely happened.

Best, Kati

Hi,

@iraklic I might have misunderstood your question in mattermost.

Do I understand correctly that you’d like to

  • Start an WSL2/Ubuntu shell on Windows
  • Mount /cvmfs/cms.cern.ch in that shell
  • Then, start a container with /cvmfs mapped from the Ubuntu shell to the container?

A quick workaround might be to not use sudo cvmfs_config wsl2_start but instead to mount manually like

sudo mkdir -p /cvmfs/cms.cern.ch
sudo mount -t cvmfs cms.cern.ch /cvmfs/cms.cern.ch

Cheers,
Jakob

Hello Jakob,

Thanks for the answers. I think what both Kati and I are looking at doing is the following. Get the CVMFS image and run it with docker on windows. What I think you are telling us is that we can do that, but we will have to mount the cvmfc of the container to the /cvmfs area by hand. I will play with that tomorrow and report back.

Hi Jakob, thanks for this recipe.

The manual mount on the local host is fine

kati@LAPTOP-D2GA3D2E:~$ sudo mount -t cvmfs cms.cern.ch /cvmfs/cms.cern.ch
CernVM-FS: running with credentials 123:130
CernVM-FS: loading Fuse module... done
CernVM-FS: mounted cvmfs on /cvmfs/cms.cern.ch
kati@LAPTOP-D2GA3D2E:~$ cvmfs_config probe
Probing /cvmfs/cms.cern.ch... OK

but the passing the volume as “shared” still does not work and without shared the mounted area in the container is empty (on host it is not). Compared to the automount option, now the cms.cern.ch is visible in the container but still empty.

kati@LAPTOP-D2GA3D2E:~$ docker run -it --rm --volume "/cvmfs:/cvmfs" cmsopendata/cmssw_5_3_32 /bin/bash
Setting up CMSSW_5_3_32
CMSSW should now be available.
[14:29:49] cmsusr@7b52e46708b6 ~/CMSSW_5_3_32/src $ ls /cvmfs/cms.cern.ch
[14:30:07] cmsusr@7b52e46708b6 ~/CMSSW_5_3_32/src $ exit
exit
kati@LAPTOP-D2GA3D2E:~$ docker run -it --rm --volume "/cvmfs:/cvmfs:shared" cmsopendata/cmssw_5_3_32 /bin/bash
docker: Error response from daemon: path /cvmfs is mounted on / but it is not a shared mount.
See 'docker run --help'.

Best, Kati

Hi Kati,

You might be able to map /cvmfs/cms.cern.ch directly, like

docker run -it --rm --volume "/cvmfs/cms.cern.ch:/cvmfs/cms.cern.ch" ...

There is certainly something strange and different on WSL2 than on regular Linux. I’m currently on vacation but back on Tuesday with access to a Windows machine.

Cheers,
Jakob

1 Like

Cool, thanks a lot! That works!

Hi,
I’m newbie with cvmfs.
I run CentOS7/CC7 on my win11/wsl machine
I mounted under root
mkdir -p /cvmfs/sw.hsf.org
mount -t cvmfs sw.hsf.org /cvmfs/sw.hsf.org

when I run

cat /cvmfs/sw.hsf.org/key4hep/setup.sh

cat: /cvmfs/sw.hsf.org/key4hep/setup.sh: Input/output error

Everything else like accessing /cvmfs/sft.cern.ch is OK

How to fix it?

Thanks.

Regards. Valeriy

Hi Valeriy,

Could you please provide your local CVMFS configuration file (/etc/cvmfs/default.local)?

Do you have the public key of the sw.hsf.org repository in /etc/cvmfs/keys?

Hi Radu,

cat /etc/cvmfs/default.local
CVMFS_REPOSITORIES=nica.jinr.ru
CVMFS_HTTP_PROXY=“http://lcgsqd01.jinr.ru:3128|http://lcgsqd02.jinr.ru:3128”

sw.hsf.org repository in /etc/cvmfs/key is the same as cern.c

My colleague has the same config and running on pure linux machine doesn’t have any problems.

The only difference is that I run on CentOS7/CC7 on win11/wsl.

Could you please provide a bug report tarball (sudo cvmfs_config bugreport)?

Thanks!

I managed to get CVMFS working under WSL2 via docker. Instead of mounting into the VM’s own filesystem (which gives the ‘is not a shared mount’ error), I mounted into the system wide /mnt/wsl filesystem. I.E.:

sudo docker run -d --name=cvmfs --cap-add SYS_ADMIN --device /dev/fuse --volume /mnt/wsl/cvmfs:/cvmfs:shared -e CVMFS_CLIENT_PROFILE=single -e CVMFS_REPOSITORIES=sft.cern.ch cvmfs/service

Since CVMFS expects all paths to start /cvmfs, I had to add a symlink inside WSL like so:

sudo ln -s /mnt/wsl/cvmfs /cvmfs

This symlinking step can be done in other WSL distributions and they will all share the same cvmfs/service container.

Hope that helps,
Tim

That’s good to know, thanks.

Does not regular cvmfs work? It would be good to also know if cvmfsexec works.

Dave