Merge ~mitchdz/ubuntu/+source/ec2-hibinit-agent:mitch/xenial-imdsv2 into ubuntu/+source/ec2-hibinit-agent:ubuntu/xenial-devel
- Git
- lp:~mitchdz/ubuntu/+source/ec2-hibinit-agent
- mitch/xenial-imdsv2
- Merge into ubuntu/xenial-devel
Proposed by
Mitchell Dzurick
Status: | Merged | ||||
---|---|---|---|---|---|
Merge reported by: | Mitchell Dzurick | ||||
Merged at revision: | 577603dc5c8a0c3bce9c6992f28532985a514c2e | ||||
Proposed branch: | ~mitchdz/ubuntu/+source/ec2-hibinit-agent:mitch/xenial-imdsv2 | ||||
Merge into: | ubuntu/+source/ec2-hibinit-agent:ubuntu/xenial-devel | ||||
Diff against target: |
375 lines (+312/-2) 8 files modified
debian/changelog (+16/-0) debian/ec2-hibinit-agent.install (+1/-0) debian/hibinit-agent.system-sleep (+1/-2) debian/hibinit-resume (+48/-0) debian/patches/lp1941785-Add-support-for-IMDSv2.patch (+161/-0) debian/patches/lp1968805-Swapon-with-maximum-priority-before-hibernation.patch (+63/-0) debian/patches/lp2023924-remove-quotes-from-state-dir.patch (+19/-0) debian/patches/series (+3/-0) |
||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
git-ubuntu import | Pending | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
- 92c89f4... by Mitchell Dzurick
-
debian/
hibinit- resume: Add extra steps around swapoff to avoid OOM errors. - 4054ec8... by Mitchell Dzurick
-
d/p/lp1968805-
Swapon- with-maximum- priority- before- hibernation. patch: Swapon with maximum priority right before hibernation. - 13f7bf9... by Mitchell Dzurick
-
d/p/{lp1941785,
lp2023924} *: add IMDSv2, fix quotes bug created from IMDSv2 patch
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/debian/changelog b/debian/changelog | |||
2 | index b366dca..b4f95a5 100644 | |||
3 | --- a/debian/changelog | |||
4 | +++ b/debian/changelog | |||
5 | @@ -1,3 +1,19 @@ | |||
6 | 1 | ec2-hibinit-agent (1.0.0-0ubuntu4~16.04.5) xenial; urgency=medium | ||
7 | 2 | |||
8 | 3 | * d/p/lp2023924-remove-quotes-from-state-dir.patch: fixes an issue where a | ||
9 | 4 | weird directory would be created in root (LP: #2023924) | ||
10 | 5 | * d/p/lp1941785-Add-support-for-IMDSv2.patch: allow hibernation of | ||
11 | 6 | AWS EC2 instances with IMDSv2 (LP: #1941785) | ||
12 | 7 | * Swapon with maximum priority right before hibernation. This resolves | ||
13 | 8 | swapfile priority issues with additional or multiple swapfiles enabled. | ||
14 | 9 | (LP: #1968805) | ||
15 | 10 | - d/p/lp1968805-Swapon-with-maximum-priority-before-hibernation.patch | ||
16 | 11 | * debian/hibinit-resume: Add extra steps around swapoff to avoid OOM errors. | ||
17 | 12 | Also work around xen-netfront not resuming properly. | ||
18 | 13 | Thanks to Francis Ginther for the initial patch (LP: #1863242, #1864041) | ||
19 | 14 | |||
20 | 15 | -- Mitchell Dzurick <mitchell.dzurick@canonical.com> Tue, 21 Nov 2023 15:31:14 -0700 | ||
21 | 16 | |||
22 | 1 | ec2-hibinit-agent (1.0.0-0ubuntu4~16.04.4) xenial; urgency=medium | 17 | ec2-hibinit-agent (1.0.0-0ubuntu4~16.04.4) xenial; urgency=medium |
23 | 2 | 18 | ||
24 | 3 | * Always set resume device by PARTUUID instead of by device name. | 19 | * Always set resume device by PARTUUID instead of by device name. |
25 | diff --git a/debian/ec2-hibinit-agent.install b/debian/ec2-hibinit-agent.install | |||
26 | index b140d28..5b1b272 100755 | |||
27 | --- a/debian/ec2-hibinit-agent.install | |||
28 | +++ b/debian/ec2-hibinit-agent.install | |||
29 | @@ -5,5 +5,6 @@ debian/ec2-hibinit-agent-ignore-powerkey.conf usr/lib/systemd/logind.conf.d/ | |||
30 | 5 | debian/hibinit-agent.system-sleep => lib/systemd/system-sleep/hibinit-agent | 5 | debian/hibinit-agent.system-sleep => lib/systemd/system-sleep/hibinit-agent |
31 | 6 | debian/hibinit-power etc/acpi/events | 6 | debian/hibinit-power etc/acpi/events |
32 | 7 | debian/hibinit-power.sh etc/acpi/actions | 7 | debian/hibinit-power.sh etc/acpi/actions |
33 | 8 | debian/hibinit-resume usr/lib/ec2-hibinit-agent | ||
34 | 8 | etc/hibinit-config.cfg | 9 | etc/hibinit-config.cfg |
35 | 9 | agent/* usr/bin/ | 10 | agent/* usr/bin/ |
36 | diff --git a/debian/hibinit-agent.system-sleep b/debian/hibinit-agent.system-sleep | |||
37 | index 914161b..62db7bd 100755 | |||
38 | --- a/debian/hibinit-agent.system-sleep | |||
39 | +++ b/debian/hibinit-agent.system-sleep | |||
40 | @@ -4,8 +4,7 @@ set -e | |||
41 | 4 | if [ "$2" = "hibernate" ] || [ "$2" = "hybrid-sleep" ]; then | 4 | if [ "$2" = "hibernate" ] || [ "$2" = "hybrid-sleep" ]; then |
42 | 5 | case "$1" in | 5 | case "$1" in |
43 | 6 | post) | 6 | post) |
46 | 7 | systemctl restart --no-block systemd-networkd | 7 | systemd-run --no-block --service-type=oneshot /usr/lib/ec2-hibinit-agent/hibinit-resume |
45 | 8 | systemd-run --no-block --service-type=oneshot swapoff /swap-hibinit | ||
47 | 9 | ;; | 8 | ;; |
48 | 10 | esac | 9 | esac |
49 | 11 | fi | 10 | fi |
50 | diff --git a/debian/hibinit-resume b/debian/hibinit-resume | |||
51 | 12 | new file mode 100755 | 11 | new file mode 100755 |
52 | index 0000000..e83fe2c | |||
53 | --- /dev/null | |||
54 | +++ b/debian/hibinit-resume | |||
55 | @@ -0,0 +1,48 @@ | |||
56 | 1 | #!/bin/bash | ||
57 | 2 | # | ||
58 | 3 | # Resume from hibernation on EC2 and apply workarounds for various issues | ||
59 | 4 | # | ||
60 | 5 | # Copyright (C) 2020 Canonical Ltd. | ||
61 | 6 | # | ||
62 | 7 | |||
63 | 8 | set -e | ||
64 | 9 | |||
65 | 10 | # Starting hibinit resume actions | ||
66 | 11 | echo "hibinit-resume: begin" >> /var/log/hibinit-resume.log | ||
67 | 12 | |||
68 | 13 | # Give some time to make sure the system is fully up and running, see LP: #1864041 | ||
69 | 14 | sleep 2 | ||
70 | 15 | |||
71 | 16 | # Make sure the network is properly resumed | ||
72 | 17 | echo "restarting network" >> /var/log/hibinit-resume.log | ||
73 | 18 | if grep -q xen_netfront /proc/modules; then | ||
74 | 19 | # Xen netfront workaround LP: #1864041 | ||
75 | 20 | modprobe -r xen_netfront | ||
76 | 21 | modprobe xen_netfront | ||
77 | 22 | fi | ||
78 | 23 | systemctl restart --no-block systemd-networkd | ||
79 | 24 | |||
80 | 25 | # Temporarily set memory allocation policy to "always overcommit". With | ||
81 | 26 | # the default overcommit policy some applications might experience | ||
82 | 27 | # out-of-memory errors. Setting the policy to "always overcommit" seems | ||
83 | 28 | # to be a safe way to prevent these errors. | ||
84 | 29 | OVERCOMMIT_POLICY=$(cat /proc/sys/vm/overcommit_memory) | ||
85 | 30 | echo 1 > /proc/sys/vm/overcommit_memory | ||
86 | 31 | # Start swapoff and make sure swap file is gone | ||
87 | 32 | while :; do | ||
88 | 33 | echo "starting swapoff" >> /var/log/hibinit-resume.log | ||
89 | 34 | swapoff /swap-hibinit | ||
90 | 35 | if grep -q swap-hibinit /proc/swaps; then | ||
91 | 36 | echo "swap still active" >> /var/log/hibinit-resume.log | ||
92 | 37 | sleep 10 | ||
93 | 38 | else | ||
94 | 39 | break | ||
95 | 40 | fi | ||
96 | 41 | done | ||
97 | 42 | echo "swap disabled" >> /var/log/hibinit-resume.log | ||
98 | 43 | cat /proc/swaps >> /var/log/hibinit-resume.log | ||
99 | 44 | # Restore previou overcommit policy | ||
100 | 45 | echo "$OVERCOMMIT_POLICY" > /proc/sys/vm/overcommit_memory | ||
101 | 46 | |||
102 | 47 | # All done | ||
103 | 48 | echo "hibinit-resume: completed " >> /var/log/hibinit-resume.log | ||
104 | diff --git a/debian/patches/lp1941785-Add-support-for-IMDSv2.patch b/debian/patches/lp1941785-Add-support-for-IMDSv2.patch | |||
105 | 0 | new file mode 100644 | 49 | new file mode 100644 |
106 | index 0000000..6855eb2 | |||
107 | --- /dev/null | |||
108 | +++ b/debian/patches/lp1941785-Add-support-for-IMDSv2.patch | |||
109 | @@ -0,0 +1,161 @@ | |||
110 | 1 | Description: Add support for IMDSv2 | ||
111 | 2 | Author: Frederick Lefebvre <fredlef@amazon.com> | ||
112 | 3 | Origin: backport, https://github.com/aws/amazon-ec2-hibinit-agent/commit/9d9bca5c61fa9256289e68c88bd3747af2f62e28 | ||
113 | 4 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ec2-hibinit-agent/+bug/1941785 | ||
114 | 5 | Last-Update: 2023-05-16 | ||
115 | 6 | --- | ||
116 | 7 | This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ | ||
117 | 8 | --- a/agent/hibinit-agent | ||
118 | 9 | +++ b/agent/hibinit-agent | ||
119 | 10 | @@ -18,6 +18,7 @@ | ||
120 | 11 | import sys | ||
121 | 12 | import syslog | ||
122 | 13 | import math | ||
123 | 14 | +import requests | ||
124 | 15 | from subprocess import check_call, check_output, STDOUT | ||
125 | 16 | from threading import Thread | ||
126 | 17 | from math import ceil | ||
127 | 18 | @@ -25,11 +26,6 @@ | ||
128 | 19 | |||
129 | 20 | |||
130 | 21 | try: | ||
131 | 22 | - from urllib.request import urlopen, Request | ||
132 | 23 | -except ImportError: | ||
133 | 24 | - from urllib2 import urlopen, Request, HTTPError | ||
134 | 25 | - | ||
135 | 26 | -try: | ||
136 | 27 | from ConfigParser import ConfigParser, NoSectionError, NoOptionError | ||
137 | 28 | except: | ||
138 | 29 | from configparser import ConfigParser, NoSectionError, NoOptionError | ||
139 | 30 | @@ -41,7 +37,12 @@ | ||
140 | 31 | log_to_syslog = True | ||
141 | 32 | log_to_stderr = True | ||
142 | 33 | SWAP_FILE = '/swap-hibinit' | ||
143 | 34 | -URL = "http://169.254.169.254/latest/meta-data/hibernation/configured" | ||
144 | 35 | + | ||
145 | 36 | +DEFAULT_STATE_DIR = '/var/lib/hibinit-agent' | ||
146 | 37 | +HIB_ENABLED_FILE = "hibernation-enabled" | ||
147 | 38 | +IMDS_BASEURL = 'http://169.254.169.254' | ||
148 | 39 | +IMDS_API_TOKEN_PATH = 'latest/api/token' | ||
149 | 40 | +IMDS_SPOT_ACTION_PATH = 'latest/meta-data/hibernation/configured' | ||
150 | 41 | |||
151 | 42 | def log(message): | ||
152 | 43 | if log_to_syslog: | ||
153 | 44 | @@ -314,6 +315,9 @@ | ||
154 | 45 | get_int('swap', 'percentage-of-ram'), args.swap_ram_percentage, 100) | ||
155 | 46 | self.swap_mb = self.merge( | ||
156 | 47 | get_int('swap', 'target-size-mb'), args.swap_target_size_mb, 4000) | ||
157 | 48 | + self.state_dir = get('core', 'state-dir') | ||
158 | 49 | + if self.state_dir is None: | ||
159 | 50 | + self.state_dir = DEFAULT_STATE_DIR | ||
160 | 51 | |||
161 | 52 | |||
162 | 53 | def merge(self, cf_value, arg_value, def_val): | ||
163 | 54 | @@ -337,31 +341,55 @@ | ||
164 | 55 | def __str__(self): | ||
165 | 56 | return str(self.__dict__) | ||
166 | 57 | |||
167 | 58 | -def hibernationEnabled(): | ||
168 | 59 | - """Returns a boolean indicating whether hibernation is enabled or not.""" | ||
169 | 60 | - response = None | ||
170 | 61 | - try: | ||
171 | 62 | - response = urlopen(URL) | ||
172 | 63 | - data = response.read() | ||
173 | 64 | - if data.lower() in ('false', b'false'): | ||
174 | 65 | - return False | ||
175 | 66 | - except: | ||
176 | 67 | - return False | ||
177 | 68 | - finally: | ||
178 | 69 | - if response: | ||
179 | 70 | - response.close() | ||
180 | 71 | - return True | ||
181 | 72 | +def get_imds_token(seconds=21600): | ||
182 | 73 | + """ Get a token to access instance metadata. """ | ||
183 | 74 | + log("Requesting new IMDSv2 token.") | ||
184 | 75 | + request_header = {'X-aws-ec2-metadata-token-ttl-seconds': str(seconds)} | ||
185 | 76 | + token_url = '{}/{}'.format(IMDS_BASEURL, IMDS_API_TOKEN_PATH) | ||
186 | 77 | + response = requests.put(token_url, headers=request_header) | ||
187 | 78 | + response.close() | ||
188 | 79 | + if response.status_code != 200: | ||
189 | 80 | + return None | ||
190 | 81 | + | ||
191 | 82 | + return response.text | ||
192 | 83 | + | ||
193 | 84 | +def create_state_dir(state_dir): | ||
194 | 85 | + """ Create agent run dir if it doesn't exists.""" | ||
195 | 86 | + if not os.path.isdir(state_dir): | ||
196 | 87 | + os.makedirs(state_dir) | ||
197 | 88 | + | ||
198 | 89 | +def hibernation_enabled(state_dir): | ||
199 | 90 | + """Returns a boolean indicating whether hibernation is enabled or not. | ||
200 | 91 | + Hibernation can't be enabled/disabled the instance launch. If we find | ||
201 | 92 | + hibernation to be enabled, we create a semephore file so that we don't | ||
202 | 93 | + have to probe IMDS again. That is useful when a instance is rebooted | ||
203 | 94 | + after/if the IMDS http endpoint has been disabled. | ||
204 | 95 | + """ | ||
205 | 96 | + hib_sem_file = os.path.join(state_dir, HIB_ENABLED_FILE) | ||
206 | 97 | + if os.path.isfile(hib_sem_file): | ||
207 | 98 | + log("Found {!r}, configuring hibernation".format(hib_sem_file)) | ||
208 | 99 | + return True | ||
209 | 100 | + | ||
210 | 101 | + imds_token = get_imds_token() | ||
211 | 102 | + if imds_token is None: | ||
212 | 103 | + # IMDS http endpoint is disabled | ||
213 | 104 | + return False | ||
214 | 105 | + | ||
215 | 106 | + request_header = {'X-aws-ec2-metadata-token': imds_token} | ||
216 | 107 | + response = requests.get("{}/{}".format(IMDS_BASEURL, IMDS_SPOT_ACTION_PATH), | ||
217 | 108 | + headers=request_header) | ||
218 | 109 | + response.close() | ||
219 | 110 | + if response.status_code != 200 or response.text.lower() == "false": | ||
220 | 111 | + return False | ||
221 | 112 | + | ||
222 | 113 | + log("Hibernation Configured Flag found") | ||
223 | 114 | + os.mknod(hib_sem_file) | ||
224 | 115 | + | ||
225 | 116 | + return True | ||
226 | 117 | + | ||
227 | 118 | |||
228 | 119 | def main(): | ||
229 | 120 | |||
230 | 121 | - if not hibernationEnabled(): | ||
231 | 122 | - log("Instance Launch has not enabled Hibernation Configured Flag. hibinit-agent exiting!!") | ||
232 | 123 | - exit(0) | ||
233 | 124 | - # Validate if disk space>total RAM | ||
234 | 125 | - ram_bytes = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') | ||
235 | 126 | - if get_rootfs_size()<=(math.ceil(float(ram_bytes)/(1024*1024*1024))): | ||
236 | 127 | - log("Insufficient disk space. Cannot create setup for hibernation. Please allocate a larger root device") | ||
237 | 128 | - exit(1) | ||
238 | 129 | # Parse arguments | ||
239 | 130 | parser = argparse.ArgumentParser(description="An EC2 background process that creates a setup for instance hibernation " | ||
240 | 131 | "at instance launch and also registers ACPI sleep event/actions") | ||
241 | 132 | @@ -388,6 +416,17 @@ | ||
242 | 133 | log_to_syslog = config.log_to_syslog | ||
243 | 134 | |||
244 | 135 | log("Effective config: %s" % config) | ||
245 | 136 | + create_state_dir(config.state_dir) | ||
246 | 137 | + | ||
247 | 138 | + # Let's first check if we even need to run | ||
248 | 139 | + if not hibernation_enabled(config.state_dir): | ||
249 | 140 | + log("Instance Launch has not enabled Hibernation Configured Flag. hibinit-agent exiting!!") | ||
250 | 141 | + exit(0) | ||
251 | 142 | + # Validate if disk space>total RAM | ||
252 | 143 | + ram_bytes = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') | ||
253 | 144 | + if get_rootfs_size()<=(math.ceil(float(ram_bytes)/(1024*1024*1024))): | ||
254 | 145 | + log("Insufficient disk space. Cannot create setup for hibernation. Please allocate a larger root device") | ||
255 | 146 | + exit(1) | ||
256 | 147 | |||
257 | 148 | target_swap_size = config.swap_mb * 1024 * 1024 | ||
258 | 149 | swap_percentage_size = ram_bytes * config.swap_percentage // 100 | ||
259 | 150 | --- a/etc/hibinit-config.cfg | ||
260 | 151 | +++ b/etc/hibinit-config.cfg | ||
261 | 152 | @@ -11,6 +11,9 @@ | ||
262 | 153 | # filesystems. | ||
263 | 154 | touch-swap = False | ||
264 | 155 | |||
265 | 156 | +# Location where to create any state files | ||
266 | 157 | +state-dir = "/var/lib/hibinit-agent" | ||
267 | 158 | + | ||
268 | 159 | [swap] | ||
269 | 160 | # If there's no swap then we create it to be equal to the specified | ||
270 | 161 | # percentage of RAM or to the target size, whichever is greater | ||
271 | diff --git a/debian/patches/lp1968805-Swapon-with-maximum-priority-before-hibernation.patch b/debian/patches/lp1968805-Swapon-with-maximum-priority-before-hibernation.patch | |||
272 | 0 | new file mode 100644 | 162 | new file mode 100644 |
273 | index 0000000..5ed11c1 | |||
274 | --- /dev/null | |||
275 | +++ b/debian/patches/lp1968805-Swapon-with-maximum-priority-before-hibernation.patch | |||
276 | @@ -0,0 +1,63 @@ | |||
277 | 1 | Author: Matthew Ruffell <matthew.ruffell@canonical.com> | ||
278 | 2 | Date: Wed 13 Apr 2022 15:39:15 +1200 | ||
279 | 3 | Description: | ||
280 | 4 | |||
281 | 5 | Swapon with maximum priority before hibernation | ||
282 | 6 | |||
283 | 7 | Since Focal, on systems with additional or multiple swapfiles | ||
284 | 8 | configured, swapon on /swap-hibinit will be added with the next | ||
285 | 9 | lowest priority for the system. | ||
286 | 10 | |||
287 | 11 | For example, if we have /swapfile configured with a default priority | ||
288 | 12 | of -2, swapon /swap-hibinit will be added with priority -3. | ||
289 | 13 | |||
290 | 14 | $ sudo swapon /swapfile | ||
291 | 15 | $ swapon --show | ||
292 | 16 | NAME TYPE SIZE USED PRIO | ||
293 | 17 | /swapfile file 4G 0B -2 | ||
294 | 18 | $ sudo swapon /swap-hibinit | ||
295 | 19 | $ swapon --show | ||
296 | 20 | NAME TYPE SIZE USED PRIO | ||
297 | 21 | /swapfile file 4G 0B -2 | ||
298 | 22 | /swap-hibinit file 3.9G 0B -3 | ||
299 | 23 | |||
300 | 24 | This causes hibernation to fail, since hibernation targets the | ||
301 | 25 | highest priority swapfile, which is no longer /swap-hibinit, and the | ||
302 | 26 | kernel command line is specifically configured to resume from the | ||
303 | 27 | UUID and offset for /swap-hibinit. | ||
304 | 28 | |||
305 | 29 | The result is that EC2 console says "Stopping" for 20 minutes before | ||
306 | 30 | the instance is force stopped. | ||
307 | 31 | |||
308 | 32 | Fix this by setting /swap-hibinit to maximum possible priority, | ||
309 | 33 | 32767, as we swapon right before hibernation takes place. | ||
310 | 34 | |||
311 | 35 | Bug-Ubuntu: https://bugs.launchpad.net/bugs/1968805 | ||
312 | 36 | Forwarded: yes, https://github.com/aws/amazon-ec2-hibinit-agent/commit/a2303d269610a6e7415c5045766da605eaa7e30f | ||
313 | 37 | Last-Update: 2022-04-13 | ||
314 | 38 | |||
315 | 39 | Index: ec2-hibinit-agent-1.0.0/acpid.sleep.sh | ||
316 | 40 | =================================================================== | ||
317 | 41 | --- ec2-hibinit-agent-1.0.0.orig/acpid.sleep.sh 2022-04-13 15:55:57.642062380 +1200 | ||
318 | 42 | +++ ec2-hibinit-agent-1.0.0/acpid.sleep.sh 2022-04-13 15:55:57.642062380 +1200 | ||
319 | 43 | @@ -2,6 +2,11 @@ | ||
320 | 44 | |||
321 | 45 | #PATH=/sbin:/bin:/usr/bin | ||
322 | 46 | |||
323 | 47 | +# Hibernation selects the swapfile with highest priority. Since there may be | ||
324 | 48 | +# other swapfiles configured, ensure /swap-hibinit is selected as hibernation | ||
325 | 49 | +# target by setting to maximum priority. See LP#1968805. | ||
326 | 50 | +swap_priority=32767 | ||
327 | 51 | + | ||
328 | 52 | do_hibernate() { | ||
329 | 53 | if [ -d /run/systemd/system ]; then | ||
330 | 54 | systemctl hibernate | ||
331 | 55 | @@ -14,7 +19,7 @@ | ||
332 | 56 | |||
333 | 57 | case "$2" in | ||
334 | 58 | SBTN) | ||
335 | 59 | - swapon /swap-hibinit && do_hibernate | ||
336 | 60 | + swapon --priority=$swap_priority /swap-hibinit && do_hibernate | ||
337 | 61 | ;; | ||
338 | 62 | *) | ||
339 | 63 | logger "ACPI action undefined: $2" ;; | ||
340 | diff --git a/debian/patches/lp2023924-remove-quotes-from-state-dir.patch b/debian/patches/lp2023924-remove-quotes-from-state-dir.patch | |||
341 | 0 | new file mode 100644 | 64 | new file mode 100644 |
342 | index 0000000..d178d21 | |||
343 | --- /dev/null | |||
344 | +++ b/debian/patches/lp2023924-remove-quotes-from-state-dir.patch | |||
345 | @@ -0,0 +1,19 @@ | |||
346 | 1 | Description: Remove quotes in config file for state_dir value | ||
347 | 2 | It creates strange directory /" | ||
348 | 3 | Author: Anchal Agarwal <anchalag@amazon.com> | ||
349 | 4 | Origin: backport, https://github.com/aws/amazon-ec2-hibinit-agent/commit/d87d6365009f1663247fd8595b487c59d9b121f1 | ||
350 | 5 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ec2-hibinit-agent/+bug/2023924 | ||
351 | 6 | Last-Update: 2023-06-20 | ||
352 | 7 | --- | ||
353 | 8 | This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ | ||
354 | 9 | --- a/etc/hibinit-config.cfg | ||
355 | 10 | +++ b/etc/hibinit-config.cfg | ||
356 | 11 | @@ -12,7 +12,7 @@ | ||
357 | 12 | touch-swap = False | ||
358 | 13 | |||
359 | 14 | # Location where to create any state files | ||
360 | 15 | -state-dir = "/var/lib/hibinit-agent" | ||
361 | 16 | +state-dir = /var/lib/hibinit-agent | ||
362 | 17 | |||
363 | 18 | [swap] | ||
364 | 19 | # If there's no swap then we create it to be equal to the specified | ||
365 | diff --git a/debian/patches/series b/debian/patches/series | |||
366 | index 136d930..1555533 100644 | |||
367 | --- a/debian/patches/series | |||
368 | +++ b/debian/patches/series | |||
369 | @@ -7,3 +7,6 @@ detect-hibernate-cmd-by-default.patch | |||
370 | 7 | 0008-Detect-disabled-hibernation-with-Python-3-s-urllib-t.patch | 7 | 0008-Detect-disabled-hibernation-with-Python-3-s-urllib-t.patch |
371 | 8 | 0008-Always-set-resume-device-by-PARTUUID-instead-of-by-d.patch | 8 | 0008-Always-set-resume-device-by-PARTUUID-instead-of-by-d.patch |
372 | 9 | 0010-Update-grub-configuration-when-it-needs-an-update.patch | 9 | 0010-Update-grub-configuration-when-it-needs-an-update.patch |
373 | 10 | lp1968805-Swapon-with-maximum-priority-before-hibernation.patch | ||
374 | 11 | lp1941785-Add-support-for-IMDSv2.patch | ||
375 | 12 | lp2023924-remove-quotes-from-state-dir.patch |