From 2ec6c91905aa22b551ec3c8cafb0b4a3434d2856 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Mon, 22 Mar 2021 13:31:14 -0500 Subject: [PATCH] deploy: Don't try to create symlinks on FAT /boot Code was introduced to make a symlink from /boot/boot to sysroot, which breaks for us when /boot is FAT (like on PAYG systems) Instead of using our mock-symlink code here, just avoid writing the symlink at all, as it's only for u-boot and syslinux' benefit, neither of which are used in PAYG. https://phabricator.endlessm.com/T31593 --- src/libostree/ostree-sysroot-deploy.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index 2b802100..b8a2d793 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -2314,11 +2314,18 @@ prepare_new_bootloader_link (OstreeSysroot *sysroot, int current_bootversion, in g_assert ((current_bootversion == 0 && new_bootversion == 1) || (current_bootversion == 1 && new_bootversion == 0)); + /* Check if we're on a FAT FS, and unable to symlink */ + gboolean fat = FALSE; + glnx_autofd int dest_dir_dfd = -1; + if (glnx_opendirat (sysroot->sysroot_fd, "boot", TRUE, &dest_dir_dfd, error)) + fat = fs_is_fat (dest_dir_dfd); + /* This allows us to support both /boot on a seperate filesystem to / as well * as on the same filesystem. */ - if (TEMP_FAILURE_RETRY (symlinkat (".", sysroot->sysroot_fd, "boot/boot")) < 0) - if (errno != EEXIST) - return glnx_throw_errno_prefix (error, "symlinkat"); + if (!fat) + if (TEMP_FAILURE_RETRY (symlinkat (".", sysroot->sysroot_fd, "boot/boot")) < 0) + if (errno != EEXIST) + return glnx_throw_errno_prefix (error, "symlinkat"); g_autofree char *new_target = g_strdup_printf ("loader.%d", new_bootversion);