Accepting request 928444 from home:michael-chang:branches:Base:System

- Remove openSUSE Tumbleweed specific handling for default grub
  distributor (bsc#1191198)
- Use /usr/lib/os-release as fallback (bsc#1191196)
  * grub2-default-distributor.patch
  * grub2-check-default.sh
- VUL-0: grub2: grub2-once uses fixed file name in /var/tmp (bsc#1190474)
  * grub2-once
  * grub2-once.service
- Fix unknown TPM error on buggy uefi firmware (bsc#1191504)
  * 0001-tpm-Pass-unknown-error-as-non-fatal-but-debug-print-.patch
- Fix error /boot/grub2/locale/POSIX.gmo not found (bsc#1189769)
  * 0001-Filter-out-POSIX-locale-for-translation.patch
- Fix error lvmid disk cannot be found after second disk added to the root
  volume group (bsc#1189874) (bsc#1071559)
  * 0001-ieee1275-implement-FCP-methods-for-WWPN-and-LUNs.patch
- Fix error in grub installation due to unnecessary requirement to support
  excessive device for the root logical volume (bsc#1184135)
  * 0001-disk-diskfilter-Use-nodes-in-logical-volume-s-segmen.patch
- Fix regression in reading xfs v4
  *0001-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch

OBS-URL: https://build.opensuse.org/request/show/928444
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=396
This commit is contained in:
Michael Chang 2021-11-02 05:52:57 +00:00 committed by Git OBS Bridge
parent 8a98abff7e
commit da8194b45d
11 changed files with 603 additions and 42 deletions

View File

@ -0,0 +1,36 @@
From 87b01d35b4db56778e2d9f99d18656026f818bab Mon Sep 17 00:00:00 2001
From: Michael Chang <mchang@suse.com>
Date: Tue, 26 Oct 2021 13:31:24 +0800
Subject: [PATCH] Filter out POSIX locale for translation
The POSIX locale is default or native operating system's locale
identical to the C locale, so no translation to human speaking languages
provided.
For this reason we should filter out LANG=POSIX as well as LANG=C upon
generating grub.cfg to avoid looking up for it's gettext's message
catalogs that will consequently result in the unpleasant message.
error: file `/boot/grub/locale/POSIX.gmo' not found
Signed-off-by: Michael Chang <mchang@suse.com>
---
util/grub.d/00_header.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 57a35a14a..b21caa4bc 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -250,7 +250,7 @@ EOF
EOF
# Gettext variables and module
-if [ "x${LANG}" != "xC" ] && [ "x${LANG}" != "x" ]; then
+if [ "x${LANG}" != "xC" ] && [ "x${LANG}" != "xPOSIX" ] && [ "x${LANG}" != "x" ]; then
cat << EOF
set locale_dir=\$prefix/locale
set lang=${grub_lang}
--
2.31.1

View File

@ -0,0 +1,180 @@
From 5cc00eac24c7019d9696a859f69b587e11f1621e Mon Sep 17 00:00:00 2001
From: Michael Chang <mchang@suse.com>
Date: Mon, 27 Sep 2021 17:39:56 +0800
Subject: [PATCH] disk/diskfilter: Use nodes in logical volume's segment as
member device
Currently the grub_diskfilter_memberlist() function returns all physical
volumes added to a volume group to which a logical volume (LV) belongs.
However, this is suboptimal as it doesn't fit the intended behavior of
returning underlying devices that make up the LV. To give a clear
picture, the result should be identical to running commands below to
display the logical volumes with underlying physical volumes in use.
localhost:~ # lvs -o lv_name,vg_name,devices /dev/system/root
LV VG Devices
root system /dev/vda2(512)
localhost:~ # lvdisplay --maps /dev/system/root
--- Logical volume ---
...
--- Segments ---
Logical extents 0 to 4604:
Type linear
Physical volume /dev/vda2
Physical extents 512 to 5116
As shown above, we can know system-root LV uses only /dev/vda2 to
allocate it's extents, or we can say that /dev/vda2 is the member device
comprising the system-root LV.
It is important to be precise on the member devices, because that helps
to avoid pulling in excessive dependency. Let's use an example to
demonstrate why it is needed.
localhost:~ # findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/system-root ext4 rw,relatime
localhost:~ # pvs
PV VG Fmt Attr PSize PFree
/dev/mapper/data system lvm2 a-- 1020.00m 0
/dev/vda2 system lvm2 a-- 19.99g 0
localhost:~ # cryptsetup status /dev/mapper/data
/dev/mapper/data is active and is in use.
type: LUKS1
cipher: aes-xts-plain64
keysize: 512 bits
key location: dm-crypt
device: /dev/vdb
sector size: 512
offset: 4096 sectors
size: 2093056 sectors
mode: read/write
localhost:~ # vgs
VG #PV #LV #SN Attr VSize VFree
system 2 3 0 wz--n- 20.98g 0
localhost:~ # lvs -o lv_name,vg_name,devices
LV VG Devices
data system /dev/mapper/data(0)
root system /dev/vda2(512)
swap system /dev/vda2(0)
We can learn from above that /dev/mapper/data is an encrypted volume and
also gets assigned to volume group "system" as one of it's physical
volumes. And also it is not used by root device, /dev/mapper/system-root,
for allocating extents, so it shouldn't be taking part in the process of
setting up GRUB to access root device.
However, running grub-install reports error as volume group "system"
contains encrypted volume.
error: attempt to install to encrypted disk without cryptodisk
enabled. Set `GRUB_ENABLE_CRYPTODISK=y' in file `/etc/default/grub'.
Certainly we can enable GRUB_ENABLE_CRYPTODISK=y and move on, but that
is not always acceptable since the server may need to be booted unattended.
Additionally, typing passphrase for every system startup can be a big
hassle of which most users would like to avoid.
This patch solves the problem by returning exact physical volume, /dev/vda2,
rightly used by system-root from the example above, thus grub-install will
not error out because the excessive encrypted device to boot the root device
is not configured.
Signed-off-by: Michael Chang <mchang@suse.com>
Tested-by: Olav Reinert <seroton10@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
grub-core/disk/diskfilter.c | 61 ++++++++++++++++++++++++++-----------
1 file changed, 44 insertions(+), 17 deletions(-)
diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c
index d094f7882..39d74cb86 100644
--- a/grub-core/disk/diskfilter.c
+++ b/grub-core/disk/diskfilter.c
@@ -396,6 +396,8 @@ grub_diskfilter_memberlist (grub_disk_t disk)
grub_disk_dev_t p;
struct grub_diskfilter_vg *vg;
struct grub_diskfilter_lv *lv2 = NULL;
+ struct grub_diskfilter_segment *seg;
+ unsigned int i, j;
if (!lv->vg->pvs)
return NULL;
@@ -427,27 +429,52 @@ grub_diskfilter_memberlist (grub_disk_t disk)
}
}
- for (pv = lv->vg->pvs; pv; pv = pv->next)
- {
- if (!pv->disk)
+ for (i = 0, seg = lv->segments; i < lv->segment_count; i++, seg++)
+ for (j = 0; j < seg->node_count; ++j)
+ if (seg->nodes[j].pv != NULL)
{
- /* TRANSLATORS: This message kicks in during the detection of
- which modules needs to be included in core image. This happens
- in the case of degraded RAID and means that autodetection may
- fail to include some of modules. It's an installation time
- message, not runtime message. */
- grub_util_warn (_("Couldn't find physical volume `%s'."
- " Some modules may be missing from core image."),
- pv->name);
- continue;
+ pv = seg->nodes[j].pv;
+
+ if (pv->disk == NULL)
+ {
+ /*
+ * TRANSLATORS: This message kicks in during the detection of
+ * which modules needs to be included in core image. This happens
+ * in the case of degraded RAID and means that autodetection may
+ * fail to include some of modules. It's an installation time
+ * message, not runtime message.
+ */
+ grub_util_warn (_("Couldn't find physical volume `%s'."
+ " Some modules may be missing from core image."),
+ pv->name);
+ continue;
+ }
+
+ for (tmp = list; tmp != NULL; tmp = tmp->next)
+ if (!grub_strcmp (tmp->disk->name, pv->disk->name))
+ break;
+ if (tmp != NULL)
+ continue;
+
+ tmp = grub_malloc (sizeof (*tmp));
+ if (tmp == NULL)
+ goto fail;
+ tmp->disk = pv->disk;
+ tmp->next = list;
+ list = tmp;
}
- tmp = grub_malloc (sizeof (*tmp));
- tmp->disk = pv->disk;
- tmp->next = list;
- list = tmp;
- }
return list;
+
+ fail:
+ while (list != NULL)
+ {
+ tmp = list;
+ list = list->next;
+ grub_free (tmp);
+ }
+
+ return NULL;
}
void
--
2.31.1

View File

@ -0,0 +1,120 @@
From 7c11f4f3d71c3fc8acff820b1fd449c94095dab9 Mon Sep 17 00:00:00 2001
From: Erwan Velu <erwanaliasr1@gmail.com>
Date: Wed, 25 Aug 2021 15:31:52 +0200
Subject: [PATCH] fs/xfs: Fix unreadable filesystem with v4 superblock
The commit 8b1e5d193 (fs/xfs: Add bigtime incompat feature support)
introduced the bigtime support by adding some features in v3 inodes.
This change extended grub_xfs_inode struct by 76 bytes but also changed
the computation of XFS_V2_INODE_SIZE and XFS_V3_INODE_SIZE. Prior this
commit, XFS_V2_INODE_SIZE was 100 bytes. After the commit it's 84 bytes
XFS_V2_INODE_SIZE becomes 16 bytes too small.
As a result, the data structures aren't properly aligned and the GRUB
generates "attempt to read or write outside of partition" errors when
trying to read the XFS filesystem:
GNU GRUB version 2.11
....
grub> set debug=efi,gpt,xfs
grub> insmod part_gpt
grub> ls (hd0,gpt1)/
partmap/gpt.c:93: Read a valid GPT header
partmap/gpt.c:115: GPT entry 0: start=4096, length=1953125
fs/xfs.c:931: Reading sb
fs/xfs.c:270: Validating superblock
fs/xfs.c:295: XFS v4 superblock detected
fs/xfs.c:962: Reading root ino 128
fs/xfs.c:515: Reading inode (128) - 64, 0
fs/xfs.c:515: Reading inode (739521961424144223) - 344365866970255880, 3840
error: attempt to read or write outside of partition.
This commit change the XFS_V2_INODE_SIZE computation by subtracting 76
bytes instead of 92 bytes from the actual size of grub_xfs_inode struct.
This 76 bytes value comes from added members:
20 grub_uint8_t unused5
1 grub_uint64_t flags2
48 grub_uint8_t unused6
This patch explicitly splits the v2 and v3 parts of the structure.
The unused4 is still ending of the v2 structures and the v3 starts
at unused5. Thanks to this we will avoid future corruptions of v2
or v3 inodes.
The XFS_V2_INODE_SIZE is returning to its expected size and the
filesystem is back to a readable state:
GNU GRUB version 2.11
....
grub> set debug=efi,gpt,xfs
grub> insmod part_gpt
grub> ls (hd0,gpt1)/
partmap/gpt.c:93: Read a valid GPT header
partmap/gpt.c:115: GPT entry 0: start=4096, length=1953125
fs/xfs.c:931: Reading sb
fs/xfs.c:270: Validating superblock
fs/xfs.c:295: XFS v4 superblock detected
fs/xfs.c:962: Reading root ino 128
fs/xfs.c:515: Reading inode (128) - 64, 0
fs/xfs.c:515: Reading inode (128) - 64, 0
fs/xfs.c:931: Reading sb
fs/xfs.c:270: Validating superblock
fs/xfs.c:295: XFS v4 superblock detected
fs/xfs.c:962: Reading root ino 128
fs/xfs.c:515: Reading inode (128) - 64, 0
fs/xfs.c:515: Reading inode (128) - 64, 0
fs/xfs.c:515: Reading inode (128) - 64, 0
fs/xfs.c:515: Reading inode (131) - 64, 768
efi/ fs/xfs.c:515: Reading inode (3145856) - 1464904, 0
grub2/ fs/xfs.c:515: Reading inode (132) - 64, 1024
grub/ fs/xfs.c:515: Reading inode (139) - 64, 2816
grub>
Fixes: 8b1e5d193 (fs/xfs: Add bigtime incompat feature support)
Signed-off-by: Erwan Velu <e.velu@criteo.com>
Tested-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
grub-core/fs/xfs.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
index 0f524c3a8..e3816d1ec 100644
--- a/grub-core/fs/xfs.c
+++ b/grub-core/fs/xfs.c
@@ -192,6 +192,11 @@ struct grub_xfs_time_legacy
grub_uint32_t nanosec;
} GRUB_PACKED;
+/*
+ * The struct grub_xfs_inode layout was taken from the
+ * struct xfs_dinode_core which is described here:
+ * https://mirrors.edge.kernel.org/pub/linux/utils/fs/xfs/docs/xfs_filesystem_structure.pdf
+ */
struct grub_xfs_inode
{
grub_uint8_t magic[2];
@@ -208,14 +213,15 @@ struct grub_xfs_inode
grub_uint32_t nextents;
grub_uint16_t unused3;
grub_uint8_t fork_offset;
- grub_uint8_t unused4[37];
+ grub_uint8_t unused4[17]; /* Last member of inode v2. */
+ grub_uint8_t unused5[20]; /* First member of inode v3. */
grub_uint64_t flags2;
- grub_uint8_t unused5[48];
+ grub_uint8_t unused6[48]; /* Last member of inode v3. */
} GRUB_PACKED;
#define XFS_V3_INODE_SIZE sizeof(struct grub_xfs_inode)
-/* Size of struct grub_xfs_inode until fork_offset (included). */
-#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 92)
+/* Size of struct grub_xfs_inode v2, up to unused4 member included. */
+#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 76)
struct grub_xfs_dirblock_tail
{
--
2.31.1

View File

@ -0,0 +1,146 @@
From a37d0cc089edd66ab35f1a27b0da09dd2f02deb3 Mon Sep 17 00:00:00 2001
From: Diego Domingos <diegodo@br.ibm.com>
Date: Mon, 24 Jun 2019 10:15:56 -0400
Subject: [PATCH] ieee1275: implement FCP methods for WWPN and LUNs
This patch enables the fcp-targets and fcp-luns methods which are
responsible to get WWPNs and LUNs for fibre channel devices.
Those methods are specially necessary if the boot directory and grub
installation are in different FCP disks, allowing the dev_iterate()
to find the WWPNs and LUNs when called by searchfs.uuid tool.
---
grub-core/disk/ieee1275/ofdisk.c | 117 ++++++++++++++++++++++++++++++-
1 file changed, 116 insertions(+), 1 deletion(-)
diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c
index ea7f78ac7..258a6e389 100644
--- a/grub-core/disk/ieee1275/ofdisk.c
+++ b/grub-core/disk/ieee1275/ofdisk.c
@@ -209,7 +209,122 @@ dev_iterate_real (const char *name, const char *path)
static void
dev_iterate (const struct grub_ieee1275_devalias *alias)
{
- if (grub_strcmp (alias->type, "vscsi") == 0)
+ if (grub_strcmp (alias->type, "fcp") == 0)
+ {
+
+ /* If we are dealing with fcp devices, we need
+ * to find the WWPNs and LUNs to iterate them */
+ grub_ieee1275_ihandle_t ihandle;
+ grub_uint64_t *ptr_targets, *ptr_luns, k, l;
+ unsigned int i, j, pos;
+ char *buf, *bufptr;
+
+ struct set_fcp_targets_args
+ {
+ struct grub_ieee1275_common_hdr common;
+ grub_ieee1275_cell_t method;
+ grub_ieee1275_cell_t ihandle;
+ grub_ieee1275_cell_t catch_result;
+ grub_ieee1275_cell_t nentries;
+ grub_ieee1275_cell_t table;
+ } args_targets;
+
+ struct set_fcp_luns_args
+ {
+ struct grub_ieee1275_common_hdr common;
+ grub_ieee1275_cell_t method;
+ grub_ieee1275_cell_t ihandle;
+ grub_ieee1275_cell_t wwpn_h;
+ grub_ieee1275_cell_t wwpn_l;
+ grub_ieee1275_cell_t catch_result;
+ grub_ieee1275_cell_t nentries;
+ grub_ieee1275_cell_t table;
+ } args_luns;
+
+ struct args_ret
+ {
+ grub_uint64_t addr;
+ grub_uint64_t len;
+ };
+
+ if(grub_ieee1275_open (alias->path, &ihandle))
+ {
+ grub_dprintf("disk", "failed to open the disk while iterating FCP disk path=%s\n", alias->path);
+ return;
+ }
+
+ /* Setup the fcp-targets method to call via pfw*/
+ INIT_IEEE1275_COMMON (&args_targets.common, "call-method", 2, 3);
+ args_targets.method = (grub_ieee1275_cell_t) "fcp-targets";
+ args_targets.ihandle = ihandle;
+
+ /* Setup the fcp-luns method to call via pfw */
+ INIT_IEEE1275_COMMON (&args_luns.common, "call-method", 4, 3);
+ args_luns.method = (grub_ieee1275_cell_t) "fcp-luns";
+ args_luns.ihandle = ihandle;
+
+ if (IEEE1275_CALL_ENTRY_FN (&args_targets) == -1)
+ {
+ grub_dprintf("disk", "failed to get the targets while iterating FCP disk path=%s\n", alias->path);
+ grub_ieee1275_close(ihandle);
+ return;
+ }
+
+ buf = grub_malloc (grub_strlen (alias->path) + 32 + 32);
+
+ if (!buf)
+ {
+ grub_ieee1275_close(ihandle);
+ return;
+ }
+
+ bufptr = grub_stpcpy (buf, alias->path);
+
+ /* Iterate over entries returned by pfw. Each entry contains a
+ * pointer to wwpn table and his length. */
+ struct args_ret *targets_table = (struct args_ret *)(args_targets.table);
+ for (i=0; i< args_targets.nentries; i++)
+ {
+ ptr_targets = (grub_uint64_t*)(grub_uint32_t) targets_table[i].addr;
+ /* Iterate over all wwpns in given table */
+ for(k=0;k<targets_table[i].len;k++)
+ {
+ args_luns.wwpn_l = (grub_ieee1275_cell_t) (*ptr_targets);
+ args_luns.wwpn_h = (grub_ieee1275_cell_t) (*ptr_targets >> 32);
+ pos=grub_snprintf (bufptr, 32, "/disk@%" PRIxGRUB_UINT64_T,
+ *ptr_targets++);
+ /* Get the luns for given wwpn target */
+ if (IEEE1275_CALL_ENTRY_FN (&args_luns) == -1)
+ {
+ grub_dprintf("disk", "failed to get the LUNS while iterating FCP disk path=%s\n", buf);
+ grub_ieee1275_close (ihandle);
+ grub_free (buf);
+ return;
+ }
+
+ struct args_ret *luns_table = (struct args_ret *)(args_luns.table);
+
+ /* Iterate over all LUNs */
+ for(j=0;j<args_luns.nentries; j++)
+ {
+ ptr_luns = (grub_uint64_t*) (grub_uint32_t) luns_table[j].addr;
+ for(l=0;l<luns_table[j].len;l++)
+ {
+ grub_snprintf (&bufptr[pos], 30, ",%" PRIxGRUB_UINT64_T,
+ *ptr_luns++);
+ dev_iterate_real(buf,buf);
+ }
+ }
+
+ }
+ }
+
+ grub_ieee1275_close (ihandle);
+ grub_free (buf);
+ return;
+
+ }
+ else if (grub_strcmp (alias->type, "vscsi") == 0)
{
static grub_ieee1275_ihandle_t ihandle;
struct set_color_args
--
2.31.1

View File

@ -0,0 +1,29 @@
From 2cecb472ffba4dbc534f4ce3346a453762371c52 Mon Sep 17 00:00:00 2001
From: Mathieu Trudel-Lapierre <mathieu.tl@gmail.com>
Date: Fri, 25 Oct 2019 10:27:54 -0400
Subject: [PATCH] tpm: Pass unknown error as non-fatal, but debug print the
error we got
Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
Patch-Name: ubuntu-tpm-unknown-error-non-fatal.patch
---
grub-core/commands/efi/tpm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c
index a97d85368..1e399a964 100644
--- a/grub-core/commands/efi/tpm.c
+++ b/grub-core/commands/efi/tpm.c
@@ -145,7 +145,8 @@ grub_efi_log_event_status (grub_efi_status_t status)
case GRUB_EFI_NOT_FOUND:
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable"));
default:
- return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error"));
+ grub_dprintf("tpm", "Unknown TPM error: %" PRIdGRUB_SSIZE, status);
+ return 0;
}
}
--
2.31.1

View File

@ -99,7 +99,25 @@ if [ -n "$FALLBACK" ]; then
exit 0
fi
source /etc/os-release
for i in /etc/os-release /usr/lib/os-release ; do
if [ -f "$i" ]; then
OS_RELEASE="$i"
break
fi
done
if [ -z "$OS_RELEASE" ]; then
debug_print "No os-release file present"
exit 0
fi
debug_print "Applying settings from $OS_RELEASE"
source "$OS_RELEASE"
if [ -z "$VERSION" ]; then
debug_print "No os-release version tag present, assuming rolling release"
exit 0
fi
NEW_SAVED_ENTRY=`echo $SAVED_ENTRY | sed -ne "s/$NAME [0-9a-zA-Z_.-]\{1,\}/$NAME $VERSION/pg"`

View File

@ -1,8 +1,16 @@
Index: grub-2.02~beta3/grub-core/osdep/unix/config.c
v1:
As long as VERSION in /etc/os-release has been commented out for rolling
release, we can replace openSUSE Tumbleweed specific handling for grub
distributor with a generic one.
v2:
Use /usr/lib/os-release as fallback to /etc/os-release
Index: grub-2.06/grub-core/osdep/unix/config.c
===================================================================
--- grub-2.02~beta3.orig/grub-core/osdep/unix/config.c
+++ grub-2.02~beta3/grub-core/osdep/unix/config.c
@@ -61,6 +61,143 @@ grub_util_get_localedir (void)
--- grub-2.06.orig/grub-core/osdep/unix/config.c
+++ grub-2.06/grub-core/osdep/unix/config.c
@@ -61,6 +61,131 @@ grub_util_get_localedir (void)
return LOCALEDIR;
}
@ -69,7 +77,6 @@ Index: grub-2.02~beta3/grub-core/osdep/unix/config.c
+ char *cfgfile;
+ char buf[1024];
+ FILE *fp = NULL;
+ char *os_pretty_name = NULL;
+ char *os_name = NULL;
+ char *os_version = NULL;
+
@ -77,7 +84,12 @@ Index: grub-2.02~beta3/grub-core/osdep/unix/config.c
+ if (!grub_util_is_regular (cfgfile))
+ {
+ grub_free (cfgfile);
+ return NULL;
+ cfgfile = grub_util_path_concat (2, "/usr/lib", "os-release");
+ if (!grub_util_is_regular (cfgfile))
+ {
+ grub_free (cfgfile);
+ return NULL;
+ }
+ }
+
+ fp = grub_util_fopen (cfgfile, "r");
@ -97,30 +109,19 @@ Index: grub-2.02~beta3/grub-core/osdep/unix/config.c
+ if (buf[grub_strlen(buf) - 1] == '\n')
+ buf[grub_strlen(buf) - 1] = '\0';
+
+ if (!os_pretty_name
+ && (os_pretty_name = os_release_get_val (buf, "PRETTY_NAME")))
+ continue;
+ if (!os_name
+ && (os_name = os_release_get_val (buf, "NAME")))
+ continue;
+ if (!os_version
+ && (os_version = os_release_get_val (buf, "VERSION")))
+ continue;
+ if (os_pretty_name && os_name && os_version)
+ if (os_name && os_version)
+ break;
+ }
+
+ fclose (fp);
+
+ if (os_name && grub_strncmp (os_name, "openSUSE Tumbleweed", sizeof ("openSUSE Tumbleweed") - 1) == 0)
+ {
+ grub_free (os_name);
+ if (os_version)
+ grub_free (os_version);
+
+ return os_pretty_name;
+ }
+ else if (os_name && os_version)
+ if (os_name && os_version)
+ {
+ char *os_name_version;
+
@ -128,16 +129,11 @@ Index: grub-2.02~beta3/grub-core/osdep/unix/config.c
+
+ grub_free (os_name);
+ grub_free (os_version);
+ if (os_pretty_name)
+ grub_free (os_pretty_name);
+
+ return os_name_version;
+ }
+
+ if (os_pretty_name)
+ grub_free (os_pretty_name);
+ if (os_version)
+ grub_free (os_version);
+ grub_free (os_version);
+
+ return os_name;
+}
@ -146,7 +142,7 @@ Index: grub-2.02~beta3/grub-core/osdep/unix/config.c
void
grub_util_load_config (struct grub_util_config *cfg)
{
@@ -125,7 +262,17 @@ grub_util_load_config (struct grub_util_
@@ -125,7 +250,17 @@ grub_util_load_config (struct grub_util_
waitpid (pid, NULL, 0);
}
if (f)
@ -165,7 +161,7 @@ Index: grub-2.02~beta3/grub-core/osdep/unix/config.c
f = grub_util_fopen (cfgfile, "r");
if (f)
@@ -136,4 +283,13 @@ grub_util_load_config (struct grub_util_
@@ -136,4 +271,13 @@ grub_util_load_config (struct grub_util_
else
grub_util_warn (_("cannot open configuration file `%s': %s"),
cfgfile, strerror (errno));
@ -179,20 +175,25 @@ Index: grub-2.02~beta3/grub-core/osdep/unix/config.c
+ }
+#endif
}
Index: grub-2.02~beta3/util/grub-mkconfig.in
Index: grub-2.06/util/grub-mkconfig.in
===================================================================
--- grub-2.02~beta3.orig/util/grub-mkconfig.in
+++ grub-2.02~beta3/util/grub-mkconfig.in
@@ -206,6 +206,14 @@ GRUB_ACTUAL_DEFAULT="$GRUB_DEFAULT"
--- grub-2.06.orig/util/grub-mkconfig.in
+++ grub-2.06/util/grub-mkconfig.in
@@ -225,6 +225,19 @@ GRUB_ACTUAL_DEFAULT="$GRUB_DEFAULT"
if [ "x${GRUB_ACTUAL_DEFAULT}" = "xsaved" ] ; then GRUB_ACTUAL_DEFAULT="`"${grub_editenv}" - list | sed -n '/^saved_entry=/ s,^saved_entry=,,p'`" ; fi
+if [ x"${GRUB_DISTRIBUTOR}" = x ] && [ -f "${sysconfdir}/os-release" ] ; then
+ . "${sysconfdir}/os-release"
+ if echo "$NAME" | grep -q "^openSUSE Tumbleweed" ; then
+ GRUB_DISTRIBUTOR="${PRETTY_NAME}"
+ else
+if [ x"${GRUB_DISTRIBUTOR}" = x ] ; then
+ for i in "${sysconfdir}/os-release" "/usr/lib/os-release" ; do
+ if [ -f "$i" ] ; then
+ . "$i"
+ break
+ fi
+ done
+ if [ x"${NAME}" != x ] && [ x"${VERSION}" != x ] ; then
+ GRUB_DISTRIBUTOR="${NAME} ${VERSION}"
+ else
+ GRUB_DISTRIBUTOR="${NAME}"
+ fi
+fi

View File

@ -178,10 +178,12 @@ sub parse_menuentry($$$) {
sub enable_restore_grubenv_service {
my $systemctl = "/usr/bin/systemctl";
my $cleanup = "/var/tmp/grub2-cleanup-once";
my $cleanup = "/var/lib/misc/grub2-cleanup-once";
open(my $fh, ">", $cleanup) or die "open: $cleanup $!\n";
close($fh);
unless (-e $cleanup) {
open(my $fh, ">", $cleanup) or die "open: $cleanup $!\n";
close($fh);
}
return 0 if (system("$systemctl --quiet is-enabled grub2-once") == 0);
system "$systemctl --no-reload enable grub2-once >/dev/null 2>&1";

View File

@ -5,12 +5,12 @@ After=local-fs.target
Before=sysinit.target shutdown.target
Conflicts=shutdown.target
ConditionPathIsReadWrite=/boot/grub2/grubenv
ConditionPathExists=/var/tmp/grub2-cleanup-once
ConditionPathExists=/var/lib/misc/grub2-cleanup-once
[Service]
Type=oneshot
ExecStart=-/usr/bin/grub2-editenv /boot/grub2/grubenv unset next_entry
ExecStartPost=-/usr/bin/rm -f /var/tmp/grub2-cleanup-once
ExecStartPost=-/usr/bin/rm -f /var/lib/misc/grub2-cleanup-once
StandardOutput=journal
[Install]

View File

@ -1,3 +1,27 @@
-------------------------------------------------------------------
Thu Oct 21 12:51:46 UTC 2021 - Michael Chang <mchang@suse.com>
- Remove openSUSE Tumbleweed specific handling for default grub
distributor (bsc#1191198)
- Use /usr/lib/os-release as fallback (bsc#1191196)
* grub2-default-distributor.patch
* grub2-check-default.sh
- VUL-0: grub2: grub2-once uses fixed file name in /var/tmp (bsc#1190474)
* grub2-once
* grub2-once.service
- Fix unknown TPM error on buggy uefi firmware (bsc#1191504)
* 0001-tpm-Pass-unknown-error-as-non-fatal-but-debug-print-.patch
- Fix error /boot/grub2/locale/POSIX.gmo not found (bsc#1189769)
* 0001-Filter-out-POSIX-locale-for-translation.patch
- Fix error lvmid disk cannot be found after second disk added to the root
volume group (bsc#1189874) (bsc#1071559)
* 0001-ieee1275-implement-FCP-methods-for-WWPN-and-LUNs.patch
- Fix error in grub installation due to unnecessary requirement to support
excessive device for the root logical volume (bsc#1184135)
* 0001-disk-diskfilter-Use-nodes-in-logical-volume-s-segmen.patch
- Fix regression in reading xfs v4
*0001-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch
-------------------------------------------------------------------
Tue Oct 19 08:26:50 UTC 2021 - Fabian Vogt <fvogt@suse.com>

View File

@ -307,6 +307,11 @@ Patch789: 0001-Workaround-volatile-efi-boot-variable.patch
Patch790: 0001-30_uefi-firmware-fix-printf-format-with-null-byte.patch
Patch791: 0001-i386-pc-build-btrfs-zstd-support-into-separate-modul.patch
Patch792: 0001-templates-Follow-the-path-of-usr-merged-kernel-confi.patch
Patch793: 0001-tpm-Pass-unknown-error-as-non-fatal-but-debug-print-.patch
Patch794: 0001-Filter-out-POSIX-locale-for-translation.patch
Patch795: 0001-ieee1275-implement-FCP-methods-for-WWPN-and-LUNs.patch
Patch796: 0001-disk-diskfilter-Use-nodes-in-logical-volume-s-segmen.patch
Patch797: 0001-fs-xfs-Fix-unreadable-filesystem-with-v4-superblock.patch
Requires: gettext-runtime
%if 0%{?suse_version} >= 1140