apptainer / singularity

Singularity has been renamed to Apptainer as part of us moving the project to the Linux Foundation. This repo has been persisted as a snapshot right before the changes.
https://github.com/apptainer/apptainer
Other
2.53k stars 424 forks source link

singularity expand: incorrect(?) error message when using non-existing image file #385

Closed HenrikBengtsson closed 7 years ago

HenrikBengtsson commented 7 years ago

Is the following error message the intended one:

$ sudo singularity expand --size 2048 non-existing-file.img
ERROR: Image file exists, not overwriting.
$ singularity --version
2.2
$ uname -a
Linux hb-x1 4.4.0-51-generic #72-Ubuntu SMP Thu Nov 24 18:29:54 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

PS. I've only been a Singularity user since a few hours but already extremely impressed. Thxs.

gmkurtzer commented 7 years ago

Whoa, weird! Are you running from master, or the 2.2 released version?

Thanks!

HenrikBengtsson commented 7 years ago

From the 2.2 release following instructions at http://singularity.lbl.gov/install-linux, i.e. not from git clone.

gmkurtzer commented 7 years ago

Oh gosh.. I can't believe that got into the release and nobody else has made a bug report about it!..

Just to be sure, can you send me the output of this command (adding -x):

$ sudo singularity -x expand --size 2048 non-existing-file.img

Thanks!

HenrikBengtsson commented 7 years ago

No worries, I'm known to be a bug whisperer - it literally happens to anything I touch whenever I need to get real things done ;)

sudo singularity -x expand --size 2048 non-existing-file.img
[sudo] password for hb: 
+ PATH=/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ IMAGE_SIZE=512
+ true
+ case ${1:-} in
+ shift
+ IMAGE_SIZE=2048
+ shift
+ true
+ case ${1:-} in
+ break
+ '[' -z non-existing-file.img ']'
+ '[' 0 '!=' 0 ']'
+ SINGULARITY_IMAGE=non-existing-file.img
+ SINGULARITY_WRITABLE=1
+ export SINGULARITY_IMAGE SINGULARITY_WRITABLE
+ '[' -z non-existing-file.img ']'
+ '[' '!' -f non-existing-file.img ']'
+ message ERROR 'Image file exists, not overwriting.\n'
+ LEVEL=ERROR
+ MESSAGE='Image file exists, not overwriting.\n'
+ '[' -z 'Image file exists, not overwriting.\n' ']'
+ shift
+ shift
+ case "$LEVEL" in
+ tput -Txterm setaf 1
+ printf 'ERROR: Image file exists, not overwriting.\n'
ERROR: Image file exists, not overwriting.
+ tput -Txterm sgr0
+ return 0
+ exit 1
gmkurtzer commented 7 years ago

Embarassingly enough, I don't have a GA 2.2 version installed anywhere. I can do a cleanup and reinstall soon, but the GitHub master branch does this:

$ sudo singularity expand --size 10 /tmp/Centos7-ompi.img 
Expanding existing image with a size of 10MiB...
Executing image expand helper
Checking image (/sbin/mkfs.ext3)
e2fsck 1.42.9 (28-Dec-2013)
Growing file system
resize2fs 1.42.9 (28-Dec-2013)
Done.
[gmk@centos7-x64 ~]$ 
HenrikBengtsson commented 7 years ago

So, it works with an existing image file - so no problem there. It's when you specify a non-existing file. I only discovered it due to a cut'n'paste typo. So no big deal.

gmkurtzer commented 7 years ago

OHHHHHHH! That makes sense now... Fixed, thanks!

HenrikBengtsson commented 7 years ago

Thanks (from Caffe Strada)

gmkurtzer commented 7 years ago

Hahaha, nice!