//Module included in the following assemblies:
//
//*  microshift_updating/microshift-update-rhel-edge-to-image-mode.adoc

:_mod-docs-content-type: PROCEDURE
[id="microshift-updates-edge-to-image-uid-drift_{context}"]
= Working around UID and GID drift when migrating to {op-system-image}

[role="_abstract"]
If you do not re-install operating systems that are running {microshift-short}, you must use a workaround for a possible UID and GID drift during the migration process. One way to solve this problem is to add `systemd` units that apply the necessary fixes before the affected system services are started.

.Prerequisites

* You have an existing {op-system-ostree} deployment running {microshift-short}.
* You have root access to the build host.
* You have an image that you want to deploy.

.Procedure

* Solve the potential UID or GID drift for the Open vSwitch (OVS) `systemd` service, `ovsdb-server.service`, by adding the following command to the {microshift-short} image-build procedure:
+
[source,terminal]
----
# Install systemd configuration drop-ins to fix potential permission problems when upgrading from rpm-ostree commits to image mode container layers
RUN mkdir -p /usr/lib/systemd/system/ovsdb-server.service.d && \
    cat > /usr/lib/systemd/system/ovsdb-server.service.d/microshift-ovsdb-ownership.conf <<'EOF'
# The openvswitch database files must be owned by the appropriate user and its primary group. That the user and its group can be overwritten, recreate them.
[Service]
ExecStartPre=/bin/sh -c '/bin/getent passwd openvswitch >/dev/null || useradd -r openvswitch'
ExecStartPre=/bin/sh -c '/bin/getent group hugetlbfs >/dev/null || groupadd -r hugetlbfs'
ExecStartPre=/sbin/usermod -a -G hugetlbfs openvswitch
ExecStartPre=/bin/chown -Rhv openvswitch. /etc/openvswitch
EOF
----
+
[IMPORTANT]
====
After the {microshift-short} migration to {op-system-image} is complete, this workaround is not needed and can be removed.
====
