Terminal closes itself when building Android rom on v22.04 LTS

Asked by Sohrab Farahani

I recently installed version 22.04 of Ubuntu. I use Ubuntu mostly for building Android roms.
I prep the environment based on these:

installed packages:
sudo apt-get update && sudo apt-get install bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5 libncurses5-dev libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev

Beside the above packages I also install platform-tools, java, repo and I also configure git.

When I start building a rom and it doesn't matter what rom it is because I tried three different roms, just a couple of minutes after I run the build command the terminal (the stock one) closes itself without any errors or even a bug report popup, so I can't even know what the problem is and how to report it. I even tried with some other terminals but the result was the same. The only thing I can report is that it always happen in the beginning when it's running:
out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
I reverted back to Ubuntu 21.10 and with the same procedure everything is okay and this doesn't happen.
I just wanted to report this and ask if someone is experiencing the same issue.

Question information

English Edit question
Ubuntu Edit question
No assignee Edit question
Solved by:
Sohrab Farahani
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :

Maybe the out of memory killer.
Is there anything in the system logs (e.g. dmesg)?

The instructions in https://source.android.com/setup/build/initializing seem very much outdated to me, because they refer to Ubuntu release that are "end of life" and miss the currently supported Ubuntu releases.

Revision history for this message
actionparsnip (andrew-woodhead666) said :

Could also drop to TTY using CTRL + ALT + F1, log in there and retry

Revision history for this message
Sohrab Farahani (sohrab1985) said (last edit ):

Nothing that indicate any error in the system log.

Don't know if instruction is outdated or not but it's been working for me since Ubuntu 18.04 even on non LTS versions and as I mentioned before it works perfectly on Ubuntu 21.10.
For now I stay on 21.10 but I'll be trying again with 22.04 from time to time to see if it happens or not.

Revision history for this message
Ankit (dabad21) said :

I'm also facing the same issue.Installed Ubuntu 22.04 LTS yesterday and synced the android source code for LineageOS . After the "Brunch Beryllium" command , terminal closes just after some words having soong in common .Need a fix.

Revision history for this message
Sohrab Farahani (sohrab1985) said :

I wanted to try building again today but as @Ankit mentioned, it hasn't been fixed yet, so no reason to try it right now but I'll try in couple of weeks to see if it's fixed.
In meanwhile, I might try building rom on other flavors like Budgie or maybe on Ubuntu Kylin to see if I get the same result or not.

Revision history for this message
Sohrab Farahani (sohrab1985) said :

Okay I found out what causing this.
Ubuntu 22.04 comes with "systemd-oomd" enabled for improving low-memory which in our case it closes the terminal when building Android rom because of high memory usage and disabling it will fix the issue.

Here is how you can disable it:
systemctl disable --now systemd-oomd

To verify that the service is disabled run this:
systemctl is-enabled systemd-oomd

The output should be: