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

Improve fs-resize, fix delay and simplify #2993

Merged
merged 3 commits into from Nov 4, 2018

Conversation

@mglae
Copy link
Contributor

commented Sep 21, 2018

fs-resize running at early boot time may need minutes to complete because the kernel RNG is not initialized.

When parted and sgdisk call uuid_generate(), util-linux libuuid implementation use a blocking getrandom() syscall. It waits until the kernel crng has collected enough entropy. Having a SSD, no network, no user input and no HW RNG this can take a long time. The behavior explains the delay seen in #2957.

This is fixed in util-linux 2.32:

commit a9cf659e0508c1f56813a7d74c64f67bbc962538
Author: Carlo Caione <carlo@endlessm.com>
Date:   Mon Mar 19 10:31:07 2018 +0000

    lib/randutils: Do not block on getrandom()
    
    In Endless we have hit a problem when using 'sfdisk' on the really first
    boot to automatically expand the rootfs partition. On this platform
    'sfdisk' is blocking on getrandom() because not enough random bytes are
    available. This is an ARM platform without a hwrng.
    
    We fix this passing GRND_NONBLOCK to getrandom(). 'sfdisk' will use the
    best entropy it has available and fallback only as necessary.
    
    Signed-off-by: Carlo Caione <carlo@endlessm.com>

Using parted's 3.2 'resizepart' command removes the partition recreation hack.

@mglae mglae force-pushed the mglae:le9_fsresize branch from 26d1b16 to a9f4128 Sep 21, 2018

fi

StartProgress spinner "Resizing partition... " "parted -s -m $DISK resizepart 2 100% &>/dev/null"
StartProgress spinner "Checking /storage... " "e2fsck -f -p $PART &>/dev/null"

This comment has been minimized.

Copy link
@MilhouseVH

MilhouseVH Sep 22, 2018

Contributor

Might as well make this one Checking file system... " to be consistent?

Cosmetic nit: Would it be possible to vertically align the spinner outputs (add extra spaces after ... where necessary)?

Thanks for this, certainly is simplified, but will need thorough testing! :)

This comment has been minimized.

Copy link
@mglae

mglae Sep 22, 2018

Author Contributor

Looks better now :)

@mglae mglae force-pushed the mglae:le9_fsresize branch from a9f4128 to 87134eb Sep 22, 2018

@mglae

This comment has been minimized.

Copy link
Contributor Author

commented Sep 22, 2018

I've tested on generic only. To look for anomalies better use the fs-resize debug version.

@MilhouseVH

This comment has been minimized.

Copy link
Contributor

commented Oct 23, 2018

After #3035 this now requires a rebase.

@mglae mglae force-pushed the mglae:le9_fsresize branch from 87134eb to 435906c Oct 23, 2018

@mglae mglae force-pushed the mglae:le9_fsresize branch from 435906c to 7c9ba8e Oct 23, 2018

@MilhouseVH MilhouseVH merged commit 1f7d6fe into LibreELEC:master Nov 4, 2018

@mglae mglae deleted the mglae:le9_fsresize branch Nov 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.