Exhibit 23.1

Consent of Independent Registered Public Accounting Firm

Greif 401(k) Retirement Plan
Delaware, Ohio

We hereby consent to the incorporation by reference in the Registration Statement on Form S-8 (333-35048) of Greif, Inc. of our report dated June 5, 2025, relating to the financial statements and supplemental schedule of the Greif 401(k) Retirement Plan which appear in this Form 11-K for the year ended December 31, 2024.

/s/ GBQ Partners LLC
Columbus, Ohio
June 5, 2025