Skip to content

part2: Allow installing into /config#119

Merged
crogers1 merged 2 commits intoOpenXT:masterfrom
jandryuk:config-install
Sep 29, 2022
Merged

part2: Allow installing into /config#119
crogers1 merged 2 commits intoOpenXT:masterfrom
jandryuk:config-install

Conversation

@jandryuk
Copy link
Copy Markdown
Contributor

From the 8/18 call. Only tested on OTA. WIP since fresh and offline upgrade need testing.

Currently, /config is not mounted under mount_dom0. This means files
cannot be installed there while the installer runs. However, /config is
an encrypted partition, so it is the convenient place to store files
needing offline protection.

The installer already has permission to mount /config. mount_config
already exists to mount /config, but it's current use is limited to
specific locations where access is needed. It's not clear if not
mounting /config was a design decision, or if it was simply never needed
before. Maybe it was done done to protect against stray writes.
However there is no actual restriction on accessing /config.

While mount_dom0 could be expanded to always mount /config, take a more
conservative approach and just extended install_file() and commit_file()
to only mount /config if and when needed by checking for a destination
of "/config/".

/config will always be available for mounting - however, there is and
always has been, and implicit need for install_dom0()/upgrade_dom() to
run before other steps.
For install, install_dom0 created and luksOpen-ed /dev/mapper/config.
For OTA, /config is already mounted in the host.
For offline upgrade, the config recovery password is verified before
proceeding.

Signed-off-by: Jason Andryuk jandryuk@gmail.com

@jandryuk
Copy link
Copy Markdown
Contributor Author

This breaks on fresh install - config is left mounted by:

# mount config and copy dom0 /config
do_mount /dev/mapper/config ${TEMP_CONFIG_MOUNT} >&2 || return 1
do_cmd rsync --archive --xattrs \
${DOM0_MOUNT}/config/ ${TEMP_CONFIG_MOUNT} >&2 || return 1
do_mount --move ${TEMP_CONFIG_MOUNT} \
${DOM0_MOUNT}/config >&2 || return 1

A subsequent mount_config call fails. "mount_config: config partition is already mapped, mounting" and "mount: /mnt/part2/dom0/config: /dev/mapper/config already mounted on /mnt/part2/dom0/config."

@crogers1 crogers1 self-requested a review September 14, 2022 18:43
Comment thread part2/stages/Functions/install-main
Comment thread part2/stages/Functions/install-main
Comment thread part2/stages/Functions/install-main Outdated

return 0
if [ "$config_mounted" = "1" ] ; then
do_umount "$DOM0_MOUNT/config"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

${DOM0_MOUNT}

with the braces for consistency.

Comment thread part2/stages/Functions/install-main
Currently, /config is not mounted under mount_dom0.  This means files
cannot be installed there while the installer runs.  However, /config is
an encrypted partition, so it is the convenient place to store files
needing offline protection.

The installer already has permission to mount /config.  mount_config
already exists to mount /config, but it's current use is limited to
specific locations where access is needed.  It's not clear if not
mounting /config was a design decision, or if it was simply never needed
before.  Maybe it was done done to protect against stray writes.
However there is no actual restriction on accessing /config.

While mount_dom0 could be expanded to always mount /config, take a more
conservative approach and just extended install_file() and commit_file()
to only mount /config if and when needed by checking for a destination
of "/config/".

/config will always be available for mounting - however, there is and
always has been, and implicit need for install_dom0()/upgrade_dom() to
run before other steps.
For install, install_dom0 created and luksOpen-ed /dev/mapper/config.
For OTA, /config is already mounted in the host.
For offline upgrade, the config recovery password is verified before
proceeding.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
A fresh install trying to place files in /config fails in
mount_config():
mount_config: config partition is already mapped, mounting
...
mount: /mnt/part2/dom0/config: /dev/mapper/config already mounted on /mnt/part2/dom0/config.

install_dom0 leaves /config already mounted on ${DOM0_MOUNT}/config, so
the second call fails.

Allow an already mounted ${DOM0_MOUNT}/config just return success so
installation continues.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
@jandryuk jandryuk changed the title WIP: part2: Allow installing into /config part2: Allow installing into /config Sep 23, 2022
@jandryuk
Copy link
Copy Markdown
Contributor Author

Fixup per @crogers1
Added a commit to handle ${DOM0_MOUNT}/config already mounted

Copy link
Copy Markdown
Contributor

@crogers1 crogers1 left a comment

Choose a reason for hiding this comment

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

LGTM. Merging later

@crogers1 crogers1 merged commit e207496 into OpenXT:master Sep 29, 2022
@jandryuk jandryuk deleted the config-install branch September 29, 2022 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants