* [PATCH] grub-core: Pass -P to zpool status
@ 2022-11-07 23:22 Arsen Arsenović
2022-11-08 16:30 ` Daniel Kiper
0 siblings, 1 reply; 3+ messages in thread
From: Arsen Arsenović @ 2022-11-07 23:22 UTC (permalink / raw)
To: grub-devel; +Cc: Arsen Arsenović
zpool status by default prints basenames of VDEVs, which means that GRUB
would have to go around guessing to see whether a VDEV exists. Instead,
it'd be more robust to simply tell zpool to give us full paths to VDEVs
via -P.
---
Hey there,
While setting up a new GNU+Linux install on a ZFS root, using /dev/disk/by-id/
aliases for VDEVs rather than just /dev/?d* nodes, grub-mkconfig started
failing as a result of (for instance) /dev/ata-... not existing. This was
caused by a workaround for zfs status not printing full paths to VDEVs by
default, but this can be solved more directly by just telling zpool status to
print full paths instead.
Apologies if I missed anything, I'm writing this in a hurry during a very
hectic week.
Thanks!
grub-core/osdep/unix/getroot.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c
index 7d2a29f31..cde821eb9 100644
--- a/grub-core/osdep/unix/getroot.c
+++ b/grub-core/osdep/unix/getroot.c
@@ -229,14 +229,15 @@ grub_util_find_root_devices_from_poolname (char *poolname)
char name[PATH_MAX + 1], state[257], readlen[257], writelen[257];
char cksum[257], notes[257];
unsigned int dummy;
- const char *argv[4];
+ const char *argv[5];
pid_t pid;
int fd;
argv[0] = "zpool";
argv[1] = "status";
- argv[2] = poolname;
- argv[3] = NULL;
+ argv[2] = "-P";
+ argv[3] = poolname;
+ argv[4] = NULL;
pid = grub_util_exec_pipe (argv, &fd);
if (!pid)
--
2.38.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] grub-core: Pass -P to zpool status
2022-11-07 23:22 [PATCH] grub-core: Pass -P to zpool status Arsen Arsenović
@ 2022-11-08 16:30 ` Daniel Kiper
2022-11-08 17:42 ` Arsen Arsenović
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Kiper @ 2022-11-08 16:30 UTC (permalink / raw)
To: Arsen Arsenović; +Cc: grub-devel
On Tue, Nov 08, 2022 at 12:22:36AM +0100, Arsen Arsenović via Grub-devel wrote:
> zpool status by default prints basenames of VDEVs, which means that GRUB
> would have to go around guessing to see whether a VDEV exists. Instead,
> it'd be more robust to simply tell zpool to give us full paths to VDEVs
> via -P.
Missing "Signed-off-by: Arsen Arsenović <arsen@aarsen.me>" line.
I can add it on your behalf if you are OK with it.
Otherwise Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>...
I will commit this patch in a week or so if I do not hear any objections
from folks more experienced with ZFS than I.
Daniel
> ---
> Hey there,
>
> While setting up a new GNU+Linux install on a ZFS root, using /dev/disk/by-id/
> aliases for VDEVs rather than just /dev/?d* nodes, grub-mkconfig started
> failing as a result of (for instance) /dev/ata-... not existing. This was
> caused by a workaround for zfs status not printing full paths to VDEVs by
> default, but this can be solved more directly by just telling zpool status to
> print full paths instead.
>
> Apologies if I missed anything, I'm writing this in a hurry during a very
> hectic week.
>
> Thanks!
>
> grub-core/osdep/unix/getroot.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c
> index 7d2a29f31..cde821eb9 100644
> --- a/grub-core/osdep/unix/getroot.c
> +++ b/grub-core/osdep/unix/getroot.c
> @@ -229,14 +229,15 @@ grub_util_find_root_devices_from_poolname (char *poolname)
> char name[PATH_MAX + 1], state[257], readlen[257], writelen[257];
> char cksum[257], notes[257];
> unsigned int dummy;
> - const char *argv[4];
> + const char *argv[5];
> pid_t pid;
> int fd;
>
> argv[0] = "zpool";
> argv[1] = "status";
> - argv[2] = poolname;
> - argv[3] = NULL;
> + argv[2] = "-P";
> + argv[3] = poolname;
> + argv[4] = NULL;
>
> pid = grub_util_exec_pipe (argv, &fd);
> if (!pid)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-08 17:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-07 23:22 [PATCH] grub-core: Pass -P to zpool status Arsen Arsenović
2022-11-08 16:30 ` Daniel Kiper
2022-11-08 17:42 ` Arsen Arsenović
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.