diff -Nru systemd-237/debian/changelog systemd-237/debian/changelog --- systemd-237/debian/changelog 2018-05-21 17:30:12.000000000 +0200 +++ systemd-237/debian/changelog 2018-06-27 16:59:04.000000000 +0200 @@ -1,3 +1,10 @@ +systemd (237-3ubuntu10.2) UNRELEASED; urgency=medium + + * debian/patches/debian/UBUNTU-Support-system-image-read-only-etc.patch: + - re-add support for /etc/writable for core18 (LP: #1778936) + + -- Michael Vogt Wed, 27 Jun 2018 16:59:04 +0200 + systemd (237-3ubuntu10.1) bionic; urgency=medium [ Dimitri John Ledkov ] diff -Nru systemd-237/debian/patches/debian/UBUNTU-networkd-if-RA-was-implicit-do-not-await-ndisc_con.patch systemd-237/debian/patches/debian/UBUNTU-networkd-if-RA-was-implicit-do-not-await-ndisc_con.patch --- systemd-237/debian/patches/debian/UBUNTU-networkd-if-RA-was-implicit-do-not-await-ndisc_con.patch 2018-05-18 21:11:19.000000000 +0200 +++ systemd-237/debian/patches/debian/UBUNTU-networkd-if-RA-was-implicit-do-not-await-ndisc_con.patch 2018-06-27 16:57:34.000000000 +0200 @@ -13,11 +13,11 @@ src/network/networkd-link.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) -diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c -index 64c4508..19eaac2 100644 ---- a/src/network/networkd-link.c -+++ b/src/network/networkd-link.c -@@ -222,7 +222,7 @@ static bool link_proxy_arp_enabled(Link *link) { +Index: systemd-237/src/network/networkd-link.c +=================================================================== +--- systemd-237.orig/src/network/networkd-link.c ++++ systemd-237/src/network/networkd-link.c +@@ -222,7 +222,7 @@ static bool link_proxy_arp_enabled(Link return true; } @@ -26,7 +26,7 @@ assert(link); if (!socket_ipv6_is_supported()) -@@ -241,9 +241,12 @@ static bool link_ipv6_accept_ra_enabled(Link *link) { +@@ -241,9 +241,12 @@ static bool link_ipv6_accept_ra_enabled( * disabled if local forwarding is enabled). * If set, ignore or enforce RA independent of local forwarding state. */ @@ -40,7 +40,7 @@ else if (link->network->ipv6_accept_ra > 0) /* accept RA even if ip_forward is enabled */ return true; -@@ -252,6 +255,10 @@ static bool link_ipv6_accept_ra_enabled(Link *link) { +@@ -252,6 +255,10 @@ static bool link_ipv6_accept_ra_enabled( return false; } diff -Nru systemd-237/debian/patches/debian/UBUNTU-Support-system-image-read-only-etc.patch systemd-237/debian/patches/debian/UBUNTU-Support-system-image-read-only-etc.patch --- systemd-237/debian/patches/debian/UBUNTU-Support-system-image-read-only-etc.patch 1970-01-01 01:00:00.000000000 +0100 +++ systemd-237/debian/patches/debian/UBUNTU-Support-system-image-read-only-etc.patch 2018-06-27 16:57:34.000000000 +0200 @@ -0,0 +1,85 @@ +From: Martin Pitt +Date: Sat, 26 Apr 2014 23:49:32 +0200 +Subject: Support system-image read-only /etc + +On Ubuntu Phone with readonly /etc we symlink +/etc/{adjtime,localtime,timezone,hostname,machine-info} to /etc/writable/, so +we need to update those files instead if the original files are symlinks into +/etc/writable/. + +Forwarded: OMGno, this is a rather nasty hack until we fix system-image to get a writable /etc +Bug-Ubuntu: https://launchpad.net/bugs/1227520 +--- + src/hostname/hostnamed.c | 28 ++++++++++++++++++++++++---- + src/timedate/timedated.c | 31 +++++++++++++++++++++++++------ + 2 files changed, 49 insertions(+), 10 deletions(-) + +Index: systemd-237/src/hostname/hostnamed.c +=================================================================== +--- systemd-237.orig/src/hostname/hostnamed.c ++++ systemd-237/src/hostname/hostnamed.c +@@ -31,6 +31,7 @@ + #include "hostname-util.h" + #include "parse-util.h" + #include "path-util.h" ++#include "fs-util.h" + #include "selinux-util.h" + #include "strv.h" + #include "user-util.h" +@@ -76,6 +77,25 @@ static void context_free(Context *c) { + bus_verify_polkit_async_registry_free(c->polkit_registry); + } + ++/* Hack for Ubuntu phone: check if path is an existing symlink to ++ * /etc/writable; if it is, update that instead */ ++static const char* writable_filename(const char *path) { ++ ssize_t r; ++ static char realfile_buf[PATH_MAX]; ++ _cleanup_free_ char *realfile = NULL; ++ const char *result = path; ++ int orig_errno = errno; ++ ++ r = readlink_and_make_absolute(path, &realfile); ++ if (r >= 0 && startswith(realfile, "/etc/writable")) { ++ snprintf(realfile_buf, sizeof(realfile_buf), "%s", realfile); ++ result = realfile_buf; ++ } ++ ++ errno = orig_errno; ++ return result; ++} ++ + static int context_read_data(Context *c) { + int r; + struct utsname u; +@@ -303,12 +323,12 @@ static int context_write_data_static_hos + + if (isempty(c->data[PROP_STATIC_HOSTNAME])) { + +- if (unlink("/etc/hostname") < 0) ++ if (unlink(writable_filename("/etc/hostname")) < 0) + return errno == ENOENT ? 0 : -errno; + + return 0; + } +- return write_string_file_atomic_label("/etc/hostname", c->data[PROP_STATIC_HOSTNAME]); ++ return write_string_file_atomic_label(writable_filename("/etc/hostname"), c->data[PROP_STATIC_HOSTNAME]); + } + + static int context_write_data_machine_info(Context *c) { +@@ -354,13 +374,13 @@ static int context_write_data_machine_in + } + + if (strv_isempty(l)) { +- if (unlink("/etc/machine-info") < 0) ++ if (unlink(writable_filename("/etc/machine-info")) < 0) + return errno == ENOENT ? 0 : -errno; + + return 0; + } + +- return write_env_file_label("/etc/machine-info", l); ++ return write_env_file_label(writable_filename("/etc/machine-info"), l); + } + + static int property_get_icon_name( diff -Nru systemd-237/debian/patches/series systemd-237/debian/patches/series --- systemd-237/debian/patches/series 2018-05-21 17:29:49.000000000 +0200 +++ systemd-237/debian/patches/series 2018-06-27 16:58:31.000000000 +0200 @@ -61,3 +61,4 @@ debian/UBUNTU-networkd-if-RA-was-implicit-do-not-await-ndisc_con.patch debian/UBUNTU-introduce-TAKE_PTR-macro.patch debian/UBUNTU-sleep-Add-support-for-setting-a-disk-offset.patch +debian/UBUNTU-Support-system-image-read-only-etc.patch