[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.

8 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&searchon=names&suite=all&section=all&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.