Hi,
I am linking the only solution that worked for me in a this situation when upgrading from 18.05 to 18.06 and I got stuck af step 5:
Credits go to @rahlquist
In short (my php version was 7.3)
/etc/php/7.3/cli/php.ini had -1 for memory limit, and it should stay that way
Returning the setting back to -1 this error went away.