From c28d6fa9505da5353a0fd51e6398b2421aeb4453 Mon Sep 17 00:00:00 2001 From: Coiby Xu Date: Tue, 18 Apr 2023 15:25:48 +0800 Subject: [PATCH] Tell nmcli to not escape colon when getting the path of connection profile Resolves: bz2151504 Upstream: Fedora Conflict: None commit df6f25ff20a660ce8c300eba95e21e2fed6ed99f Author: Coiby Xu Date: Mon Mar 27 13:17:32 2023 +0800 Tell nmcli to not escape colon when getting the path of connection profile Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2151504 When a NetworManager connection profile contains a colon in the name, "nmcli --get-values UUID,FILENAME" by default would escape the colon because a colon is also used for separating the values. In this case, 99kdumpbase fails to get the correct connection profile path, kdumpctl[5439]: cp: cannot stat '/run/NetworkManager/system-connections/static-52\\\:54\\\:01.nmconnection': No such file or directory kdumpctl[5440]: sed: can't read /tmp/1977-DRACUT_KDUMP_NM/ifcfg-static-52-54-01: No such file or directory kdumpctl[5449]: dracut-install: ERROR: installing '/tmp/1977-DRACUT_KDUMP_NM/ifcfg-static-52-54-01' to '/etc/NetworkManager/system-connections/ifcfg-static-52-54-01' As a result, dumping vmcore to a remote nfs would fail. In our case of getting connection profile path, there is no need to escape the colon so pass "-escape no" to nmcli, [root@localhost ~]# nmcli --get-values UUID,FILENAME c show 659e09c1-a6bd-3549-9be4-a07a1a9a8ffd:/etc/NetworkManager/system-connections/aa\:bb.nmconnection [root@localhost ~]# nmcli -escape no --get-values UUID,FILENAME c show 659e09c1-a6bd-3549-9be4-a07a1a9a8ffd:/etc/NetworkManager/system-connections/aa:bb.nmconnection Suggested-by: Beniamino Galvani Reported-by: Martin Pitt Signed-off-by: Coiby Xu Reviewed-by: Philipp Rudo Signed-off-by: Coiby Xu --- dracut-module-setup.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index d01c5d9..6eac2ae 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -315,7 +315,9 @@ clone_and_modify_nmconnection() { # connection profile based on MAC address _match_nmconnection_by_mac "$_uuid" "$_dev" - _cloned_nmconnection_file_path=$(nmcli --get-values UUID,FILENAME connection show | sed -n "s/^${_uuid}://p") + # If a value contain ":", nmcli by default escape it with "\:" because it + # also uses ":" as the delimiter to separate values. In our case, escaping is not needed. + _cloned_nmconnection_file_path=$(nmcli --escape no --get-values UUID,FILENAME connection show | sed -n "s/^${_uuid}://p") _tmp_nmconnection_file_path=$_DRACUT_KDUMP_NM_TMP_DIR/$(basename "$_nmconnection_file_path") cp "$_cloned_nmconnection_file_path" "$_tmp_nmconnection_file_path" # change uuid back to old value in case it's refered by other connection