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

Ran out of space while encrypting chroot, now it's half-encrypted and I can't get in #3990

Closed
TheAbstractPainter opened this issue Jan 23, 2019 · 4 comments

Comments

@TheAbstractPainter
Copy link

TheAbstractPainter commented Jan 23, 2019

name: xenial
encrypted: yes, locked

Please describe your issue:

I tried to encrypt my existing chroot (sudo edit-chroot -e) and it started out fine. But it was too large I guess, because my system ran out of space. Then, I got a bunch of error messages saying it had failed to remove various folders because they weren't empty.

Now, when try to enter the chroot (sudo startgnome) I still have no space on the machine, and I get a message saying it wants to continue encrypting, and gives me a list of things to do if I think this is unexpected. None of the options allows me to get into my chroot (the "no" is the closest option, but I get the message that the chroot "doesn't appear to be a valid chroot.")

I think my best option is to remove the encryption, take a bunch of files off the chroot (so I don't run out of space again), and then start again. But I can't find how to do that.

Is that even possible? Is there another solution?

I assumed it would encrypt the files in place, so that I wouldn't need a lot of empty space to complete the encryption. Maybe alternatively, I can plug in a usb drive and move it or something for the extra space?

If known, describe the steps to reproduce the issue:

@DennisLfromGA
Copy link
Collaborator

@TheAbstractPainter,

I would offload any large files in Downloads if you have any, then reboot.

Also, have you tried just getting into a shell session as root with:

  • sudo enter-chroot -u root -n xenial

If you can then you might be able to offload some files in the chroot, exit and try to encrypt it again.

Hope this helps,
-DennisLfromGA

@dnschneid
Copy link
Owner

You're going to have a hard time backing out of the encryption without any free space. My recommendations are:

  1. (best) Get a large enough USB stick or SD card, format it ext4, copy the chroot directory to it, finish encryption, copy it back to your SSD.
  2. (hacky) use the mount-chroot command to mount the encrypted directory to the shadow filesystem tree in /var/crouton, then explore it as root in the crosh shell so you can delete/move away already-encrypted large files you don't need. Files that haven't been encrypted yet can be removed from the chroots folder (you might get an error trying to delete them from the /var/run mount).

The encryption happens in-place chroot-wise, but each file gets temporarily duplicated (one at a time) as part of the encryption process. If you have a large file that needs to be encrypted you can run out of space.

@TheAbstractPainter
Copy link
Author

Thanks! I ended up using this method:
(best) Get a large enough USB stick or SD card, format it ext4, copy the chroot directory to it, finish encryption, copy it back to your SSD.

It took a bit of time to get everything done, but it's all working now, and I have about the same amount of free space as I started with (i.e. ~5.5GB). FYI, I don't think I have any files that big (maybe the biggest being ~3GB), so I suspect something in the process is using more than one file at a time. It might be helpful to check how much space is available and give a warning if it looks like there isn't enough.

Oh, one other thing, it took a bit of time to find where the chroot had been installed. In your documentation, it lists how to change the destination, but it doesn't say where the default is (e.g. in the cheat sheet and the readme.) It could be helpful to list the default location as well.

Anyway, thanks again! I was very happy I didn't lose my data!

@DennisLfromGA
Copy link
Collaborator

@TheAbstractPainter,

Great, glad that method worked.

It might be helpful to check how much space is available and give a warning if it looks like there isn't enough.

There is an old and outdated PR for 'Size tests' but it hasn't been reviewed lately or implemented -

In your documentation, it lists how to change the destination, but it doesn't say where the default is

True, I want to install the chroot to another location doesn't really say, it might be helpful.

FYI: If you run crouton without any options it wiil display the usage, there it talks about the '-p' option and the 'Default' location, see below:

  -p PREFIX   The root directory in which to install the bin and chroot
                subdirectories and data.
                Default: /usr/local, with /usr/local/chroots linked to
                /mnt/stateful_partition/crouton/chroots.

-DennisLfromGA

P.S. If you're satisfied this issue is resolved please close it or let us knowand we'll close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants