Commit Graph

6360 Commits

Author SHA1 Message Date
Michael Hudson-Doyle 76979c5fcf
Merge pull request #1765 from mwhudson/gap-min-size
Use the first fitting gap for ESP, instead of the largest gap
2023-08-22 09:22:04 +12:00
Dan Bungert 6cd151d249 scripts: add bind-patch.sh
scripts/bind-patch.sh is useful for modifying the snap in the live
environment, for quickly testing changes or for things that are too
obscure to test in other ways.
2023-08-21 11:42:24 -06:00
Dan Bungert b74d365915 models: if core, do not require network 2023-08-21 09:46:04 -06:00
Olivier Gayot a23755268a
Merge pull request #1767 from ogayot/fix-wants-oem-kernel
oem: fix IndexError when using OEMController.wants_oem_kernel
2023-08-18 13:04:16 +02:00
Olivier Gayot bf42341155 oem: fix IndexError when using OEMController.wants_oem_kernel
Traceback (most recent call last):
    File "subiquity/server/controllers/oem.py", line 161, in load_metapackages_list
      self.model.metapackages = [
    File "subiquity/server/controllers/oem.py", line 164, in <listcomp>
      wants_oem_kernel=await self.wants_oem_kernel(
    File "subiquity/server/controllers/oem.py", line 115, in wants_oem_kernel
      flavor = line.split("=", maxsplit=1)[1].strip()
  IndexError: list index out of range

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-08-18 12:26:20 +02:00
Michael Hudson-Doyle 778516a75c rename new function to first_gap_with_size 2023-08-18 15:29:20 +12:00
Michael Hudson-Doyle fc06fc0488 remove redundant logic 2023-08-18 15:27:29 +12:00
Michael Hudson-Doyle 7367a373ec Use the first fitting gap for ESP, instead of the largest gap 2023-08-17 16:43:49 +12:00
Michael Hudson-Doyle f338cfed64 add "in_extended" awareness to gap_with_size 2023-08-17 16:43:49 +12:00
Michael Hudson-Doyle 2abdfb5a48 add gap_with_size function to find a gap of a given size 2023-08-17 16:43:43 +12:00
Michael Hudson-Doyle 57c8a1a861
Merge pull request #1761 from mwhudson/rp-hacky-fixes
several fixes around reset partition handling
2023-08-17 14:53:29 +12:00
Michael Hudson-Doyle f86a1ef789 Merge Yao's fixes again. 2023-08-17 14:33:20 +12:00
Michael Hudson-Doyle 051b6cba12 extract code into a method to improve clarify, add comments 2023-08-17 14:23:16 +12:00
Michael Hudson-Doyle eb40871631
Merge pull request #5 from medicalwei/rp-hacky-fixes
Fixing some fixes regarding to RP
2023-08-15 10:44:14 +12:00
Sally Makin dd0c585fc3 Add content and change to reST
- Add content from /documentation folder into Diataxis structure
- Change all content from .md to .rst
- Add some tutorial content from Server docs
- Move introduction to top-level navigation to make it easier
  to find
- Update README.md with instructions for building local docs
2023-08-14 11:36:26 +01:00
Yao Wei (魏銘廷) 9c37efd534 fix: call update-grub after closing 99_reset 2023-08-14 17:46:55 +08:00
Yao Wei (魏銘廷) e0e2515eb5 fix: put EFI boot entry of recovery partition last of boot order 2023-08-14 17:46:13 +08:00
Yao Wei (魏銘廷) 3716f1259f fix: fix calling partition_by_partuuid 2023-08-14 17:45:36 +08:00
Michael Hudson-Doyle 92f793ee9b simplify partition_by_partuuid 2023-08-14 09:12:47 +12:00
Michael Hudson-Doyle 1ab061f8d8 fix boot entry creation to use actual removable media path 2023-08-14 09:10:37 +12:00
Michael Hudson-Doyle 47dc10c0c6 several fixes around reset partition handling
1. adjust the RP to use a different casper uuid, to avoid confusing when
   install media is still present
2. record the partuuid of the RP on the kernel command line when booted
   from there so subiquity knows to add a grub boot entry pointing to it
   in this case
3. fix generating the grub boot entry pointing to the RP as this was
   broken in a few ways
4. get the logic the right way around to only set BootNext in
   reset-partition-only case
2023-08-14 09:08:17 +12:00
Michael Hudson-Doyle 45ee68116c
Merge pull request #1762 from mwhudson/curtin-update
update curtin, and add 'uuid' attribute to Partition objects
2023-08-11 07:36:51 +12:00
Michael Hudson-Doyle c028390a71 update curtin, and add 'uuid' attribute to Partition objects 2023-08-10 16:56:48 +12:00
Olivier Gayot fdbcd402b9
Merge pull request #1759 from ogayot/fix-manual-size
filesystem: store the actual size in bytes alongside the human readable size
2023-08-09 17:27:20 +02:00
Olivier Gayot cda6c54b87 filesystem: store the actual size in bytes alongside the human readable size
Currently, the partition form stores the size as a human readable value.
(e.g., 123456K, 1.1G, 1.876G, 100G). When we exit the size field (i.e., upon
losing focus), we convert the value to a number of bytes and then align
it up to the nearest MiB (or whatever the alignment requirement is).

Unfortunately, after computing the aligned value, we turn it back into a
human-readable string and store it as is. It is not okay because the
conversion does not ensure that the alignment requirement is still
honored.

For instance, if the user types in 1.1G, we do the following:

 * convert it to a number of bytes -> 1181116006.4 (surprise, it is not
   even an integer).

 * round it up to the nearest MiB -> 1181745152 (this is the correct
   value)

 * transform it into a human readable string and store it as is -> 1.1G
   - which actually corresponds to the original value.

This leads to an exception later when creating the partition:

    File "subiquity/models/filesystem.py", line 1841, in add_partition
      raise Exception(
   Exception: ('size %s or offset %s not aligned to %s', 1181116006, 1048576, 1048576)

Fixed by storing the actual size as a number of bytes - alongside the
human readable size.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-08-09 16:50:03 +02:00
Michael Hudson-Doyle b0f10300eb
Merge pull request #1758 from mwhudson/bootnext-rp
preserve old loaders, and set bootnext to rp
2023-08-09 10:52:55 +12:00
Michael Hudson-Doyle bdde2c142f
Merge pull request #1757 from mwhudson/persist-rich-mode
persist rich mode across updates
2023-08-08 21:32:38 +12:00
Michael Hudson-Doyle b2d112667f set bootnext to RP in reset-partition-only case 2023-08-08 21:25:26 +12:00
Michael Hudson-Doyle d2fb4cfa80 do not remove old UEFI loaders 2023-08-08 21:22:26 +12:00
Michael Hudson-Doyle a4c924f1f9 persist rich mode across updates 2023-08-08 14:16:36 +12:00
Michael Hudson-Doyle ce9a130f37 make initial setup of rich mode less confusing 2023-08-08 14:07:10 +12:00
Michael Hudson-Doyle 17e5aae5ab
Merge pull request #1756 from mwhudson/lp-2030478
fix setting a password for the live session user
2023-08-08 12:34:43 +12:00
Michael Hudson-Doyle 1ffc1f9cc7 fix setting a password for the live session user 2023-08-08 12:16:14 +12:00
Michael Hudson-Doyle e072ad0615
Merge pull request #1751 from mwhudson/no-oem-for-core
move oem configuration stuff to a separate method
2023-08-07 08:19:48 +12:00
Olivier Gayot 2fdb0bebbc
Merge pull request #1755 from ogayot/copy-logs-fix
Make sure journalctl -b is properly captured on shutdown
2023-08-04 09:07:02 +02:00
Michael Hudson-Doyle 7afd0e57ba move kernel check out of oem specific code 2023-08-04 15:39:22 +12:00
Olivier Gayot 34242846db shutdown: make sure we capture the output of journalctl -b
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-08-03 12:03:16 +02:00
Olivier Gayot 6a4537277d runner: make runner.start() forward kwargs to astart_command()
In a recent patch, we switched the mechanism used for running some
shutdown related commands. We used to lean on run_command() and we now
lean on runner.run().

runner.run() works a bit differently because it runs the command through
systemd-run - and by default does not capture the output (it goes into
the journal).

Another difference is that runner.run() would not forward the keyword
arguments (like stdout, stderr) to subprocess. Well, it would forward
those arguments to runner.start() which would raise an exception:

  File "subiquity/server/controllers/shutdown.py", line 118, in copy_logs_to_target
    await self.app.command_runner.run(
  File "subiquity/server/runner.py", line 98, in run
    proc = await self.start(cmd, **opts)
                 ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DryRunCommandRunner.start() got an unexpected keyword argument 'stdout'

We now ensure that those keyword arguments are properly forwarded to
subprocess (through astart_command).

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-08-03 11:55:53 +02:00
Olivier Gayot 03e9a401b9
Merge pull request #1754 from ogayot/kvm-test-tpm
kvm-test: support emulating a TPM 2.0
2023-08-03 09:36:29 +02:00
Michael Hudson-Doyle ac4d39baf8 add integration that installs desktop
and as a result, tests OEM metapackage code path
2023-08-03 13:17:31 +12:00
Michael Hudson-Doyle 81bad123d0 do not display a message about OEM configuration if no metapackages 2023-08-03 13:17:31 +12:00
Michael Hudson-Doyle d2f3db6463 move oem configuration stuff to a separate method
and do not call it when installing core
2023-08-03 13:17:31 +12:00
Michael Hudson-Doyle c34e30f648
Merge pull request #1752 from mwhudson/dd-image
add support for 'dd' image sources
2023-08-03 13:17:09 +12:00
Dan Bungert 918714480f
Merge pull request #1753 from dbungert/s390x-shutdown
shutdown: use direct run_command
2023-08-02 16:22:28 -06:00
Michael Hudson-Doyle 24a4d76e42 skip inappropriate checks in integration tests 2023-08-03 10:02:36 +12:00
Michael Hudson-Doyle 0395b6e9b0 add support for 'dd' image sources
I think only a core dd image source will work for now. Probably.
2023-08-03 09:07:06 +12:00
Michael Hudson-Doyle d77ac16dd0
Merge pull request #1749 from mwhudson/no-logs-for-core
do not copy logs to target when installing core
2023-08-03 07:45:35 +12:00
Michael Hudson-Doyle ff0a98f476
Merge pull request #1750 from mwhudson/move-setupcon
call setupcon directly in keyboard controller
2023-08-03 07:45:18 +12:00
Olivier Gayot 5244890c5a kvm-test: support emulating a TPM 2.0
When invoking kvm-test.py, one can pass the --with-tpm2 option so that
we emulate a TPM and make it available in the guest.

This requires the swtpm package which is available in jammy and more
recent versions of Ubuntu.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-08-02 16:58:25 +02:00
Dan Bungert 405932045d shutdown: use direct run_command 2023-08-02 07:38:50 -06:00