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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile for Ubuntu 24.04 #80

Merged
merged 2 commits into from
Sep 28, 2024
Merged

Conversation

satmandu
Copy link
Contributor

closes: #78

This also adds to the changes in #79 by removing the i386 multiarch stuff that isn't available in current Ubuntu releases while also updating the openjdk, gradle, and kotlin versions.

@thyrlian
Copy link
Owner

First of all, a big thanks to @satmandu!

Sencondly, I'd prefer to split the upgrade of other tools/dependencies into a different PR, to keep it safe (in terms of troubleshooting) and organized.

The biggest change here, apart from the Ubuntu base image change, is the removal of i386 architecture support. The reason of including it was to support 32-bit tools. I remember that, back in time, quite some Android SDK tools (command-line binaries) were compiled as 32-bit. Now it's getting better, many components of the Android SDK have transitioned to 64-bit, but I'll need to double check if any remainings are still 32-bit.

@thyrlian
Copy link
Owner

Just downloaded a fresh copy of Android SDK (commandlinetools-linux-11076708_latest.zip), and checked with below command:
find cmdline-tools -type f -exec file {} + | grep '32-bit'
It looks good so far, no 32-bit binary found in the bare-minimum Android SDK package.
I'll take a further look into the extended big Android SDK package and share the results here.

@thyrlian
Copy link
Owner

As a proof that the command is working:
find . -type f -exec file {} + | grep '32-bit'

Executed this command in the $ANDROID_HOME from thyrlian/android-sdk:2.0 image, and it found some 32-bits executables:

./tools/mksdcard:                                                                                                                                                            ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=119b9b83c17fa0228acfd582e951ea8b050e1229, not stripped
./tools/lib/monitor-x86/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.200.v20120913-144807/eclipse_1502.so:                                                         ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped
./tools/lib/monitor-x86/libcairo-swt.so:                                                                                                                                     ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped
./tools/lib/monitor-x86/monitor:                                                                                                                                             ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.2.5, not stripped

@thyrlian
Copy link
Owner

I couldn't find any explicit statement from Google confirming a complete transition to 64-bit tools. I remember that the emulator tool and some functions previously required 32-bit support. I'll check if that's still the case, along with a few other major tools and packages that aren't included in the default SDK zip file.

@thyrlian
Copy link
Owner

I have installed below tools/packages:

sdkmanager --list_installed
[=======================================] 100% Fetch remote repository...       
Installed packages:
  Path                                                                              | Version | Description                                | Location                                                                         
  -------                                                                           | ------- | -------                                    | -------                                                                          
  build-tools;35.0.0                                                                | 35.0.0  | Android SDK Build-Tools 35                 | build-tools/35.0.0                                                               
  emulator                                                                          | 34.2.16 | Android Emulator                           | emulator                                                                         
  extras;android;m2repository                                                       | 47.0.0  | Android Support Repository                 | extras/android/m2repository                                                      
  extras;google;google_play_services                                                | 49      | Google Play services                       | extras/google/google_play_services                                               
  extras;google;instantapps                                                         | 1.9.0   | Google Play Instant Development SDK        | extras/google/instantapps                                                        
  extras;google;m2repository                                                        | 58      | Google Repository                          | extras/google/m2repository                                                       
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2 | 1       | Solver for ConstraintLayout 1.0.2          | extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.2
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2        | 1       | ConstraintLayout for Android 1.0.2         | extras/m2repository/com/android/support/constraint/constraint-layout/1.0.2       
  platform-tools                                                                    | 35.0.1  | Android SDK Platform-Tools                 | platform-tools                                                                   
  platforms;android-35                                                              | 1       | Android SDK Platform 35                    | platforms/android-35                                                             
  system-images;android-35;google_apis;arm64-v8a                                    | 7       | Google APIs ARM 64 v8a System Image        | system-images/android-35/google_apis/arm64-v8a                                   
  system-images;android-35;google_apis;x86_64                                       | 7       | Google APIs Intel x86_64 Atom System Image | system-images/android-35/google_apis/x86_64                            

And then I checked those executables:

# Input
apt-get update && apt-get install -y file
find . -type f -exec file {} + | grep '32-bit'

# Output
./build-tools/35.0.0/renderscript/lib/blas/armeabi-v7a/libblasV8.so:                                                                                                           ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[md5/uuid]=504954468547c529aa6f64fe6d73f557, stripped
./build-tools/35.0.0/renderscript/lib/blas/x86/libblasV8.so:                                                                                                                   ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[md5/uuid]=dffe3ff152f24ec58f0b2cfd85e79a90, stripped
./build-tools/35.0.0/renderscript/lib/packaged/armeabi-v7a/libRSSupport.so:                                                                                                    ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[md5/uuid]=b21cdeeafcc117a5d0c1dd686f88690a, stripped
./build-tools/35.0.0/renderscript/lib/packaged/armeabi-v7a/librsjni_androidx.so:                                                                                               ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[md5/uuid]=73fd493eb10ccb74d82cfcda4a4f1c91, stripped
./build-tools/35.0.0/renderscript/lib/packaged/armeabi-v7a/librsjni.so:                                                                                                        ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[md5/uuid]=b23c23135fbe112c85fa7a7f808fcca2, stripped
./build-tools/35.0.0/renderscript/lib/packaged/x86/libRSSupport.so:                                                                                                            ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[md5/uuid]=620efa41ed90dc1f0d304a8f6d9e3efa, stripped
./build-tools/35.0.0/renderscript/lib/packaged/x86/librsjni_androidx.so:                                                                                                       ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[md5/uuid]=78069a723d44158b736d7409f79a4f32, stripped
./build-tools/35.0.0/renderscript/lib/packaged/x86/librsjni.so:                                                                                                                ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[md5/uuid]=48a25a3b2511323f6ab34303515c2963, stripped
./build-tools/35.0.0/renderscript/lib/intermediates/armeabi-v7a/libm.so:                                                                                                       ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[md5/uuid]=83ebcd3d3eef99c94df3f3fb644af65d, stripped
./build-tools/35.0.0/renderscript/lib/intermediates/armeabi-v7a/libc.so:                                                                                                       ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[md5/uuid]=77aa6999864032a9b1b63a4749dbbb74, not stripped
./build-tools/35.0.0/renderscript/lib/intermediates/x86/libm.so:                                                                                                               ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[md5/uuid]=3641c54897fe47729d050c79daf73e21, stripped
./build-tools/35.0.0/renderscript/lib/intermediates/x86/libc.so:                                                                                                               ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[md5/uuid]=8be40d53c19c1a89313e0334e325a812, not stripped

You can tell based on the above info, there are still several 32-bit binaries present in the latest Android SDK, specifically related to the RenderScript component.

Therefore, before removing the 32-bit support, @satmandu could you pleasea build the image locally with the removal change applied, and test it if you can still build your Android project with build-tools;35.0.0? Thanks.

@satmandu
Copy link
Contributor Author

I was building using this Docker file and started using this command to build:

#!/bin/bash
jfdir=~/src/jf


docker run -it --rm -v $jfdir/scripts:/opt/scripts -v /localnet/src/jf/jellyfin-android:/opt/jellyfin-android -v $jfdir/debug.keystore:/opt/debug.keystore -v $jfdir/out:/opt/out -v $jfdir/gradle_caches:/root/.gradle/caches -v $jfdir/scripts/bashrc:/root/.bashrc satmandu/android-sdk:ubuntu-24.04 /bin/bash

I was then building https://github.com/jellyfin/jellyfin-android using the command gradle assembleRelease.

That works fine, but that I think uses the v34 tools... (The app works fine.)

@thyrlian
Copy link
Owner

Thank you for checking it out promptly.

I'm not an expert on this topic. But I believe if you can build such an Android app with even build-tools v34 (older than v35), it should be fine.

There might be some corner cases, but we don't know as of now. I'd say let's just test a few things and apply the change to the latest image, if it doesn't work out, folks can still pull the previous released version. WDYT?

Could you please help me test especially the emulator part, to make sure the emulator could be launched and run without any problem? Thank you.

@mcmah309
Copy link

just tested, our app/dev environment seems to be working fine on this image. I'm good with it if there are no other concerns 👍

@thyrlian
Copy link
Owner

I just tested building and running other sub-images built based on this, and got some errors:

docker build --no-cache -t android-sdk-vnc android-sdk/vnc
docker run -p 5901:5901 -p 2222:22 android-sdk-vnc

#=> output
/usr/lib/python3/dist-packages/supervisor/options.py:474: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
  self.warnings.warn(
2024-07-22 22:38:26,244 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
2024-07-22 22:38:26,244 INFO Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing
2024-07-22 22:38:26,244 INFO Included extra file "/etc/supervisor/conf.d/supervisord_vncserver.conf" during parsing
2024-07-22 22:38:26,248 INFO RPC interface 'supervisor' initialized
2024-07-22 22:38:26,249 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2024-07-22 22:38:26,249 INFO supervisord started with pid 1
2024-07-22 22:38:27,251 INFO spawnerr: can't find command 'adb'
2024-07-22 22:38:27,254 INFO spawned: 'sshd' with pid 7
2024-07-22 22:38:27,257 INFO spawned: 'vncserver' with pid 8
2024-07-22 22:38:27,259 INFO spawned: 'watchdog' with pid 9
2024-07-22 22:38:28,289 INFO spawnerr: can't find command 'adb'
2024-07-22 22:38:28,289 INFO success: sshd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-07-22 22:38:28,289 INFO success: vncserver entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-07-22 22:38:28,289 INFO success: watchdog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-07-22 22:38:28,307 INFO exited: vncserver (exit status 0; expected)
2024-07-22 22:38:30,311 INFO spawnerr: can't find command 'adb'
2024-07-22 22:38:33,317 INFO spawnerr: can't find command 'adb'
2024-07-22 22:38:33,318 INFO gave up: adb entered FATAL state, too many start retries too quickly

@satmandu could you please remove other package/tool upgrade (JDK, gradle, Kotlin), and fix this issue? Thanks.

@satmandu
Copy link
Contributor Author

Python issues could be due to Ubuntu 24.04 using Python 3.12. does anything have a dependency on that?

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
@satmandu
Copy link
Contributor Author

JFK, Gradle, and Kotlin updates reverted.

@thyrlian
Copy link
Owner

Thank you @satmandu for the new commit.

Still we need to do a couple of things before the merge:

  • Test if the emulator works (via adb connection and VNC)
  • Fix the warning and errors in the VNC image (I spotted that during testing the first one)
  • There is another sub-image: firebase-test-lab, while I don't think it would be affected, but we need to make sure it's fine

Could you please help check and fix them? I'll also try on my end. Thank you.

@mcmah309
Copy link

Any movement on this? We essentially been building our own base image off this branch for a few months now with no issues.

@thyrlian
Copy link
Owner

@mcmah309 thank you for letting me know that the main image is working well. Is the emulator also working for you?
The only thing stops me from merging the branch and publishing it is to fix the VNC server.
I need some help here, and in the meantime, I can take some time to take a look. Thank you for your understanding.

@mcmah309
Copy link

We use real devices for testing. So haven't tried emulators.

@thyrlian
Copy link
Owner

thyrlian commented Sep 28, 2024

Hey everyone, good news 🎉

I made it work and tested it - both VNC and emulator work well with the new Docker image (based on Ubuntu 24.04). Please see attached screenshot as proof.

I'll merge the PR later today and add all my local fixes related to the VNC part.

Thanks again for your patience. Feedback is always welcome. 😊

Screenshot from 2024-09-28 16-10-46

@thyrlian thyrlian merged commit 3ffe3be into thyrlian:master Sep 28, 2024
1 check passed
@thyrlian
Copy link
Owner

Merged and closed. Thanks.

Additionally, I've fixed the VNC by these two commits:
998187d
33390ff

Will apply a few more minor changes and publish a new image soon. Stay tuned.

@satmandu satmandu deleted the patch-1 branch September 29, 2024 06:15
@thyrlian
Copy link
Owner

Done releasing v10.0

Changelog is here

Please let me know if it works for you guys, thank you.

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

Successfully merging this pull request may close these issues.

Upgrade To Latest Ubuntu LTS
3 participants