[HOWTO] An unofficial / e / ROM built with Docker – in pictures

Two days back I formatted my PC and had to re installed Ubuntu. After ensuring Ubuntu was up to date I had to install Docker . Thought I might as well document the steps as a number of our users have asked about this on the forum. I also thought of taking some screenshots in case it helps.

Step 1. Setting up the build environment
In short you need a lot of ROM and hard disk space. It will be easier for me to show the specs of my PC

As you can see it is an i5 ( 5 yrs old). I have a 1 Tb hdd ( almost empty at present) + 16 GB RAM.
Keep aside at least 200 GB of build space

Step 2 : On your PC you need Docker to be running normally

I followed the instructions given at the Docker website and specifically on the Ubuntu page … https://docs.docker.com/install/linux/docker-ce/ubuntu/

I have added the instructions I ran to install Docker from their website and give them here. I copy paste the commands to save time and not make mistakes.

  • Setting up the ubuntu repository

    a. Update the apt package index:
    $ sudo apt-get update

    b. Install packages to allow apt to use a repository over HTTPS:
    $ sudo apt-get install
    apt-transport-https
    ca-certificates
    curl
    gnupg-agent
    software-properties-common

    c. Add Docker’s official GPG key:
    $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.
    $ sudo apt-key fingerprint 0EBFCD88
    running this command will display something like this

     pub   rsa4096 2017-02-22 [SCEA]
           9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
     uid           [ unknown] Docker Release (CE deb) <docker@docker.com>
     sub   rsa4096 2017-02-22 [S]
    

    d. Use the following command to set up the stable repository ( I choose the option for x86_64/amd64 the first option )

        $ sudo add-apt-repository \
       "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
      $(lsb_release -cs) \
     stable"
    

    e. Install Docker CE

    a. Update the apt package index.

    $ sudo apt-get update
    

    b. Install the latest version of Docker CE and container:

    $ sudo apt-get install docker-ce docker-ce-cli containerd.io

f. Verify that Docker CE is installed correctly by running the hello-world image.

 $ sudo docker run hello-world

 This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

g. At this point if you get an error of access denied it maybe because your user does not have access to run Docker

 A sample of the error that appears on the screen - missed getting a screenshot . so copied the error from the net :) 


 docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.26/containers/create: dial unix /var/run/docker.sock: connect: permission denied.

  To resolve this i ran this command

  sudo usermod -a -G docker $USER 

Step 3 . Getting the latest docker image for /e/ . You will run this command as given on wiki . Please note every time you run a build it is a good idea to run this command to ensure you have the latest image on your PC. A mismatch between this image and the one on the server can cause interesting errors in your build :frowning: Also the build command does not pull down the latest in case you are looking at the last line of the command)

sudo docker pull registry.gitlab.e.foundation:5000/e/os/docker-lineage-cicd:latest

Step 4. Once this step is complete create the folder structure required for the build. I created a folder under my home / username / e check the screenshot below. You can see a folder named e there.

Step 5. Inside this e folder create sub folders . You can do this all with console command but I am from the world of Windows GUI and like to take the easy way out. It is also easier to explain :slight_smile: Do not make any spelling mistakes …for example cache instead of ccache can create build issues. Docker is very particular that way :frowning:

Step 6. Now you can start the syncing of the e source code

Run the command in a console as described in the wiki
There are two changes you need to make . One is the device name of the device you want to build and the second is the branch name. Oreo or nougat/

Now your console will look like this

This phase will take a lot of time. It all depends on your internet speed. For me it took 6 hours and that was fast. I have had this screen for a full day as well. The build process pulls down all the source code for building /e/ . It could be more than a 100GB of files in the end so it will take time. 

Step 7. The build starts.

  When the build starts the screen looks like this 

   Again at this point the screen will appear stuck. This is because Docker does not want to trouble you with the nitty-gritty of the heavy work that is happening behind the back. You can check this out by having a look at the log files.  There will be two log files inside the log folder. The file named repoxxx has the details of what has been pulled down from the various servers. There will be a folder created inside the log folder with the name of the device you are building for. Inside there will be a log giving details of the build as it progresses. The build process will be writing to this file so try not to keep it open to examine. You can take a copy aside to examine. 

Step 8. The build finished successfully.

When the build finishes successfully the screen looks like this.

Here you will notice the last three lines mention about what happened to the build. In this case it was successful. You will now find the build in the zip folder.
In case the build fails the message will mention that. Build failed but still clean up the OUT folders ( the folder in which the build is cooked).

The purpose of this post is to share the snapshots of the screen while the build is running just in case you are attempting a build and wondering what Docker is up to. I learnt this the hard way and may have missed a step. Feel free to let me know in there are errors in this post.
Please note : This method work perfectly for Lineage supported devices only.

9 Likes

good work, thanks for the howto

Love it, thank you.
Worked fine in Debian too, package available I used for my first build (don’t do this on Ubuntu, search at Ubuntu itself):
https://packages.debian.org/search?keywords=docker&amp;searchon=names&amp;suite=all&amp;section=all&amp;sourceid=mozilla-search
And a screenshot from https://docs.docker.com/install/
Screenshot%20at%202019-02-14%2016-41-44
about support in different Gnu-Linux distributions.

Thank you for this tutorial.

Im using this script on ubuntu to install docker in faster way https://get.docker.com/ just open terminal and type this comands :
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh

2 Likes

Hello, I tried to build the /e/ ROM by following the information in your documentation (https://doc.e.foundation/how-tos/build-e).

Unfortunately, I didn’t manage to run the docker image. I used this command line:

sudo docker run
-v “/srv/e/src:/srv/src:delegated”
-v “/srv/e/zips:/srv/zips:delegated”
-v “/srv/e/logs:/srv/logs:delegated”
-v “/srv/e/ccache:/srv/ccache:delegated”
-e “BRANCH_NAME=v1-nougat”
-e “DEVICE_LIST=kiwi”
-e “CUSTOM_PACKAGES=‘MuPDF GmsCore GsfProxy FakeStore com.google.android.maps.jar Mail BlissLauncher BlissIconPack MozillaNlpBackend OpenWeatherMapWeatherProvider AccountManager MagicEarth OpenCamera eDrive Weather Notes Tasks NominatimNlpBackend Light DroidGuard OpenKeychain Message Browser BrowserWebView Apps LibreOfficeViewer’”
-e “SIGNATURE_SPOOFING=restricted”
-e “OTA_URL=https://ota.ecloud.global/api”
-e “REPO=https://gitlab.e.foundation/e/os/android.git”
registry.gitlab.e.foundation:5000/e/os/docker-lineage-cicd:latest

I have the following error:

[ 4% 2422/50023] target Java: org.cyanogenmod.platform.sdk (/srv/src/NOUGAT/out/target/common/obj/JAVA_LIBRARIES/org.cyanogenmod.platform.sdk_intermediates/classes)
FAILED: /bin/bash -c "(rm -f […] )
[…]
javac: file not found: /srv/src/NOUGAT/out/target/common/obj/APPS/org.cyanogenmod.platform-res_intermediates/src/cyanogenmod/platform/Manifest.java
Usage: javac
use -help for a list of possible options
ninja: build stopped: subcommand failed.
build/core/ninja.mk:151: recipe for target ‘ninja_wrapper’ failed
make: *** [ninja_wrapper] Error 1
make: Leaving directory ‘/srv/src/NOUGAT’

make failed to build some targets (18:56 (mm:ss))

[Mon Oct 21 09:53:19 UTC 2019] Failed build for kiwi
[Mon Oct 21 09:53:19 UTC 2019] Finishing build for kiwi
[Mon Oct 21 09:53:19 UTC 2019] Cleaning source dir for device kiwi

Could you please help me fix this issue ?

Thanks in advance.

Update:

There were some complaints from users that the latest Docker build commands do not work.

To test this I tried out the same commands and it worked perfectly on the very first attempt!!
To be honest I expected a crash as I have a 6 year old PC which has some attitude issues.

All the same the build was successful and I share details of the commands I ran.

  • I downloaded the latest docker image.

    There was a recent change in the Docker image so first of all those of you who used to build or have tried to build the /e/OS ROM using Docker should delete the previous image

  • The command to delete Docker images are given here

    • Delete all images

      docker rmi $(docker images -q)

    • Show all images ( if you want to delete the image by its ID)

      docker image ls

    • Remove image by id ( assuming 75f08d5b848d is the image Id)

      docker rmi 75f08d5b848d

  • Now run the command to pull the latest Docker image as given here

  • This is how the image pull will appear on your Console

  • I created the folder structure - as described in step 3 here - for the Docker build in my home directory. The build and source code will require more than 100 GB space… i will check and update the exact space it takes on my HDD … it looks like this

  • The build command - step 4 - changes for me because of my local folder structure and looks like this

docker run \
-v "/home/manoj/e/src:/srv/src" \
-v "/home/manoj/e/zips:/srv/zips" \
-v "/home/manoj/e/logs:/srv/logs" \
-v "/home/manoj/e/ccache:/srv/ccache" \
-e "BRANCH_NAME=v1-pie" \
-e "DEVICE_LIST=a3xelte" \
-e "OTA_URL=" \
-e "REPO=https://gitlab.e.foundation/e/os/android.git" \
registry.gitlab.e.foundation:5000/e/os/docker-lineage-cicd:community

Note I change the following :

  • DEVICE_LIST = added the device code of the device I want to build for
  • OTA_URL = kept it blank as I do not provide any OTA builds
  • BRANCH_NAME = wanted it to point to the pie code

This is how the build looks once it starts running

At this point it looks like the PC has crashed or at least gone to sleep :slight_smile:
You can check what is happening by looking at the logs which will be available in the log folder you created above

  • What happens now depends on your internet speed . There is a lot of files to download. A minimum of 100 GB will be downloaded so it helps if you have a reasonably good download speed
  • Finally when all the files are downloaded the build starts . Now the screen will look like this

OS used : Ubuntu 20.04 LTS
RAM : 16 Gb
HDD : 1 Tb

1 Like

this is only working in ‘community’ image. On ‘latest’ image you have change to DEVICE only and remove OTA line

The ‘latest’ image is no longer to be used. The ‘community’ image is the one that is to be used for Docker.

Ah, OK, that’s why my tries yesterday where failing :frowning:

You can also cleanup Docker (no container running) with : docker system prune -a
Then check with docker system df -v

Test build for a3exlte on Ubuntu 18.04.4 LTS ok :slight_smile:

But builds still fail for Xiaomi devices (tested chiron, santoni, polaris).
Updated issue #1185

This is why Xiaomi devices will not work with Docker now. This ban has been in place for almost a year now. For Xiaomi devices you will have to extract the blobs and then run the builds. Never tried that on Docker but it works on the repo sync way.

I think the problem is the naming. Lineage uses this repo. You can see the build error: build/core/product_config.mk:249: *** Can not locate config makefile for product "lineage_suzuran". Stop. build/core/product_config.mk:249: *** Can not locate config makefile for product "cm_suzuran". Stop. build/core/product_config.mk:249: *** Can not locate config makefile for product "lineage_suzuran". Stop. The build system does not look for PRODUCT_NAME := full_suzuran. Don’t know why Lineage uses that naming.

Thank you. I should have known to look at the start of the logfile rather than the end :slight_smile:
I should be able to do some digging and find out what needs to change

you have 2 posts about the same issue. Pls compress to one, because It’s worst to answer.
And in a HowTo it’s not so good located.
thx

by the way, I have answered on your other post

Problem with Xiaomi building is solved, commented & closed case #1185.

Currently forking Muppets GitLab repo as https://gitlab.com/smu44/proprietary_vendor_xiaomi/ for backup (couldn’t mirror, unfortunately).

All Xiaomi vendor sources are available at gitlab/the-muppets

That’s what I wrote in the issue’s comment :wink:
I made a backup just in case of DMCA, but many have already done the same :slight_smile:

Haven’t had a look on it. And yeah, I also have done a backup :blush:

So is this an unofficial build for a SUPPORTED device?

It would be easier to understand if you had listed all the pre-requistes.

Even better you could have updated the WIKI rather than linking to it.

Duplication simply leads to new users like me having to read more sources of documentation, which inevitably get out of sync.