Open tashrifbillah opened 1 year ago
You didn't say how you installed it. If you have a default installation from rpm or source, there's now no setuid-root. In that case on CentOS7 the --writable-tmpfs
option should be able to use the fuse-overlayfs
command if it is available and unprivileged user namespaces are enabled. If it is not available you should be seeing an INFO message telling you that's a likely cause of problems. Have you shown all the output from apptainer? If you don't mind setuid-root you could install the apptainer-suid
rpm or compile with the --with-suid
option, or if you don't want setuid-root, make sure that fuse-overlayfs
is installed.
You didn't say how you installed it.
yum update Singularity
I have fuse-overlayfs
[root@rc-predict-dev singularity]# yum list installed | grep fuse-overlayfs
fuse-overlayfs.x86_64 0.7.2-6.el7_8 installed
Have you shown all the output from apptainer?
The above is all! Can I get a second comment?
That's odd. Please attach the output from singularity -d shell --writable-tmpfs my.image.sif
Has the configuration in apptainer.conf been changed from the default? Is use underlay
disabled for some reason?
Nevermind about underlay, that's not relevant. But is the configuration standard?
How do I find if the configuration is standard? I can attest that no human has modified yum installed/updated configuration.
Ok then it should still be standard. You can confirm with rpm -qV apptainer
which should have no output if nothing has changed.
Is there anything unusual about the environment? Is it running nested in another container system, for instance, or in anything other than a standard shell?
I expect the debug output to show "Overlay requested while in user namespace" but since it is not there, somehow the userNS flag must not be getting set. But user namespaces are available according to the other debug output, and it would have died earlier if they were not.
You can confirm with rpm -qV apptainer which should have no output
Confirmed.
Is it running nested in another container system Yes.
somehow the userNS flag must not be getting set.
How do we check?
Thank you for your time.
Tell me more details about the container system that it is layered inside.
Also, try running unshare -r
and inside there run ls -l /proc/$$/ns
and show me the output. I'm not sure but I think the setting of the internal userNS flag is related to that.
[root@rc ~]# unshare -r
unshare: unshare failed: Invalid argument
inside there
Where?
Does this hint anything?
[root@rc ~]# singularity shell --userns my.image.sif
INFO : A system administrator may need to enable user namespaces, install
INFO : apptainer-suid, or compile with ./mconfig --with-suid
ERROR : Failed to create user namespace: user namespace disabled
Oh! Are you running everything as root?
Usually singularity/apptainer are run by unprivileged users. I assumed that's what you were doing, and deduced that you would only have been able to get as far as you did if unprivileged user namespaces were enabled.
If I disable unprivileged user namespaces on my el7 machine and run as root, overlay works fine. Are you running inside a container system that gives you only the appearance of root somehow but not a full root? What are the details of the container system you are running under?
When unshare -r
works, it gives you a shell prompt, that's what I meant by "inside there".
Running apptainer without setuid-root, now the default, requires unprivileged user namespaces. You will need to either enable them or install the additional apptainer-suid
package.
requires unprivileged user namespaces.
:o Since the birth of Singularity, we have been using it as root
for building images. Obliviously, we also run it as root. I have full root. Trying as non-root in a bit ...
[tango@rc ~]$ singularity shell --writable-tmpfs my.image.sif
INFO: Detected Singularity user configuration directory
INFO : A system administrator may need to enable user namespaces, install
INFO : apptainer-suid, or compile with ./mconfig --with-suid
ERROR : Failed to create user namespace: user namespace disabled
Did not succeed either.
requires unprivileged user namespaces. You will need to either enable them
When you get a second, please advise on how to enable 'them'.
Did not succeed either.
It just occurred to me that the above is expected to fail. Singularity images are built as root. Why would a non-root be allowed to change them after!
If I disable unprivileged user namespaces on my el7 machine and run as root, overlay works fine.
I'll try this following your link.
user.max_net_namespaces = 0
It was already set in my system. In addition, I have set user.max_user_namespaces = 15000
according to your link. After that, I can use --writable-tmpfs
flag as a non-root user. But it is no good as my image's files were created as root and so the non-root user cannot modify them.
You will need to either enable them or install the additional apptainer-suid package.
So is my only option going to be install the additional apptainer-suid package
?
user.max_net_namespaces = 0
It was already set in my system. In addition, I have set
user.max_user_namespaces = 15000
according to your link. After that, I can use--writable-tmpfs
flag as a non-root user. But it is no good as my image's files were created as root and so the non-root user cannot modify them.You will need to either enable them or install the additional apptainer-suid package.
So is my only option going to be
install the additional apptainer-suid package
?
An unprivileged user with apptainer-1.1 and no apptainer-suid package should be able to overlay changes onto a container using the --fakeroot
option. I didn't mention that earlier because you hadn't gotten that far.
The next problem you are likely to run into is that the default maximum amount of changes you can make with --writable-tmpfs
is set by the sessiondir max size
option in /etc/apptainer/apptainer.conf
to only 16 MB. You can increase that value if you don't mind allowing containers to use that much ram, or you can use the --overlay path
option instead of --writable-tmpfs
to save the changes in a directory or ext3 filesystem. Another advantage of using --overlay
is that you can make your changes with --fakeroot
and then start the container again without --fakeroot
after no more changes are needed, by appending :ro
to the end of the path to make it read-only.
Hi, my CentOS 7 Linux is
3.10.0-1160.76.1.el7.x86_64
. My apptainer version is1.1.3-1.el7
.Gives:
Full disclosure: the
--writable-tmpfs
flag worked when singularity was singularity and probably CentOS was 3.8.0. The way around I am following to edit image's files is to bind mount a volume into my desired directory. However, I would like to know if there is a real solution to the above issue.