ubuntugoogle-colaboratorysquashfs

Is it possible to mount a squashfs file in google colab's VM?


In a Google Colab Notebook, you can execute arbitrary bash commands by prefixing a line with ! or starting a block with %%shell. You have significantly free permissions to do whatever you like in the Ubuntu 18.04 VM running the notebook, allowing you to download and install different programs.

I would like to create and mount a squashfs file, but mounting it is giving me an operation not permitted.

%%shell
apt-get update && apt-get install -y squashfs-tools
mksquashfs sample_data sample_data.sqsh
mount sample_data.sqsh /root/content/using_sqsh -t squashfs -o loop

Is there anything I can do to elevate my permissions? Or is mounting fundamentally not allowed on their infrastructure? And how do I check what, exactly, is not permitted to know whether it could be allowed?

Notes:


Solution

  • You can use cat /proc/1/cgroup to confirm that the Colab VM is a docker container, docker containers are not able to mount anything in unprivileged mode (the default), and running in privileged mode would be a security issue.

    Thus, it is not possible to mount squashfs files (or anything else) in a Google Colab VM.