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

Factory reset is not working as described on raspberrypi #622

Closed
c0ffee opened this issue Jan 9, 2023 · 15 comments · Fixed by kairos-io/osbuilder#53
Closed

Factory reset is not working as described on raspberrypi #622

c0ffee opened this issue Jan 9, 2023 · 15 comments · Fixed by kairos-io/osbuilder#53
Assignees
Labels
ARM bug Something isn't working

Comments

@c0ffee
Copy link
Contributor

c0ffee commented Jan 9, 2023

Kairos version:
NAME="kairos-opensuse-arm-rpi"
VERSION="v1.4.0-k3sv1.24.9+k3s1"
ID="kairos"
ID_LIKE="kairos-opensuse-arm-rpi"
VERSION_ID="v1.4.0-k3sv1.24.9+k3s1"
PRETTY_NAME="kairos-opensuse-arm-rpi v1.4.0-k3sv1.24.9+k3s1"
ANSI_COLOR="0;32"
BUG_REPORT_URL="https://github.com/kairos-io/kairos/issues/new/choose"
HOME_URL="https://github.com/kairos-io/provider-kairos"
IMAGE_REPO="quay.io/kairos/kairos-opensuse-arm-rpi"
IMAGE_LABEL="latest"
GITHUB_REPO="kairos-io/provider-kairos"
VARIANT="core"
FLAVOR="opensuse"

CPU architecture, OS, and Version:
Linux k8s-rpi3-1 5.14.21-150400.24.38-default #1 SMP PREEMPT_DYNAMIC Fri Dec 9 09:29:22 UTC 2022 (e9c5676) aarch64 aarch64 aarch64 GNU/Linux

Describe the bug
Factory reset from userspace is not working as described in the documentation. /oem is actually RO and is missing the grubenv file. Actually even the grub entry is missing at all too.

To Reproduce
grub2-editenv /oem/grubenv set next_entry=statereset

Expected behavior
Device does a factory reset :)

Logs

Additional context

@c0ffee c0ffee added the bug Something isn't working label Jan 9, 2023
@mudler
Copy link
Member

mudler commented Jan 11, 2023

Thanks @c0ffee for filing an issue!

That's a good point - by default ARM images don't come with an OEM partition so docs aren't correct in such case. We should move to LVM, or either document how to set an OEM partition externally.

@c0ffee
Copy link
Contributor Author

c0ffee commented Jan 12, 2023

The reset option is missing in the grub menu too

What would be then the way to do a reset on Wich a device?

In general I think LVM would be the best approach to have the same lock and feel

The limitation is probably the partition table at the moment right?

@mudler
Copy link
Member

mudler commented Jan 12, 2023

The reset option is missing in the grub menu too

What would be then the way to do a reset on Wich a device?

Once a partition labeled "COS_OEM" is found it is automatically loaded, however that may need further tweaking. Indeed the best approach is to move over something more flexible, like LVM.

The limitation is probably the partition table at the moment right?

Correct

@jimmykarily
Copy link
Contributor

Waiting for this: #1271

@mauromorales
Copy link
Member

#1271 has been merged. I tested this and it is possible to create file /oem/grubenv and it persist over reboots, however the factory reset was not initiated on next reboot

@mudler
Copy link
Member

mudler commented May 2, 2023

#1271 has been merged. I tested this and it is possible to create file /oem/grubenv and it persist over reboots, however the factory reset was not initiated on next reboot

I think that has to do to the fact that there is no installation phase while flashing, so we miss the default grub configuration:

cp -rfv /etc/kairos/branding/grubmenu.cfg /tmp/mnt/STATE/grubmenu

@jimmykarily jimmykarily moved this from Todo 🖊 to In Progress 🏃 in 🧙Issue tracking board May 8, 2023
@jimmykarily jimmykarily moved this from In Progress 🏃 to Todo 🖊 in 🧙Issue tracking board May 8, 2023
@jimmykarily jimmykarily self-assigned this May 9, 2023
@jimmykarily jimmykarily moved this from Todo 🖊 to In Progress 🏃 in 🧙Issue tracking board May 9, 2023
@jimmykarily
Copy link
Contributor

Isn't this a problem too?

@jimmykarily
Copy link
Contributor

I copied the grub config in place and I now get this at boot:

image

jimmykarily added a commit to kairos-io/osbuilder that referenced this issue May 18, 2023
Fixes kairos-io/kairos#622

Signed-off-by: Dimitris Karakasilis <[email protected]>
@jimmykarily
Copy link
Contributor

Regarding the missing grubenv file (see the description of the issue at the top), I think there is some detection happening here: https://github.com/kairos-io/packages/blob/1cfec31b9ca1097e1fbd96d9bac990c42d04e678/packages/static/grub-config/files/grub.cfg#L5

so the grub2-editenv /oem/grubenv command actually creates that file, and the detection in the grub.cfg finds that and uses that. So as long as the grub config is in place, it should work. I need to try this out.

@jimmykarily
Copy link
Contributor

Indeed, with the fix in the draft PR in osbuilder (see linked PR above), when I run grub2-editenv /oem/grubenv and then reboot, the reset menu is selected when it boots.

Then is fails with this:

image

@jimmykarily
Copy link
Contributor

Actually it doesn't fail with the error above. After a while it continues. The problem seems to be that it can't even boot into recovery (not just "reset"). I flashed this image from quay.io: kairos-opensuse-leap-arm-rpi-v2.2.0-rc1.img.xz and this can't boot into recovery either. So, it doesn't have to do with any of my changes.

@mudler
Copy link
Member

mudler commented May 31, 2023

looks like a regression in using LVM as partitioning. I can boot into recovery just fine on Nvidia AGX Orin

@github-project-automation github-project-automation bot moved this from In Progress 🏃 to Done ✅ in 🧙Issue tracking board May 31, 2023
@mudler mudler reopened this May 31, 2023
@github-project-automation github-project-automation bot moved this from Done ✅ to Under review 🔍 in 🧙Issue tracking board May 31, 2023
@jimmykarily
Copy link
Contributor

jimmykarily commented May 31, 2023

@jimmykarily
Copy link
Contributor

insmod lvm took the recovery boot a little bit further. It started printing things and then at some point it rebooted again. I will try with the serial cable to see if there was some error printed which I missed.

@jimmykarily
Copy link
Contributor

This should fix booting to recovery: #1471 (comment)

I'm not sure if insmod lvm is also needed. I will test with and without.

@github-project-automation github-project-automation bot moved this from Under review 🔍 to Done ✅ in 🧙Issue tracking board Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARM bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants