From: Karol Lewandowski Date: Mon, 21 Aug 2023 11:28:48 +0000 (+0200) Subject: generator: Drop fallback mechanism (OnFailure=nonisuNAME.service) X-Git-Tag: accepted/tizen/unified/20230825.044301~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F08%2F297608%2F1;p=platform%2Fcore%2Fsystem%2Fisu.git generator: Drop fallback mechanism (OnFailure=nonisuNAME.service) Unfortunately, the fallback mechanism, used when ISU service fails to start can not be used in practice because: - it breaks socket activated services, as socket passing is defined in .socket units explicitly (ie. .socket specifies eg. Service=a.service, and if fallaback uinit would be started then sockets would not be passed correctly), - it breaks dbus-activated services, as copying original service file to nonisuNAME.service causes two services to specify same BusName= name Change-Id: I7dc187ff367920bc2bfcf3988506f513278a932a --- diff --git a/doc/GUIDE.md b/doc/GUIDE.md index 49eadf1..624574b 100644 --- a/doc/GUIDE.md +++ b/doc/GUIDE.md @@ -173,8 +173,6 @@ and performing the following steps: 2. Installing all `ISU package` `systemd` service files to the `systemd` standard locations (`/run/generator/systemd`) to override system-default service files (`/usr/lib/systemd`), which are checked in later -3. Altering installed `systemd` service files to provide fallback to start non-ISU (original) -services in case of situation, where an ISU service do not work and/or keeps crashing. #### Details of `isu-generator` operation @@ -197,9 +195,6 @@ The script performs the following operations: - note that for `user-services` the user session path is different and is defined when the program is invoked by the `systemd --user` instance. - - installs original unit name under `nonisu-SERVICE_NAME` for use in - case of ISU package failure - - installs mount unit to mount ISU rootfs in `/run/isu/ISU_PKG_NAME/rootfs` (e.g. `run-isu-dlog-rootfs.mount`) @@ -218,18 +213,6 @@ On a running system, the ISU package can be seen under the `/run/isu/dlog` hiera ├── /usr/bin/dlog_logger ├── /etc/dlog.conf.d -As a fallback mechanism, the following procedure is used: -* original unit is copied to the `systemd-generator` directory as the `nonisu-NAME` - file, which can be referenced as a normal unit name -* new service file is automatically modified to include the following: - - OnFailure=nonisu-NAME - Conflicts=nonisu-NAME - - which will automatically start the original unit if the ISU package's - service fails to start or if the signature verification fails. - - ### Management of ISU packages Currently management is assumed to be handled manually by the system administrator. diff --git a/src/systemd_generator/README.md b/src/systemd_generator/README.md index 4517f61..f1aceb6 100644 --- a/src/systemd_generator/README.md +++ b/src/systemd_generator/README.md @@ -32,9 +32,6 @@ The generator: - note that for user-services (user session path is different and is defined during program invocation by `systemd --user` instance. - - installs original unit name under `nonisu-SERVICE_NAME` for use in - case of ISU package failure - - installs mount unit to mount ISU rootfs in `/run/isu/ISU_PKG_NAME/rootfs` (eg. `run-isu-dlog-rootfs.mount`) @@ -52,14 +49,3 @@ In running system ISU package is seen under `/run/isu/dlog` hierarchy as follows └── rootfs ├── /usr/bin/dlog_logger ├── /etc/dlog.conf.d - -As a fallback mechanism following is used: -* original unit is copied to systemd generator directory as `nonisu-NAME` - file, which can be referenced as normal unit name -* new service file is automatically modified to include - - OnFailure=nonisu-NAME - Conflicts=nonisu-NAME - - Which will cause to automatically start original unit if ISU package's - service fails to start (or signature verification fails). diff --git a/src/systemd_generator/isu-generator b/src/systemd_generator/isu-generator index e245140..3594497 100755 --- a/src/systemd_generator/isu-generator +++ b/src/systemd_generator/isu-generator @@ -43,13 +43,9 @@ install_units() rm -f "${new_srv_path}" "${new_srv_path}.tmp" - # 1st step: copy ISU package's .service file to generator dir and original .service under diffeerent name - # (nonisu-.. -> different name is needed as original .service will be masked by our new service from ISU) cat "$srv_path" > "$new_srv_path".tmp || return 1 if [ -f "$SERVICES_DIR/${srv_fname}" ]; then - cp -a "$SERVICES_DIR/${srv_fname}" "$UNITDIR/nonisu-${srv_fname}" || return 1 - - # 2nd step: generate mount unit for ISU image and extend the service file to use it + # generate mount unit for ISU image and extend the service file to use it local mount_unit="run-isu-$(systemd-escape ${isu_pkg_name})-rootfs.mount" cat <> "$UNITDIR/$mount_unit" || return 1 # This unit file has been automatically generated by isu-generator. @@ -69,12 +65,10 @@ EOF [Unit] After=${mount_unit} BindsTo=${mount_unit} -OnFailure=nonisu-${srv_fname} -Conflicts=nonisu-${srv_fname} EOF fi - # 3rd step: make new unit visible + # make new unit visible mv "${new_srv_path}.tmp" "${new_srv_path}" || return 1 return 0