[3.0][bug] Cannot resume after the germinate state

Bug #2043482 reported by Paul Mars
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Image
Fix Released
Medium
Paul Mars

Bug Description

This is not possible to properly resume when we stopped just after the germinate state. The following command will work, but the next one (executed after the first one) will crash.

sudo ./ubuntu-image --debug classic --thru germinate --workdir ~/scratch/server-pc-amd64 ../ubuntu-images/ubuntu-server-pc-amd64.yaml

sudo ./ubuntu-image --debug classic --resume --thru install_packages --workdir ~/scratch/server-pc-amd64 ../ubuntu-images/ubuntu-server-pc-amd64.yaml

Error: invalid steps taken count (9). The state machine only have 4 steps

Even if the command did not crash, the state "install_packages" would not installed any packages found by germinate because the list is not saved in the state written to disk.

This is not specific to the germinate state, I also reproduced this issue by stopping after the build_gadget_tree state and in this case I encountered the following panic:

sudo ubuntu-image classic -v test.yaml -w ./test -t build_gadget_tree

[0] parse_image_definition
[1] calculate_states
[2] make_temporary_directories
[3] determine_output_directory
[4] build_gadget_tree

sudo ubuntu-image classic -v test.yaml -w ./test -r

panic: runtime error: slice bounds out of range [5:4]

goroutine 1 [running]:
github.com/canonical/ubuntu-image/internal/statemachine.(*StateMachine).readMetadata(0xc0002d7680)
 /build/ubuntu-image/parts/ubuntu-image/build/internal/statemachine/state_machine.go:362 +0x591
github.com/canonical/ubuntu-image/internal/statemachine.(*ClassicStateMachine).Setup(0xc0002d7680)
 /build/ubuntu-image/parts/ubuntu-image/build/internal/statemachine/classic.go:51 +0x9f
main.executeStateMachine(0xc0002e3f10, 0xc0002e6180, 0xc0000b5560)
 /build/ubuntu-image/parts/ubuntu-image/build/cmd/ubuntu-image/main.go:46 +0x2e5
main.main()
 /build/ubuntu-image/parts/ubuntu-image/build/cmd/ubuntu-image/main.go:157 +0x6fa

The resume feature needs fixing to be able to stop/resume at any state. This may be important for the imagecraft integration.

Paul Mars (upils)
description: updated
Paul Mars (upils)
Changed in ubuntu-image:
status: Confirmed → In Progress
assignee: nobody → Paul Mars (upils)
Paul Mars (upils)
tags: added: foundations-todo
Paul Mars (upils)
Changed in ubuntu-image:
status: In Progress → Fix Committed
Paul Mars (upils)
tags: removed: foundations-todo
Paul Mars (upils)
Changed in ubuntu-image:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.