Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃摉 Suggestion: add a wiki page about Docker images #9174

Open
AltoRetrato opened this issue Jan 13, 2024 · 11 comments
Open

馃摉 Suggestion: add a wiki page about Docker images #9174

AltoRetrato opened this issue Jan 13, 2024 · 11 comments

Comments

@AltoRetrato
Copy link

Hi!

It seems that, because my Chromebook (Cyan) has reached its EOL, I'm having issues with Chromebrew compiled packages requiring a more recent version of libc (see #9136). I could try building packages from source, but doing that for many large packages on a puny chromebook is a daunting task that would take forever.

But I found out @satmandu 's chromeos_docker28 script to build a Docker image using a ChromeOS recovery file. It seems that I can use it to build chromebrew packages on my desktop PC and bring them later to the Chromebook... is that correct?

I'm still in the process of building the Docker image, so I'm not even sure if I'll get that step to work at all! I don't know about the other steps as well, but I'm sure other people would be interested in trying to do the same to be able to run more chromebrew packages on their systems.

I thought about creating a wiki page about the script to help others, but it might be redundant, incomplete or even inaccurate, so first I'd like to ask if someone else have more info to contribute to such page, and if @satmandu and others in the project agree about creating such wiki page. I'd be glad to format and test that information, maybe even include a list of publicly available Docker images to make it easier for most users to just run pre-built images instead of building their own.

All your suggestions and input are welcome!

Thanks!

@satmandu
Copy link
Member

My docker image scripts for running ChromeOS based Chromebrew containers are here:

https://gist.github.com/satmandu/d8365cb70b899901a05290d31c04909a

@AltoRetrato
Copy link
Author

My docker image scripts for running ChromeOS based Chromebrew containers are here:

https://gist.github.com/satmandu/d8365cb70b899901a05290d31c04909a

Thanks! I have found them before (and their respective images), but they are limited to only a few devices:

Do you think we can use chromeos_docker28 to build Docker images for all Chromebooks devices? I'm currently having issues building for Cyan on Ubuntu.

docker login -u altoretrato
export REPOSITORY="altoretrato"
./chromeos_docker28.sh https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_14816.131.0_cyan_recovery_stable-channel_mp-v3.bin.zip cyan 103 x86_64
[...]
This is the .bashrc
This is the .bashrc
CONTAINER_ARCH: x86-64
PASSTHROUGH_ARCH: x86_64
This is the .bash_profile
This is the .bashrc
fatal: not a git repository (or any of the parent directories): .git 
fatal: not a git repository (or any of the parent directories): .git 
fatal: not a git repository (or any of the parent directories): .git 
fatal: not a git repository (or any of the parent directories): .git 
/usr/local/bin/crew:647:in `system': Command failed with exit 128: git (RuntimeError)
           from /usr/local/bin/crew:647:in `block in update'
           from /usr/local/bin/crew:642:in `chdir'
           from /usr/local/bin/crew:642:in `update'
           from /usr/local/bin/crew:2028:in `update_command'
           from /usr/local/bin/crew:2046:in `<main>'

@satmandu
Copy link
Member

Do you think we can use chromeos_docker28 to build Docker images for all Chromebooks devices? I'm currently having issues building for Cyan on Ubuntu.

docker login -u altoretrato
export REPOSITORY="altoretrato"
./chromeos_docker28.sh https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_14816.131.0_cyan_recovery_stable-channel_mp-v3.bin.zip cyan 103 x86_64
[...]
This is the .bashrc
This is the .bashrc
CONTAINER_ARCH: x86-64
PASSTHROUGH_ARCH: x86_64
This is the .bash_profile
This is the .bashrc
fatal: not a git repository (or any of the parent directories): .git 
fatal: not a git repository (or any of the parent directories): .git 
fatal: not a git repository (or any of the parent directories): .git 
fatal: not a git repository (or any of the parent directories): .git 
/usr/local/bin/crew:647:in `system': Command failed with exit 128: git (RuntimeError)
           from /usr/local/bin/crew:647:in `block in update'
           from /usr/local/bin/crew:642:in `chdir'
           from /usr/local/bin/crew:642:in `update'
           from /usr/local/bin/crew:2028:in `update_command'
           from /usr/local/bin/crew:2046:in `<main>'

Hmm. I haven't tested it on M103 in a while.

Maybe invoke the script with bash -x ./chromeos_docker28.sh to see what's going on?

You can also create a x86_64 subfolder, and put install.sh into there named install.sh.test to have the chromeos_docker28 use that... And then you can play with that install.sh.test script (add set -x, etc) to see what's going on...

@Zopolis4
Copy link
Collaborator

I'm working on revamping @satmandu's script over at zopolis4/chromeos-docker, and I'm also encountering the fatal: not a git repository (or any of the parent directories): .git issue.

@Zopolis4
Copy link
Collaborator

Zopolis4 commented Jan 16, 2024

almost immediately after writing this, the issue ceased to exist! Once I wrap some things up, I'll upload the cyan image you were working on to my docker hub.

or maybe the issue only exists some of the time, unclear

@Zopolis4
Copy link
Collaborator

docker run --platform linux/amd64 --rm -it zopolis4/crewbuild:cyan.m103 /bin/bash

should have what you're looking for

@AltoRetrato
Copy link
Author

Thanks, @Zopolis4 ! 馃槂

I still have the same issue as before (using @satmandu 's script). One thing changed, though: when I tested a few days ago, the image was uploaded to Docker Hub as "altoretrato / crewbase", but now it went to "altoretrato / crewbuild".

The issue happens when crewbuild-cyan-x86_64.m103.sh is invoked:

+ docker run --platform linux/amd64 --rm --net=host -e DISPLAY=:0 -v /tmp/.X11-unix:/tmp/.X11-unix -e LOCALRC= -v /home/ric/crew/pkg_cache:/usr/local/tmp/packages -v /home/ric/crew:/output -h ric-VirtualBox-x86_64 -it altoretrato/crewbuild:cyan-x86_64.m103
This is the .bashrc
This is the .bashrc
CONTAINER_ARCH: x86-64
PASSTHROUGH_ARCH: x86_64
This is the .bash_profile
This is the .bashrc
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
/usr/local/bin/crew:647:in `system': Command failed with exit 128: git (RuntimeError)
	from /usr/local/bin/crew:647:in `block in update'
	from /usr/local/bin/crew:642:in `chdir'
	from /usr/local/bin/crew:642:in `update'
	from /usr/local/bin/crew:2020:in `update_command'
	from /usr/local/bin/crew:2046:in `<main>'

Then I tried your script, but it also failed:

$ bash -x ./chromeos_docker.sh cyan 103
       name: cyan
  milestone: 103
 REPOSITORY: altoretrato
Cached image not found for 14816.131.0_cyan
+ curl --progress-bar --retry 3 -Lf https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_14816.131.0_cyan_recovery_stable-channel_mp-v3.bin.zip -o 14816.131.0_cyan.zip
################################################################################################## 100,0%
+ 7z x 14816.131.0_cyan.zip -so
+ 7z x 14816.131.0_cyan.bin 2.ROOT-A.img

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=pt_BR.UTF-8,Utf16=on,HugeFiles=on,64 bits,2 CPUs 13th Gen Intel(R) Core(TM) i5-13600K (B0671),ASM,AES-NI)

Scanning the drive for archives:
1 file, 2320229376 bytes (2213 MiB)

Extracting archive: 14816.131.0_cyan.bin
--
Path = 14816.131.0_cyan.bin
Type = GPT
Physical Size = 2320229376
ID = DCBD428D-C6B8-E547-A22E-B92E5ECD8384


No files to process
Everything is Ok

Files: 0
Size:       0
Compressed: 2320229376
+ 7z x -snld 2.ROOT-A.img -o14816.131.0_cyan


Command Line Error:
Incorrect switch postfix:
-snld
+ cd 14816.131.0_cyan
./chromeos_docker.sh: line 30: cd: 14816.131.0_cyan: No such file or directory
+ rm -f 14816.131.0_cyan.zip 14816.131.0_cyan.bin 2.ROOT-A.img
+ rm -rf 14816.131.0_cyan
+ docker import 14816.131.0_cyan.tar --platform linux/amd64 altoretrato/crewbase:cyan.m103
open 14816.131.0_cyan.tar: no such file or directory
+ docker push altoretrato/crewbase:cyan.m103
The push refers to repository [docker.io/altoretrato/crewbase]
tag does not exist: altoretrato/crewbase:cyan.m103
+ build_docker_image
+ name=cyan
+ milestone=103
+ REPOSITORY=altoretrato
+ CREW_KERNEL_VERSION=3.18
+ envsubst '$name $milestone $REPOSITORY $CREW_KERNEL_VERSION'
+ docker buildx create --name builder --driver docker-container --use
ERROR: existing instance for "builder" but no append mode, specify --node to make changes for existing instances
+ docker buildx build --push --platform linux/amd64 --tag altoretrato/crewbuild:cyan.m103 .
[+] Building 1.8s (3/3) FINISHED                                                docker-container:builder
 => [internal] load build definition from Dockerfile                                                0.1s
 => => transferring dockerfile: 622B                                                                0.1s
 => ERROR [internal] load metadata for docker.io/altoretrato/crewbase:cyan.m103                     1.6s
 => [auth] altoretrato/crewbase:pull token for registry-1.docker.io                                 0.0s
------
 > [internal] load metadata for docker.io/altoretrato/crewbase:cyan.m103:
------
Dockerfile:2
--------------------
   1 |     # Use the previously created filesystem as a base
   2 | >>> FROM altoretrato/crewbase:cyan.m103
   3 |     # Pass the kernel version that would be present on the original board through
   4 |     ENV CREW_KERNEL_VERSION=3.18
--------------------
ERROR: failed to solve: altoretrato/crewbase:cyan.m103: docker.io/altoretrato/crewbase:cyan.m103: not found
+ rm -f Dockerfile

It would be useful if the script didn't automatically removed files need to be downloaded (or built) again, like the recovery image, since simple issues (e.g., missing 7z) might lead to script termination and require it to be run again...

@AltoRetrato
Copy link
Author

docker run --platform linux/amd64 --rm -it zopolis4/crewbuild:cyan.m103 /bin/bash

should have what you're looking for

Awesome! 馃槃 Thank you so much! I'm already running it! 鉂わ笍

Now all I need to know is how can I transfer the packages from the container to the Chromebook. Any tips?

@Zopolis4
Copy link
Collaborator

something like so:

docker run --platform linux/amd64 -v $(pwd)/pkg_cache:/usr/local/tmp/packages --rm -it zopolis4/crewbuild:cyan.m103 /bin/bash
# once in the container
cd /usr/local/tmp/packages
crew build <package>

the built package files should appear in a pkg_cache folder in the directory where you ran the docker command

@AltoRetrato
Copy link
Author

Thanks again!

And finally... what would it take for Chromebrew to support older ChromeOS versions OOTB, so crew could install binaries compatible with the installed libc version?

@Zopolis4
Copy link
Collaborator

You'd have to ask satmandu on that one, he knows the most about the way we handle glibc. I've got plans to look into this, but it may be quite some time before I get around to those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants