summaryrefslogtreecommitdiffstats
path: root/patches/fuel-astute/0001-Erase-EFI-boot-entry-on-EFI-systems.patch
blob: 905834df47427986fc05bcb8fc3b75292f70e2ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Date: Mon, 18 Jul 2016 16:02:20 +0200
Subject: [PATCH] Erase EFI boot entry on EFI systems.

On EFI-enabled systemd, grub-install from grub-efi-* package
installs a boot entry named "ubuntu".

Since this boot entry is saved in board flash memory, erasing
the MBR bootloader code and/or partition signature will not
clear the ubuntu boot entry, leaving it pointing to a loader
on the ESP (EFI System Partition) that will try to load the
kernel/initrd from an erased partition.

In Fuel 8.0, the whole disk was erased, so the ubuntu EFI boot
entry was skipped due to missing ESP, while for Fuel 9.0 and
above we have to explicitly remove it to keep the system in a
sane state.

Note: efibootmgr is installed automatically on EFI systems
as a dependency of grub-efi-*.

Closes: ARMBAND-47

Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
---
 mcagents/erase_node.rb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mcagents/erase_node.rb b/mcagents/erase_node.rb
index 3eb98e8..3bac36f 100644
--- a/mcagents/erase_node.rb
+++ b/mcagents/erase_node.rb
@@ -112,6 +112,10 @@ module MCollective
         File.open('/proc/sys/kernel/panic','w') {|file| file.write("10\n")}
 
         begin
+          # clear out EFI boot entry on EFI-enabled systems
+          system("(which efibootmgr > /dev/null 2>&1 && efibootmgr | "\
+                 "grep -oP '(?<=Boot)[0-9]+(?=.*ubuntu)' | "\
+                 "xargs -I{} efibootmgr --delete-bootnum --bootnum {}) || true")
           get_devices(type='all').each do |dev|
             debug_msg("erasing bootstrap code area in MBR of #{dev[:name]}")
             # clear out the boot code in MBR
d } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
[submodule "docs/submodules/apex"]
	path = docs/submodules/apex
	url = ../apex
	branch = .
	ignore = dirty
[submodule "docs/submodules/armband"]
	path = docs/submodules/armband
	url = ../armband
	branch = .
	ignore = dirty
[submodule "docs/submodules/bottlenecks"]
	path = docs/submodules/bottlenecks
	url = ../bottlenecks
	branch = .
	ignore = dirty
[submodule "docs/submodules/compass4nfv"]
	path = docs/submodules/compass4nfv
	url = ../compass4nfv
	branch = .
	ignore = dirty
[submodule "docs/submodules/container4nfv"]
	path = docs/submodules/container4nfv
	url = https://gerrit.opnfv.org/gerrit/container4nfv
	branch = .
	ignore = dirty
[submodule "docs/submodules/copper"]
	path = docs/submodules/copper
	url = ../copper
	branch = .
	ignore = dirty
[submodule "docs/submodules/daisy"]
	path = docs/submodules/daisy
	url = ../daisy
	branch = .
	ignore = dirty
[submodule "docs/submodules/domino"]
	path = docs/submodules/domino
	url = ../domino
	branch = .
	ignore = dirty
[submodule "docs/submodules/dovetail"]
	path = docs/submodules/dovetail
	url = ../dovetail
	branch = .
	ignore = dirty
[submodule "docs/submodules/escalator"]
	path = docs/submodules/escalator
	url = ../escalator
	branch = .
	ignore = dirty
[submodule "docs/submodules/fastpathmetrics"]
	path = docs/submodules/fastpathmetrics
	url = ../fastpathmetrics
	branch = .
	ignore = dirty
[submodule "docs/submodules/fds"]
	path = docs/submodules/fds
	url = ../fds
	branch = .
	ignore = dirty
[submodule "docs/submodules/fuel"]
	path = docs/submodules/fuel
	url = ../fuel
	branch = .
	ignore = dirty
[submodule "docs/submodules/functest"]
	path = docs/submodules/functest
	url = ../functest
	branch = .
	ignore = dirty
[submodule "docs/submodules/ipv6"]
	path = docs/submodules/ipv6
	url = ../ipv6
	branch = .
	ignore = dirty
[submodule "docs/submodules/joid"]
	path = docs/submodules/joid
	url = ../joid
	branch = .
	ignore = dirty
[submodule "docs/submodules/kvmfornfv"]
	path = docs/submodules/kvmfornfv
	url = ../kvmfornfv
	branch = .
	ignore = dirty
[submodule "docs/submodules/multisite"]
	path = docs/submodules/multisite
	url = ../multisite
	branch = .
	ignore = dirty
[submodule "docs/submodules/netready"]
	path = docs/submodules/netready
	url = ../netready
	branch = .
	ignore = dirty
[submodule "docs/submodules/nfvbench"]
	path = docs/submodules/nfvbench
	url = https://gerrit.opnfv.org/gerrit/nfvbench
	branch = .
	ignore = dirty
[submodule "docs/submodules/octopus"]
	path = docs/submodules/octopus
	url = ../octopus
	branch = .
	ignore = dirty
[submodule "docs/submodules/onosfw"]
	path = docs/submodules/onosfw
	url = ../onosfw
	branch = .
	ignore = dirty
[submodule "docs/submodules/orchestra"]
	path = docs/submodules/orchestra
	url = https://gerrit.opnfv.org/gerrit/orchestra
	branch = .
	ignore = dirty
[submodule "docs/submodules/ovn4nfv"]
	path = docs/submodules/ovn4nfv
	url = https://gerrit.opnfv.org/gerrit/ovn4nfv
	branch = .
	ignore = dirty
[submodule "docs/submodules/ovsnfv"]
	path = docs/submodules/ovsnfv
	url = ../ovsnfv
	branch = .
	ignore = dirty
[submodule "docs/submodules/parser"]
	path = docs/submodules/parser
	url = ../parser
	branch = .
	ignore = dirty
[submodule "docs/submodules/pharos"]
	path = docs/submodules/pharos
	url = ../pharos
	branch = .
	ignore = dirty
[submodule "docs/submodules/promise"]
	path = docs/submodules/promise
	url = ../promise
	branch = .
	ignore = dirty
[submodule "docs/submodules/qtip"]
	path = docs/submodules/qtip
	url = ../qtip
	branch = .
	ignore = dirty
[submodule "docs/submodules/releng"]
	path = docs/submodules/releng
	url = ../releng
	branch = master
[submodule "docs/submodules/sdnvpn"]
	path = docs/submodules/sdnvpn
	url = ../sdnvpn
	branch = .
	ignore = dirty
[submodule "docs/submodules/sfc"]
	path = docs/submodules/sfc
	url = ../sfc
	branch = .
	ignore = dirty
[submodule "docs/submodules/storperf"]
	path = docs/submodules/storperf
	url = ../storperf
	branch = .
	ignore = dirty
[submodule "docs/submodules/ves"]
	path = docs/submodules/ves
	url = ../ves
	branch = .
	ignore = dirty
[submodule "docs/submodules/vnf_forwarding_graph"]
	path = docs/submodules/vnf_forwarding_graph
	url = ../vnf_forwarding_graph
	branch = .
	ignore = dirty
[submodule "docs/submodules/vswitchperf"]
	path = docs/submodules/vswitchperf
	url = ../vswitchperf
	branch = .
	ignore = dirty
[submodule "docs/submodules/yardstick"]
	path = docs/submodules/yardstick
	url = ../yardstick
	branch = .
	ignore = dirty
[submodule "docs/submodules/doctor"]
	path = docs/submodules/doctor
	url = ../doctor
	branch = .
	ignore = dirty
[submodule "docs/submodules/availability"]
	path = docs/submodules/availability
	url = ../availability
	branch = .
	ignore = dirty
[submodule "docs/submodules/opera"]
	path = docs/submodules/opera
	url = ../opera
	branch = .
	ignore = dirty
[submodule "docs/submodules/samplevnf"]
	path = docs/submodules/samplevnf
	url = ../samplevnf
	branch = .
	ignore = dirty
[submodule "docs/submodules/snaps"]
	path = docs/submodules/snaps
	url = ../snaps
	branch = .
	ignore = dirty
[submodule "docs/submodules/barometer"]
	path = docs/submodules/barometer
	url = ../barometer
	branch = .
	ignore = dirty
[submodule "docs/submodules/infra"]
	path = docs/submodules/infra
	url = ../infra
	branch = .
	ignore = dirty
[submodule "docs/submodules/releng-xci"]
	path = docs/submodules/releng-xci
	url = ../releng-xci
	branch = .
	ignore = dirty
[submodule "docs/submodules/ovno"]
	path = docs/submodules/ovno
	url = https://gerrit.opnfv.org/gerrit/ovno
	branch = .
	ignore = dirty
[submodule "docs/submodules/moon"]
	path = docs/submodules/moon
	url = ../moon
	branch = .
	ignore = dirty