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

🐧 Add Ubuntu flavors for RPi #1170

Merged
merged 34 commits into from
May 12, 2023
Merged

🐧 Add Ubuntu flavors for RPi #1170

merged 34 commits into from
May 12, 2023

Conversation

mauromorales
Copy link
Member

@mauromorales mauromorales commented Mar 20, 2023

QA:

  • rolling release
  • 22 lts
  • 20 lts

What this PR does / why we need it:
Ubuntu flavors which support raspberrypi

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #645
supersedes #816

@netlify
Copy link

netlify bot commented Mar 20, 2023

Deploy Preview for kairos-io canceled.

Name Link
🔨 Latest commit 846232e
🔍 Latest deploy log https://app.netlify.com/sites/kairos-io/deploys/643edfb3fbf01100073ed0d5

@mauromorales
Copy link
Member Author

Sizes needed to be expanded in order to build the images, but now I can finally do. Pending QA

@mauromorales mauromorales changed the title [WIP] Ubuntu rpi 🐧 [WIP] Add Ubuntu flavors for RPi Mar 22, 2023
@mauromorales mauromorales changed the title 🐧 [WIP] Add Ubuntu flavors for RPi [WIP] 🐧 Add Ubuntu flavors for RPi Mar 22, 2023
@codecov-commenter
Copy link

codecov-commenter commented Mar 22, 2023

Codecov Report

Merging #1170 (c623991) into master (7bb9af9) will decrease coverage by 1.78%.
The diff coverage is 45.20%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #1170      +/-   ##
==========================================
- Coverage   22.79%   21.01%   -1.78%     
==========================================
  Files          22       16       -6     
  Lines        1610     1275     -335     
==========================================
- Hits          367      268      -99     
+ Misses       1179      958     -221     
+ Partials       64       49      -15     
Impacted Files Coverage Δ
internal/agent/config.go 0.00% <ø> (ø)
internal/agent/interactive_install.go 0.00% <ø> (ø)
internal/agent/notify.go 0.00% <0.00%> (ø)
internal/agent/recovery.go 0.00% <ø> (ø)
internal/agent/reset.go 0.00% <0.00%> (ø)
internal/agent/upgrade.go 0.00% <0.00%> (ø)
pkg/config/config.go 0.00% <0.00%> (-51.36%) ⬇️
internal/agent/install.go 5.10% <21.21%> (+5.10%) ⬆️
pkg/config/collector/options.go 64.51% <37.50%> (ø)
pkg/config/collector/collector.go 61.76% <61.76%> (ø)
... and 2 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mauromorales mauromorales self-assigned this Mar 23, 2023
@mauromorales
Copy link
Member Author

Getting the following errors:

IMG_2460.MOV

@sdwilsh
Copy link
Contributor

sdwilsh commented Apr 11, 2023

@mauromorales, I take it you can't actually get into the system to see any logs to help there, based on the video, yeah?

@mauromorales
Copy link
Member Author

@sdwilsh yeah indeed, I'll try to have a better setup for it next week and give it another shot

@sdwilsh
Copy link
Contributor

sdwilsh commented Apr 11, 2023

Sounds good; I should have bandwidth soon and some incentive to help get this working :D

@mauromorales mauromorales force-pushed the ubuntu-rpi branch 2 times, most recently from f8cdc16 to d6cdf1c Compare May 2, 2023 12:39
@mauromorales
Copy link
Member Author

mauromorales commented May 2, 2023

For faster iteration I wanted to try using the generic arm image. It builds successfully, starts up and shows the grub menu, but then it gets stuck here quite quickly

image

@mauromorales mauromorales force-pushed the ubuntu-rpi branch 2 times, most recently from b6f1817 to 9553bb6 Compare May 4, 2023 08:36
@mauromorales
Copy link
Member Author

mauromorales commented May 8, 2023

I'm currently experiencing an issue where the RPi starts booting, I can see systemd logs, but then at some point I loose video, so I cannot debug any further. Will get a cable to try to view via serial console and report back. Or if you have any ideas pls let me know

trim.D6FA5EAC-524B-473A-A804-E8C0E9B0C898.MOV

@mauromorales
Copy link
Member Author

mauromorales commented May 8, 2023

Generic image booting properly you can try this out by building it locally from the branch via: earthly -P +all-arm-generic --FLAVOR=ubuntu-arm-rpi

The main difference between the two images are the kernel and the extra firmware packages for the RPi:

FROM base AS generic
RUN apt-get update && apt-get install -y linux-base \
    linux-image-generic-hwe-22.04 \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

FROM base AS rpi64
RUN apt-get update && apt-get install -y linux-firmware-raspi \
    linux-modules-extra-raspi \
    linux-raspi \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

@mauromorales mauromorales added help wanted Extra attention is needed and removed help wanted Extra attention is needed labels May 8, 2023
@mauromorales mauromorales requested a review from a team May 11, 2023 13:26
Earthfile Outdated
@@ -293,7 +299,7 @@ base-image:
END
# END

# TEST KCRYPT FROM BRANCH
# TEST KCRYPT FROM BRANCH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accidental?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oopsie

@@ -366,6 +373,7 @@ image:
ARG OS_VERSION=${KAIROS_VERSION}
END
ARG OS_ID
# should we add the model to the resulting iso?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean in /etc/os-release? Consider moving it here: #1365

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess to the name. That its a good point. we probably need to rethink the iso naming somehow as it should probably also include the ARCH+MODEL if they are special so we can provide arm64-generic, and arm64-rpi and in the future arm64-nvidia or whatever?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup indeed to the name of the resulting file whether iso or img

jimmykarily
jimmykarily previously approved these changes May 12, 2023
ENV SIZE="15200"
ENV DEFAULT_ACTIVE_SIZE="2000"
IF [[ "$FLAVOR" =~ ^ubuntu* ]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate this. This should probably come from some env files where its clear what goes with what flavor and such. Not for this PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, can it be done in the /etc/elemental/config.yaml that we include?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah probably not cuz this here has precedence when creating the image ... ok will open an issue

@@ -15,6 +15,15 @@ flavors:
ubuntu:
- systemd-base
- dracut-network-legacy
ubuntu-arm-rpi:
- systemd-base
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably need to start grouping this below and just have a single "metapackage" here to not repeat ourselves this much.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean using anchors? or what is a meta package?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, see how you mark here systemd-base and then below you can see that it contains 2 packages: init-svc/systemd and systemd-default/network ? So Im thinking that we may need to just merge more of the stuff seeing that there is a clear repetition here with systemd-base and dracut-network-legacy*

so something similar to those, like ubuntu-base that includes all those packages, or something shared that includes all of that so its a one line for all. Dont know how, just thinking out loud seeing that this keeps frowing and lines repeating :D

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I get your point now. Yeah I agree, I had the same feeling that this was lots of duplication but didn't know how this part integrates to be able to suggest a recommendation. I'll create an issue out of your comment.

linux-raspi \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

FROM ${MODEL} AS all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I...dont get this.

So if we call this with the generic model it will run:

  • FROM $BASE_IMAGE as base
  • FROM base AS generic
  • FROM ${MODEL} AS all

but all its still installing the linux-raspi kernel no? dont we want the rpi to install those packages only? Wont we end up with a generic image that has both kernels inside and the possibility of linking to it?

Copy link
Member Author

@mauromorales mauromorales May 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I didn't find it very intuitive at first, but I'm finding it quite helpful now, feels a bit like Earthly ... anyways, my understanding is that all is the requested target (because it's the last one?) and depending on it's base it will only build generic or rpi64. And it properly ignores all the targets it doesn't need to build

see: https://docs.docker.com/build/building/multi-stage/#differences-between-legacy-builder-and-buildkit

@@ -0,0 +1,7 @@
ACTIVE_CONSOLES="/dev/tty[1-6]"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same file as the ubuntu files, wont copying the ubuntu files if it matches ^ubuntu* would be enough so we dont duplicate?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we just have the one difference with the /etc/elemental/config.yaml for ubuntu arm rpi. Here's where I started thinking about also refactoring this but then I thought, I better start the discussion before changing everything LOL

Itxaka
Itxaka previously approved these changes May 12, 2023
Copy link
Member

@Itxaka Itxaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, a cleanup can come after about the overlay stuff

@Itxaka
Copy link
Member

Itxaka commented May 12, 2023

Just thinking out loud, but maybe we should drop to bootargs for rpi and during building add the vc4.conf to /etc/modprobe.d with a blacklist vc4 line to not even have to worry about the vc4 module and stop adding it to the cmdline?

Signed-off-by: Mauro Morales <[email protected]>
@mauromorales
Copy link
Member Author

Just thinking out loud, but maybe we should drop to bootargs for rpi and during building add the vc4.conf to /etc/modprobe.d with a blacklist vc4 line to not even have to worry about the vc4 module and stop adding it to the cmdline?

good point, added a new issue #1407

very cool that you can create issues from comments, wasn't aware of this

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

Successfully merging this pull request may close these issues.

🐧 Add ARM/RPI support for Ubuntu 20.04 and 22.04 images
6 participants