Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More instructive error messages on singularity verify error #2435

Closed
vsoch opened this issue Dec 7, 2018 · 17 comments
Closed

More instructive error messages on singularity verify error #2435

vsoch opened this issue Dec 7, 2018 · 17 comments

Comments

@vsoch
Copy link
Collaborator

vsoch commented Dec 7, 2018

It's going to be common for a user to try to verify an image that hasn't been signed, or was generated with a (pre 3.0) version of Singularity, or some weird combination of those things. Here I'll walk through a set of common scenarios that have unclear messages for what is going on:

Case 1. Pull and verify using Singularity 2.6.0

Version is 2.6.0-HEAD.579c415

$ singularity pull docker://ubuntu

If I try to verify it, I get incorrect usage (which goes against the docs. Note that the 2.6 docs don't seem to have this (so I'm following 3.0). Here is what I see:

USAGE: singularity [...] verify <data object id/groupid> <container path>

I think probably some version of the command was available, but docs never written for it? A good resolution here would be to provide a simple (parallel) page for 2.6 for how to use the older version. The link should be here.

Case 2. Pull with 2.6.0, verify with 3.0

This is a more common use case - we have a container that was previously pulled with 2.6, and we want to verify with 3.0. Now I get an actual error message (and the usage described in the docs is technically correct). Note that I'm running this via a dockerized 3.0 - it shouldn't have issue because we aren't doing anything that needs privileged (correct me if I am wrong here). I mostly don't want to install Singularity on my host because many users are still using 2.6.

$ docker run -v $PWD:/tmp singularityware/singularity:3.0 verify /tmp/ubuntu.simg
Verifying image: /tmp/ubuntu.simg
WARNING: Authentication token file not found : Only pulls of public images will succeed
ERROR:   verification failed: failed to load SIF container file: invalid SIF file: Magic |sqs�
                                                                                              M�
| want |SIF_MAGIC|

That's pretty fugly! Could the error give something more meaningful, like "This image is not a valid SIF file, meaning it was not generated with Singularity 3.0 or greater. This action "verify" is not available"

Case 3. Pull with 3.0, verify with 3.0

This one should be error free! Let's pull first

$ docker run -v $PWD:/tmp singularityware/singularity:3.0 pull --name /tmp/ubuntu-pull.simg docker://ubuntu
WARNING: Authentication token file not found : Only pulls of public images will succeed
INFO:    Starting build...
Getting image source signatures
Copying blob sha256:32802c0cfa4defde2981bec336096350d0bb490469c494e21f678b1dcf6d831f
 30.62 MiB / 30.62 MiB  6s
Copying blob sha256:da1315cffa03c17988ae5c66f56d5f50517652a622afc1611a8bdd6c00b1fde3
 847 B / 847 B  0s
Copying blob sha256:fa83472a3562898caaf8d77542181a473a84039376f2ba56254619d9317ba00d
 556 B / 556 B  0s
Copying blob sha256:f85999a86bef2603a9e9a4fa488a7c1f82e471cbb76c3b5068e54e1a9320964a
 162 B / 162 B  0s
Copying config sha256:dec80b78b0e6d45cbe2e098c747d28dc7c4ca39cab2608fe22790e68098ae7c4
 2.42 KiB / 2.42 KiB  0s
Writing manifest to image destination
Storing signatures
INFO:    Creating SIF file...
INFO:    Build complete: /tmp/ubuntu-pull.simg

Houston, we have container! Let's try verify

$ docker run -v $PWD:/tmp singularityware/singularity:3.0 verify /tmp/ubuntu-pull.simg
Verifying image: /tmp/ubuntu-pull.simg
WARNING: Authentication token file not found : Only pulls of public images will succeed
ERROR:   verification failed: error while searching for signature blocks: no signatures found for system partition

This message is very good and meaningful, bravo! 🎊

So I think the thing to address are the first two cases when the user is running into issues with conflicting versions. Thanks for fixing this up!

@yhcote
Copy link
Contributor

yhcote commented Dec 9, 2018 via email

@vsoch
Copy link
Collaborator Author

vsoch commented Dec 9, 2018

Here is an example of verify with 2.6:

$ singularity --version
2.6.0-HEAD.579c415
$ singularity verify
USAGE: singularity [...] verify <data object id/groupid> <container path>

@yhcote
Copy link
Contributor

yhcote commented Dec 9, 2018 via email

@vsoch
Copy link
Collaborator Author

vsoch commented Dec 9, 2018

It's okay, we can blame the Github ghosties. They are always up to no good, especially since it was recently Halloween time! 🎃

@GodloveD
Copy link
Collaborator

I'm unable to replicate that @vsoch.

[vagrant@localhost singularity]$ singularity --version
2.6.0-HEAD.579c415
[vagrant@localhost singularity]$ singularity verify
ERROR: Unknown command 'verify'

Ghosties. Clearly.

@vsoch
Copy link
Collaborator Author

vsoch commented Dec 11, 2018

Weird! Is it possible that there is some crisscrossing of singularity versions? Since it’s doing this weird behavior on my machine, can we do some kind of trace to see what’s happening?

We should at least try to crash the ghostie party.

@GodloveD
Copy link
Collaborator

Dunno. Do you have 2 versions of Singularity installed on your machine. Can you replicate if you spin up a fresh VM and install there?

@vsoch
Copy link
Collaborator Author

vsoch commented Dec 11, 2018

Here's the relevant code! There was indeed a verify.exec, and verify.info with this version of singularity:

...
open("/usr/local/libexec/singularity/cli/verify.exec", O_RDONLY) = 3
ioctl(3, TCGETS, 0x7ffd75be5770)        = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0
read(3, "#!/bin/bash\n#\n# Copyright (c) 20"..., 80) = 80
lseek(3, 0, SEEK_SET)                   = 0
getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=1024*1024}) = 0
fcntl(255, F_GETFD)                     = -1 EBADF (Bad file descriptor)
dup2(3, 255)                            = 255
close(3)                                = 0
fcntl(255, F_SETFD, FD_CLOEXEC)         = 0
fcntl(255, F_GETFL)                     = 0x8000 (flags O_RDONLY|O_LARGEFILE)
fstat(255, {st_mode=S_IFREG|0755, st_size=2789, ...}) = 0
lseek(255, 0, SEEK_CUR)                 = 0
brk(0x1af0000)                          = 0x1af0000
brk(0x1af1000)                          = 0x1af1000
read(255, "#!/bin/bash\n#\n# Copyright (c) 20"..., 2789) = 2789
stat("/usr/local/libexec/singularity/functions", {st_mode=S_IFREG|0755, st_size=17310, ...}) = 0
open("/usr/local/libexec/singularity/functions", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=17310, ...}) = 0
brk(0x1af9000)                          = 0x1af9000
read(3, "#!/bin/bash\n#\n# Copyright (c) 20"..., 17310) = 17310
close(3)                                = 0
brk(0x1afa000)                          = 0x1afa000
brk(0x1afb000)                          = 0x1afb000
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
brk(0x1afc000)                          = 0x1afc000
...
brk(0x1b49000)                          = 0x1b49000
stat("/usr/local/libexec/singularity/cli/verify.info", {st_mode=S_IFREG|0644, st_size=733, ...}) = 0
open("/usr/local/libexec/singularity/cli/verify.info", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=733, ...}) = 0
read(3, "NAME=\"verify\"\nSECTION=\"managemen"..., 733) = 733
close(3)                                = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
write(1, "USAGE: singularity [...] verify "..., 74USAGE: singularity [...] verify <data object id/groupid> <container path>
) = 74
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
exit_group(0)                           = ?
+++ exited with 0 +++

Here are the files:

$ ls /usr/local/libexec/singularity/cli/verify*
/usr/local/libexec/singularity/cli/verify.exec  /usr/local/libexec/singularity/cli/verify.info

I did a quick Google search for the file, and it does appear that it existed at some point!
https://git.biohpc.swmed.edu/biohpc/singularity/commit/f645833eb11c845cbc32e1c18229353186cc38fa?expanded=1&w=1#0e6513b9094af510cd32ca30c526ea060ea18193
Likely the commit was cherry picked / cleaned up, or other, but I happen to still have the clone, for one reason or another.

@GodloveD
Copy link
Collaborator

OK. Seems like this was some kind of a weird snafu. I'm closing. 😄

@GodloveD GodloveD reopened this Dec 11, 2018
@GodloveD
Copy link
Collaborator

Oh whoops. There is more to this. re-opening. Don't mind me.

@hugobuddel
Copy link

First time singularity user here, following the quick start guide:

$ singularity pull library://sylabsed/linux/alpine

INFO:    Downloading library image
WARNING: unable to verify container: error while searching for signature blocks: no signatures found for system partition
This image is not signed, and thus its contents cannot be verified.
Do you with to proceed? [N/y] 

Can I trust this image? It seems that sylabsed is the official repository, so it should be trustworthy. But the container is not signed, and the default is to not proceed. So maybe the repository is compromised?

Probably everything is fine, but this being my first ever singularity command after singularity version, it is not clear what to expect. (Version is 3.2.1-1.el7.)

@GodloveD
Copy link
Collaborator

@hugobuddel yeah everything is likely OK. That warning is just telling you that the container has not been signed. Does not indicate that the library has been compromised or anything. Just means that Library admins did not sign the container after creation. Maybe it was just created from DockerHub and we did not feel confident signing it? Unsure.

@carterpeel
Copy link
Contributor

Hello,

This is a templated response that is being sent out to all open issues. We are working hard on 'rebuilding' the Singularity community, and a major task on the agenda is finding out what issues are still outstanding.

Please consider the following:

  1. Is this issue a duplicate, or has it been fixed/implemented since being added?
  2. Is the issue still relevant to the current state of Singularity's functionality?
  3. Would you like to continue discussing this issue or feature request?

Thanks,
Carter

@stale
Copy link

stale bot commented Jul 14, 2021

This issue has been automatically marked as stale because it has not had activity in over 60 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 14, 2021
@pedroalvesbatista
Copy link
Contributor

@vsoch @GodloveD Still getting this problem ? Have this been solved already ? If yes, what work around have you followed and applied ?

We're looking into the issue carefully, soon will bring to community and discuss ways to better solve as well address this. Thankyou for keeping the interest in the subject.

@stale stale bot removed the stale label Jul 15, 2021
@vsoch
Copy link
Collaborator Author

vsoch commented Jul 15, 2021

I think it’s probably unlikely that someone is still using 2.x AND using the verify command, so it’s probably safe to close this.

@kmuriki
Copy link
Collaborator

kmuriki commented Jun 6, 2023

Pending issues from the old repo copied to the new repo (apptainer/apptainer#1390) and cleaned from the old, retired repo.

@kmuriki kmuriki closed this as completed Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants