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

lxc-create fails to create a -B loop container #845

Closed
dann1 opened this issue Feb 24, 2016 · 7 comments
Closed

lxc-create fails to create a -B loop container #845

dann1 opened this issue Feb 24, 2016 · 7 comments

Comments

@dann1
Copy link

dann1 commented Feb 24, 2016

Hello I tried to create a loop container and I typed "lxc-create -n name -t ubuntu -B loop" it fails to create the container but I tried to start a loop container I created using lxc on debian jessie and it works perfect, so the problem is just to create loop containers in ubuntu 14.04, any ideas? Thank you

@hallyn
Copy link
Member

hallyn commented Feb 24, 2016 via email

@dann1
Copy link
Author

dann1 commented Feb 26, 2016

root@ubuntu5:/home/ubuntu5# MIRROR=http://10.8.91.175/Soft_Linux/Repos/ubuntu/trusty lxc-create -t ubuntu -n fail -B loop
lxc-create: bdev.c: do_loop_create: 2028 Error creating filesystem type ext3 on /var/lib/lxc/fail/rootdev
lxc-create: lxccontainer.c: do_bdev_create: 936 Failed to create backing store type loop
lxc-create: lxccontainer.c: do_lxcapi_create: 1419 Error creating backing store type loop for fail
lxc-create: lxc_create.c: main: 274 Error creating container fail

I defined my mirror address because I dont't use the internet defined mirror in the ubuntu template

@englebert
Copy link

I found a fix. It just need to put a "-F" into the execlp.

# git diff
diff --git a/src/lxc/bdev/bdev.c b/src/lxc/bdev/bdev.c
index 090b685..955ab1b 100644
--- a/src/lxc/bdev/bdev.c
+++ b/src/lxc/bdev/bdev.c
@@ -721,7 +721,7 @@ int do_mkfs(const char *path, const char *fstype)
        // us about whether to proceed.
        if (null_stdfds() < 0)
                exit(1);
-       execlp("mkfs", "mkfs", "-t", fstype, path, (char *)NULL);
+       execlp("mkfs", "mkfs", "-F", "-t", fstype, path, (char *)NULL);
        exit(1);
 }

@englebert
Copy link

I wish to commit the changes, may i know how to help on this please?
I had tested on my production environment and it works great.

englebert added a commit to englebert/lxc that referenced this issue Mar 25, 2016
@hallyn
Copy link
Member

hallyn commented Mar 30, 2016

On Thu, Mar 24, 2016 at 09:18:37PM -0700, englebert wrote:

I found a fix. It just need to put a "-F" into the execlp.

git diff

diff --git a/src/lxc/bdev/bdev.c b/src/lxc/bdev/bdev.c
index 090b685..955ab1b 100644
--- a/src/lxc/bdev/bdev.c
+++ b/src/lxc/bdev/bdev.c
@@ -721,7 +721,7 @@ int do_mkfs(const char *path, const char *fstype)
// us about whether to proceed.
if (null_stdfds() < 0)
exit(1);

  •   execlp("mkfs", "mkfs", "-t", fstype, path, (char *)NULL);
    
  •   execlp("mkfs", "mkfs", "-F", "-t", fstype, path, (char *)NULL);
    

This is not an mkfs option. it is an mkfs.ext option. For instance

mkfs.-t xfs -F xxx

fails. So you'll need to tweak the patch to only do this for
filessytems which need the flag.

    exit(1);

}


You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#845 (comment)

@hallyn
Copy link
Member

hallyn commented Mar 30, 2016

On Thu, Mar 24, 2016 at 09:35:53PM -0700, englebert wrote:

I wish to commit the changes, may i know how to help on this please?

Make the change in your github.com/englebert/lxc tree (make the change
locally, then 'git push git+ssh://git@github.com/englebert/lxc master:mkfs'),
then load up github.com/lxc/lxc and near the top of the page you should an
option to start a pull request for your branch.

@englebert
Copy link

Thanks Hallyn.

@dann1 dann1 closed this as completed Jan 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants