Commit Graph

6349 Commits

Author SHA1 Message Date
Dan Bungert c9cfdafe0c log: create /var/log/installer root only 2023-10-05 18:03:32 -06:00
Dan Bungert 1da5cac477 several: turn off aiohttp access log
It will log arguments, so unless we are certain the arguments are clean
this will cause trouble.  Just turn it off.
2023-10-05 18:03:02 -06:00
Dan Bungert 80b144f220 file_util: just make written files root only 2023-10-05 17:22:18 -06:00
Dan Bungert f567f9e1f5 network: disable log line that logs psk 2023-10-05 17:21:07 -06:00
Dan Bungert e55b5bf8aa
Merge pull request #1823 from dbungert/translations-sync-2023-10-05
po: merge from translations-export
2023-10-05 17:01:52 -06:00
Dan Bungert 0201c7756a revert en_GB, it has czech 2023-10-05 15:54:49 -06:00
Dan Bungert 6417720a2e po: merge from translations-export 2023-10-05 11:37:30 -06:00
Dan Bungert d4e9f7d3b8
Merge pull request #1814 from ogayot/noop-no-emit-source-configured
source: do not fire a configured event again if nothing changed
2023-10-04 20:46:13 -06:00
Dan Bungert 2970912b7c
Merge pull request #1820 from dbungert/CVE-2023-5182
install: create autoinstall-user-data 0400
2023-10-04 20:45:49 -06:00
Dan Bungert 62e126896f install: create autoinstall-user-data 0400
CVE-2023-5182

As autoinstall-user-data contains a password hash hash for a user with
sudo access, create the autoinstall-user-data as 0400 root:root.

The old permissions are 0640 root:adm, and the adm group does not by
default have sudo access, so cracking that hash could lead to privilege
escallation for someone in the adm group.

Thanks to Patric Åhlin and Johan Hortling for identifying and reporting
the issue.
2023-10-04 19:32:33 -06:00
Dan Bungert f86a533ed6
Merge pull request #1819 from dbungert/cloud-init-log
Cloud init log
2023-10-04 19:32:08 -06:00
Dan Bungert ab0af6375e shutdown: fix owner on cloud-init logs
These have owner syslog at install time, but that is uid remapped on the
target system which may end up with a different owning user.
2023-10-04 17:56:30 -06:00
Dan Bungert d3debfcea3 shutdown: refactor cloud init logs logic 2023-10-04 17:56:15 -06:00
Dan Bungert a2b63dae13 util: ensure log file is root owned 2023-10-04 14:06:09 -06:00
Dan Bungert 3a319e77d7
Merge pull request #1818 from dbungert/file-writer-enhancement
util: File writer enhancements
2023-10-03 19:16:37 -06:00
Dan Bungert 8ab052c200 util: set_log_perms tests 2023-10-03 19:02:16 -06:00
Dan Bungert 4a4e8ba886 util: explicit isdir arg from set_log_perms
target already exists, we should just inspect target and find if it is a
directory or not.
2023-10-03 18:56:07 -06:00
Dan Bungert ddc11d8687 util: more control on file writer mode and group 2023-10-03 17:09:05 -06:00
Dan Bungert ddc3345eb6 util: standardize on term 'mode' 2023-10-03 17:09:01 -06:00
Dan Bungert 85af88e2d6
Merge pull request #1811 from Chris-Peterson444/lp-2032961-clean-environment-commands
autoinstall: Don't use snap env when invoking early and late commands
2023-10-03 11:20:26 -06:00
Chris Peterson 8f28063b92 tests: remove obsolete commands 2023-10-03 10:09:29 -07:00
Chris Peterson 39f1ea9cb6 autoinstall: Don't use snap env when invoking early and late commands 2023-10-03 10:09:26 -07:00
Olivier Gayot f6da6162e4 source: warn when POST /source specifies an unmatched source id
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-10-02 17:57:22 +02:00
Olivier Gayot 143d8e359a
Merge pull request #1813 from ogayot/target-not-mounted-error
shutdown: do not try to unmount /target if install was not started
2023-10-02 17:45:19 +02:00
Olivier Gayot d99a348958
Merge pull request #1815 from ogayot/workflows-rename
workflows: differentiate CI and Snap workflows
2023-10-02 17:44:56 +02:00
Olivier Gayot a34bce470f workflows: differentiate CI and Snap workflows
The workflows defined respectively in build.yaml and snap.yaml were
both called "CI". On the Github web interface, it resulted in two menus
called "CI" with no easy way to know which is which.

To make things clearer, we now:
 * rename build.yaml -> ci.yaml
 * call "Snap" the workflow defined by snap.yaml

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-10-02 14:38:04 +02:00
Olivier Gayot fff2f6591f source: do not fire a configured event again if nothing changed
When handling a POST request to /source, Subiquity sends a 'source
configured' event. This signals other controllers / models that they
need to restart their tasks that depend on the source being used.

However, if the user of the installer goes back all the way to the
source page and submits it again without changing the settings, there
should be no reason to restart the machinery.

If a call to source ends up doing no modification to the model (i.e.,
not changing the source used or the search_drivers setting), we now
avoid emitting the 'source configured' event ; except if the model has
not been configured yet.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-10-02 14:12:54 +02:00
Olivier Gayot abef05178c shutdown: do not try to unmount /target if install was not started
If we ask for reboot before the installation has started (i.e., if
curtin install was not invoked at least once), the following call fails
and prevents the system from rebooting.

 $ umount --recursive /target

Make sure we check that /target exists and is mounted before calling
umount.

Another approach would be to check the return value of umount but the
values are not documented.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-10-02 13:29:53 +02:00
Olivier Gayot bd52c483de
Merge pull request #1812 from ogayot/install-package-skip-offline
codecs: skip installation when running an offline install
2023-10-02 09:13:58 +02:00
Olivier Gayot 01ec1da86f codecs: skip installation when running an offline install
ubuntu-restricted-addons is a multiverse package and is not included in
the pool. Therefore, trying to get it installed when offline leads to an
obvious error.

Instead of making the whole Ubuntu installation fail, we now warn and
skip installation of the package when performing an offline install.
In a perfect world, we should not have offered to install the package in
the first place, but in practice, we can run an offline installation as
the result of failed mirror testing (bad network for instance).

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-09-29 18:20:19 +02:00
Dan Bungert 9bf0a50a24
Merge pull request #1806 from dbungert/lp-2009141-udev-events
filesystem: revamp udev handling
2023-09-27 14:12:08 -06:00
Dan Bungert b11726d398 filesystem: revamp udev handling
In LP: #2009141, we are hitting kernel limits and pyudev buffer limits.
We don't care about specific events, so much as getting one event,
waiting for things to calm down, then reprobing.

Outright disable the event monitor, and re-enable later.  If there is a
storm of events, testing has shown that stopping the listener is not
enough.
2023-09-27 13:43:14 -06:00
Olivier Gayot 9d30dc29be
Merge pull request #1809 from ogayot/oem-crash-early-confirmation
oem: make sure storage is configured before using is_core_boot_classic
2023-09-27 21:28:47 +02:00
Olivier Gayot 59849f7f45 oem: make sure storage is configured before using is_core_boot_classic
Before using fs_controller.is_core_boot_classic(), we wait for the call
to /meta/confirmation?tty=xxx. That said, in semi-automated desktop
installs, sometimes the call to /meta/confirmation happens before
marking storage configured. This leads to the following error:

  File "subiquity/server/controllers/oem.py", line 209, in apply_autoinstall_config
    await self.load_metapkgs_task
  File "subiquity/server/controllers/oem.py", line 81, in list_and_mark_configured
    await self.load_metapackages_list()
  File "subiquitycore/context.py", line 149, in decorated_async
    return await meth(self, **kw)
  File "subiquity/server/controllers/oem.py", line 136, in load_metapackages_list
    if fs_controller.is_core_boot_classic():
  File "subiquity/server/controllers/filesystem.py", line 284, in is_core_boot_classic
    return self._info.is_core_boot_classic()
AttributeError: 'NoneType' object has no attribute 'is_core_boot_classic'

Receiving the confirmation before getting the storage configured is
arguably wrong - but let's be prepared for it just in case.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-09-27 11:18:58 +02:00
Olivier Gayot f951146d6a
Merge pull request #1808 from ogayot/early-v2-orig-config
filesystem: don't crash if v2/orig_config is called early
2023-09-27 09:05:58 +02:00
Olivier Gayot 7de6f0538b filesystem: don't crash if v2/orig_config is called early
When v2/orig_config is called too early, the load_probe_data function
will fail because probe_data is None:

  Traceback (most recent call last):
    File "subiquity/common/api/server.py", line 164, in handler
      result = await implementation(**args)
    File "subiquity/server/controllers/filesystem.py", line 1029, in v2_orig_config_GET
      model = self.model.get_orig_model()
    File "subiquity/models/filesystem.py", line 1428, in get_orig_model
      orig_model.load_probe_data(self._probe_data)
    File "subiquity/models/filesystem.py", line 1894, in load_probe_data
      for devname, devdata in probe_data["blockdev"].items():
  TypeError: 'NoneType' object is not subscriptable

Make sure we don't dereference model._probe_data if it is None.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-09-26 16:00:34 +02:00
Chris Peterson 926bfeb5e1
Merge pull request #1807 from Chris-Peterson444/lp-2037133-locale-interactive
locale is not implicitly interactive with other interactive sessions
2023-09-25 17:12:22 -07:00
Chris Peterson 4ba59a503b docs: locale must be specified to be interactive 2023-09-25 15:59:07 -07:00
Olivier Gayot c9f3e252af
Merge pull request #1802 from ogayot/rich-mode-s390x
ui: have a distinct state file for rich mode over serial
2023-09-25 09:06:58 +02:00
Dan Bungert 333e4d96c8
Merge pull request #1804 from dbungert/lp-2034715-just-wait-longer
snapd api: wait longer
2023-09-22 16:09:15 -06:00
Dan Bungert 5a573f2cef snapd api: wait longer
While these changes are not supposed to take nearly this long,
per LP: #2034715 we know that they are, and that some systems will
correctly perform the finish_install() step if just given more time.
2023-09-22 15:05:01 -06:00
Olivier Gayot d7f5ef1a99
Merge pull request #1805 from ogayot/zdev-key-encryption
Bump curtin rev for recovery key on systems using zkey
2023-09-22 16:44:21 +02:00
Olivier Gayot 22b6d1258b Bump curtin rev for recovery key on systems using zkey
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-09-22 09:34:22 +02:00
Olivier Gayot c95261e0de ui: have a distinct state file for rich mode over serial
We recently made sure that after doing a snap refresh, the rich mode
(i.e., either rich or basic) is preserved. This was implemented by
storing the rich mode in a state file. When the client starts, it loads
the rich mode from said state file if it exists.

Unfortunately, on s390x, it causes installs to default to basic mode.
This happens because on this architecture, a subiquity install consists
of:

 * a first client (over serial) showing the SSH password
 * a second client (logging over SSH) actually going through the
   installation UI.

Since the first client uses a serial connection, the state file is
created with rich-mode set to basic. Upon connecting using SSH, the
state file is read and the rich-mode is set to basic as well.

Fixed by storing the rich-mode in two separate files, one for clients
over serial and one for other clients.

LP: #2036096

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-09-22 09:27:13 +02:00
Chris Peterson 4010f0ad5f
Merge pull request #1803 from Chris-Peterson444/kernel-autoinstall-file
Allow for specifying the autoinstall file over the kernel command line
2023-09-21 13:45:29 -07:00
Chris Peterson 28dd55f9dd docs: reflect autoinstall options and precedence 2023-09-21 13:23:04 -07:00
Chris Peterson 76b520afa9 autoinstall: allow for specifying autoinstall path on kernel command line 2023-09-21 11:57:46 -07:00
Dan Bungert aaaf87355c
Merge pull request #1800 from dbungert/curtin-2023-09-19
snapcraft: rev curtin for deb822, large sectors
2023-09-19 18:31:02 -06:00
Dan Bungert 21e6b1ebfc
Merge pull request #1799 from ogayot/chreipl-earlier
s390x: ensure chreipl is called before unmounting /target
2023-09-19 18:28:24 -06:00
Dan Bungert ea7b683d8e snapcraft: rev curtin for deb822, large sectors
This curtin rev adds the following:
Dan Bungert (3):
      extract: log source information
      tests/data: 4k sector disk
      storage_config: handle partitions on 4k disk

Nick Rosbrook (1):
      apt: disable default deb822 migration
2023-09-19 18:22:58 -06:00