Compare commits

3 Commits
main ... 1.1

8 changed files with 313 additions and 17 deletions

View File

@@ -0,0 +1,169 @@
From ea918ed50bed323eb78c7dba805250983aa4d7d4 Mon Sep 17 00:00:00 2001
From: John Wolfe <john.wolfe@broadcom.com>
Date: Sat, 19 Apr 2025 09:04:47 -0700
Subject: [PATCH] [GOSC] Update Guest OS Customization to utilize systemd
system init
Currently the "telinit 6" command is used to reboot a Linux VM
following Guest OS Customization. As the classic Linux init system,
SysVinit, is deprecated in favor of a newer init system, systemd,
the telinit command may not be available on the base Linux OS.
This change adds support to Guest OS Customization for the systemd init
system. If the modern init system, systemd, is available, then a
"systemctl reboot" command will be used to trigger reboot. Otherwise,
the "telinit 6" command will be used assuming the traditional init
system, SysVinit, is still available.
---
open-vm-tools/libDeployPkg/linuxDeployment.c | 90 ++++++++------------
1 file changed, 35 insertions(+), 55 deletions(-)
diff --git a/open-vm-tools/libDeployPkg/linuxDeployment.c b/open-vm-tools/libDeployPkg/linuxDeployment.c
index d31d52927..0ce973c81 100644
--- a/open-vm-tools/libDeployPkg/linuxDeployment.c
+++ b/open-vm-tools/libDeployPkg/linuxDeployment.c
@@ -121,6 +121,9 @@ static const char* VARRUNDIR = "/var/run";
static const char* VARRUNIMCDIR = "/var/run/vmware-imc";
#endif
static const char* TMPDIR = "/tmp";
+static const char* USRBINSYSTEMCTL = "/usr/bin/systemctl";
+static const char* BINSYSTEMCTL = "/bin/systemctl";
+static const char* SBINTELINIT = "/sbin/telinit";
// Possible return codes from perl script
static const int CUST_SUCCESS = 0;
@@ -196,7 +199,6 @@ static Bool CopyFileIfExist(const char* sourcePath,
static void GetCloudinitVersion(const char* versionOutput,
int* major,
int* minor);
-static Bool IsTelinitASoftlinkToSystemctl(void);
/*
* Globals
@@ -1673,28 +1675,43 @@ Deploy(const char* packageName)
sLog(log_error, "Failed to fork: '%s'.", strerror(errno));
} else if (pid == 0) {
// We're in the child
+ char rebootCommand[1024];
int rebootCommandResult;
+ bool isSystemd = false;
bool isRebooting = false;
- // Retry reboot until telinit 6 succeeds to workaround PR 2716292 where
- // telinit is a soft(symbolic) link to systemctl and it could exit
- // abnormally due to systemd sends SIGTERM
- bool retryReboot = IsTelinitASoftlinkToSystemctl();
+ // PR 3438671, using different command to reboot modern systemd linux
+ // or traditional SysVinit linux
+ // Repeatedly try to reboot to workaround PR 2716292 on modern systemd
+ // linux where systemctl reboot could exit abnormally due to systemd
+ // sends SIGTERM
+ // Repeatedly try to reboot to workaround PR 530641 on traditional
+ // SysVinit linux where telinit 6 is overwritten by a telinit 2
+ if (access(USRBINSYSTEMCTL, X_OK) == 0) {
+ isSystemd = true;
+ Str_Snprintf(rebootCommand, sizeof(rebootCommand), "%s reboot",
+ USRBINSYSTEMCTL);
+ } else if (access(BINSYSTEMCTL, X_OK) == 0) {
+ isSystemd = true;
+ Str_Snprintf(rebootCommand, sizeof(rebootCommand), "%s reboot",
+ BINSYSTEMCTL);
+ } else {
+ Str_Snprintf(rebootCommand, sizeof(rebootCommand), "%s 6",
+ SBINTELINIT);
+ }
sLog(log_info, "Trigger reboot.");
- // Repeatedly try to reboot to workaround PR 530641 where
- // telinit 6 is overwritten by a telinit 2
do {
if (isRebooting) {
sLog(log_info, "Rebooting.");
}
rebootCommandResult =
- ForkExecAndWaitCommand("/sbin/telinit 6", true, NULL, 0);
+ ForkExecAndWaitCommand(rebootCommand, true, NULL, 0);
isRebooting = (rebootCommandResult == 0) ? true : isRebooting;
sleep(1);
- } while (rebootCommandResult == 0 || (retryReboot && !isRebooting));
+ } while (rebootCommandResult == 0 || (isSystemd && !isRebooting));
if (!isRebooting) {
sLog(log_error,
- "Failed to reboot, reboot command returned error %d.",
- rebootCommandResult);
+ "Failed to reboot, reboot command %s returned error %d.",
+ rebootCommand, rebootCommandResult);
exit (127);
} else {
sLog(log_info, "Reboot has been triggered.");
@@ -1954,8 +1971,11 @@ ForkExecAndWaitCommand(const char* command,
char** args = GetFormattedCommandLine(command);
const char* processStdOut;
Bool isPerlCommand = (strcmp(args[0], "/usr/bin/perl") == 0) ? true : false;
- Bool isTelinitCommand =
- (strcmp(args[0], "/sbin/telinit") == 0) ? true : false;
+ Bool isRebootCommand =
+ (Str_Strncmp(command, "/usr/bin/systemctl reboot", strlen(command)) ||
+ Str_Strncmp(command, "/bin/systemctl reboot", strlen(command)) ||
+ Str_Strncmp(command, "/sbin/telinit 6", strlen(command))) ?
+ true : false;
sLog(log_debug, "Command to exec : '%s'.", args[0]);
Process_Create(&hp, args, sLog);
@@ -2011,9 +2031,9 @@ ForkExecAndWaitCommand(const char* command,
}
}
} else {
- if (isTelinitCommand) {
+ if (isRebootCommand) {
sLog(log_info,
- "Telinit command failed with exitcode: %d, stderr: '%s'.",
+ "Reboot command failed with exitcode: %d, stderr: '%s'.",
retval,
Process_GetStderr(hp));
} else {
@@ -2207,43 +2227,3 @@ GetCloudinitVersion(const char* version, int* major, int* minor)
}
sLog(log_info, "Cloud-init version major: %d, minor: %d", *major, *minor);
}
-
-/**
- *
- * Check if "telinit" command is a soft(symbolic) link to "systemctl" command
- *
- * The fullpath of "systemctl" command could be:
- * /bin/systemctl
- * or
- * /usr/bin/systemctl
- *
- * @returns TRUE if "telinit" command is a soft link to "systemctl" command
- * FALSE if "telinit" command is not a soft link to "systemctl" command
- *
- **/
-static Bool
-IsTelinitASoftlinkToSystemctl(void)
-{
- static const char systemctlBinPath[] = "/bin/systemctl";
- static const char readlinkCommand[] = "/bin/readlink /sbin/telinit";
- char readlinkCommandOutput[256];
- int forkExecResult;
-
- forkExecResult = ForkExecAndWaitCommand(readlinkCommand,
- true,
- readlinkCommandOutput,
- sizeof(readlinkCommandOutput));
- if (forkExecResult != 0) {
- sLog(log_debug, "readlink command result = %d.", forkExecResult);
- return FALSE;
- }
-
- if (strstr(readlinkCommandOutput, systemctlBinPath) != NULL) {
- sLog(log_debug, "/sbin/telinit is a soft link to systemctl");
- return TRUE;
- } else {
- sLog(log_debug, "/sbin/telinit is not a soft link to systemctl");
- }
-
- return FALSE;
-}
--
2.43.5

View File

@@ -2,7 +2,7 @@
<service name="obs_scm" mode="manual">
<param name="url">https://github.com/vmware/open-vm-tools.git</param>
<param name="scm">git</param>
<param name="revision">stable-12.5.0</param>
<param name="revision">stable-13.0.0</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">stable-(.*)</param>
</service>

View File

@@ -1,11 +1,42 @@
--- a/open-vm-tools/configure.ac
+++ b/open-vm-tools/configure.ac
@@ -741,7 +741,7 @@ AC_DEFUN([AC_VMW_CONTAINERINFO_MSG],[
AC_SUBST(TASKS_PROTOPATH, $shared_prefix/containerd/containerd/api/services/tasks/v1)
@@ -738,11 +738,23 @@ AC_DEFUN([AC_VMW_CONTAINERINFO_MSG],[
fi
done
shared_prefix=$src_prefix/github.com
- AC_SUBST(TYPES_DIR, github.com/containerd/containerd/api/types)
- AC_SUBST(TASKS_PROTOPATH, $shared_prefix/containerd/containerd/api/services/tasks/v1)
+
+ vendor_sub_path=""
+ vendor_search_str="import weak "
+ vendor_replace_str="import "
+ if test -d $shared_prefix/containerd/containerd/vendor/github.com/containerd/containerd/api; then
+ vendor_sub_path=vendor/github.com/containerd/containerd
+ vendor_search_str="import \"github.com\/containerd\/containerd\/api"
+ vendor_replace_str="import \"github.com\/containerd\/containerd\/vendor\/github.com\/containerd\/containerd\/api"
+ fi
+ AC_SUBST(DEP_VENDOR_SEARCH_STR, $vendor_search_str)
+ AC_SUBST(DEP_VENDOR_REPLACE_STR, $vendor_replace_str)
+
+ AC_SUBST(TYPES_DIR, github.com/containerd/containerd/$vendor_sub_path/api/types)
+ AC_SUBST(TASKS_PROTOPATH, $shared_prefix/containerd/containerd/$vendor_sub_path/api/services/tasks/v1)
AC_SUBST(DEP_PROTOPATH, $src_prefix)
AC_SUBST(CONTAINERD_PROTOPATH, $shared_prefix/containerd/containerd/api/services/containers/v1)
- AC_SUBST(CONTAINERD_PROTOPATH, $shared_prefix/containerd/containerd/api/services/containers/v1)
- AC_SUBST(GOGO_PROTOPATH, $shared_prefix/gogo/protobuf)
+ AC_SUBST(CONTAINERD_PROTOPATH, $shared_prefix/containerd/containerd/$vendor_sub_path/api/services/containers/v1)
+ AC_SUBST(GOGO_PROTOPATH, $shared_prefix/containerd/containerd/vendor/github.com/gogo/protobuf)
AC_CHECK_FILE([${CONTAINERD_PROTOPATH}/containers.proto],
[],
[AC_VMW_CONTAINERINFO_MSG(["containerd package"])])
--- a/open-vm-tools/services/plugins/containerInfo/Makefile.am
+++ b/open-vm-tools/services/plugins/containerInfo/Makefile.am
@@ -84,7 +84,7 @@ $(TYPES_DIR)/task/task.pb.cc: %.pb.cc :
$(PROTOC) --cpp_out=. -I$(GOGO_PROTOPATH) -I. $<
tasks.proto: $(TASKS_PROTOPATH)/tasks.proto
- sed 's/import weak /import /' $< > $@
+ sed 's/$(DEP_VENDOR_SEARCH_STR)/$(DEP_VENDOR_REPLACE_STR)/' $< > $@
containers.proto: $(CONTAINERD_PROTOPATH)/containers.proto
sed 's/import weak /import /' $< > $@

BIN
open-vm-tools-12.5.0.obscpio (Stored with Git LFS)

Binary file not shown.

BIN
open-vm-tools-13.0.0.obscpio (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -1,3 +1,99 @@
-------------------------------------------------------------------
Fri Jun 20 20:59:21 UTC 2025 - Kirk Allan <kallan@suse.com>
- Update to open-vm-tools 13.0.0 based on build 24696409. (boo#1245169):
There are no new features in the open-vm-tools 13.0.0 release. This is
primarily a maintenance release that addresses a few issues, including:
- The vm-support script has been updated to collect the open-vm-tools log
files from the Linux guest and information from the systemd journal.
- Github pull requests has been integrated and issues fixed. Please see
the Resolved Issues section of the Release Notes.
For a more complete list of issues resolved in this release, see the
Resolved Issues section of the Release Notes.
For complete details, see:
https://github.com/vmware/open-vm-tools/releases/tag/stable-13.0.0
Release Notes are available at:
https://github.com/vmware/open-vm-tools/blob/stable-13.0.0/ReleaseNotes.md
The granular changes that have gone into the 13.0.0 release are in the
ChangeLog at:
https://github.com/vmware/open-vm-tools/blob/stable-13.0.0/open-vm-tools/ChangeLog
- Add patch:
0001-GOSC-Update-Guest-OS-Customization-to-utilize-system.patch
Currently the "telinit 6" command is used to reboot a Linux VM
following Guest OS Customization. As the classic Linux init system,
SysVinit, is deprecated in favor of a newer init system, systemd,
the telinit command may not be available on the base Linux OS.
This change adds support to Guest OS Customization for the systemd init
system. If the modern init system, systemd, is available, then a
"systemctl reboot" command will be used to trigger reboot. Otherwise,
the "telinit 6" command will be used assuming the traditional init
system, SysVinit, is still available.
- Drop patch now contained in 13.0.0:
open-vm-tools-12.5.0-gcc15.patch
- Ran /usr/lib/obs/service/source_validators/helpers/fix_changelog to fix changes
file where source validator was failing.
-------------------------------------------------------------------
Tue May 13 04:34:57 UTC 2025 - Johannes Kastl <opensuse_buildservice@ojkastl.de>
- update to 12.5.2 (bsc#1243106):
https://github.com/vmware/open-vm-tools/blob/stable-12.5.2/ReleaseNotes.md
https://github.com/vmware/open-vm-tools/blob/stable-12.5.2/open-vm-tools/ChangeLog
This release resolves CVE-2025-22247. For more information on this
vulnerability and its impact on Broadcom products, see
VMSA-2025-0007
https://support.broadcom.com/web/ecx/support-content-notification/-/external/content/SecurityAdvisories/0/25683
-------------------------------------------------------------------
Sat May 3 16:51:01 UTC 2025 - Friedrich Haubensak <hsk17@mail.de>
- Add open-vm-tools-12.5.0-gcc15.patch from upstream to fix
gcc15 compile time error (boo#1241938)
-------------------------------------------------------------------
Wed Apr 16 21:49:08 UTC 2025 - Kirk Allan <kallan@suse.com>
- (bsc#1237147): Newer version of containerd do not have the directory
/usr/share/go/1.x/contrib/src/github.com/containerd/containerd/api.
Update detect-suse-location.patch to point to the directory
/usr/share/go/1.x/contrib/src/github.com/containerd/containerd/vendor/github.com/containerd/containerd/api
to find the needed files and update the tasks.proto file to import from
github.com/containerd/containerd/vendor/github.com/containerd/containerd/api
-------------------------------------------------------------------
Thu Mar 27 16:13:06 UTC 2025 - Kirk Allan <kallan@suse.com>
- (bsc#1237180): Ensure vmtoolsd.service and vgauthd.service
are set to enabled by default. Do this by removing vmblock-fuse.service
from the %pre section in the spec file. vmblock-fuse.service still
remains in the %pre desktop section.
-------------------------------------------------------------------
Thu Mar 20 15:17:11 UTC 2025 - Andreas Stieger <andreas.stieger@gmx.de>
- remove unused pcre build dependency
-------------------------------------------------------------------
Tue Feb 25 22:39:24 UTC 2025 - Kirk Allan <kallan@suse.com>
- Revert previous change (Thu Feb 20 23:08:43 UTC 2025). The proposed
solutions was non-standard.
-------------------------------------------------------------------
Thu Feb 20 23:08:43 UTC 2025 - Kirk Allan <kallan@suse.com>
- (bsc#1237180): Ensure vmtoolsd.service, vgauthd.service, and
vmblock-fuse.service are set to enabled by default.
-------------------------------------------------------------------
Fri Oct 11 07:24:04 UTC 2024 - Johannes Kastl <opensuse_buildservice@ojkastl.de>
@@ -1974,7 +2070,7 @@ Fri Aug 22 16:49:41 CEST 2008 - dominique@leuenberger.net
- added packageand(open-vm-tools:xorg-x11) to Supplements
of open-vm-tools-gui sub package
------------------------------------------------------------------
-------------------------------------------------------------------
Fri Aug 22 07:30:15 CEST 2008 - dominique@leuenberger.net
- Re-arranged comments for the configure line. Apparently, comments
@@ -2023,7 +2119,7 @@ Fri Aug 12 16:17:07 CEST 2008 - prusnak@suse.cz
Martin Preishuber for the report (Sourceforge bug 2013568).
* As usual, other bug fixes.
------------------------------------------------------------------
-------------------------------------------------------------------
Mon Jul 21 17:02:15 CEST 2008 - prusnak@suse.cz
- updated to 2008.07.01:
@@ -2065,8 +2161,8 @@ Tue May 27 21:00:00 EST 2008 - dominique-rpm@leuenberger.net
- Excluded the building of KMPs for XEN, probably nobody installs
a vmware host in xen.
-------------------------------------------------------------------
-------------------------------------------------------------------
Thu May 22 10:20:14 CEST 2008 - prusnak@suse.cz
- added Recommends: open-vm-tools to KMP preamble [bnc#391434]

View File

@@ -1,4 +1,4 @@
name: open-vm-tools
version: 12.5.0
mtime: 1728572707
commit: f2ca37ef3510543172657b82493d1eceefa9a134
version: 13.0.0
mtime: 1750305918
commit: 3c28b6f4d9af2df2027a9df9c82e2f0196bd8bf7

View File

@@ -1,7 +1,7 @@
#
# spec file for package open-vm-tools
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2010 Dominique Leuenberger, Amsterdam, Netherlands.
#
# All modifications and additions to the file contributed by third parties
@@ -38,7 +38,7 @@
%define with_X 1
Name: open-vm-tools
Version: 12.5.0
Version: 13.0.0
Release: 0
Summary: Open Virtual Machine Tools
License: BSD-3-Clause AND GPL-2.0-only AND LGPL-2.1-only
@@ -66,7 +66,6 @@ BuildRequires: libmspack-devel
BuildRequires: libtool
BuildRequires: openssl-devel
BuildRequires: pam-devel
BuildRequires: pcre-devel
BuildRequires: procps-devel
BuildRequires: update-desktop-files
%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150300
@@ -160,6 +159,7 @@ Obsoletes: open-vm-tools-deploypkg <= 10.0.5
Supplements: modalias(pci:v000015ADd*sv*sd*bc*sc*i*)
ExclusiveArch: %ix86 x86_64 aarch64
#Upstream patches
Patch2: 0001-GOSC-Update-Guest-OS-Customization-to-utilize-system.patch
#SUSE specific patches
Patch0: pam-vmtoolsd.patch
@@ -262,6 +262,7 @@ This package interfaces with the container runtime to retrieve a list of contain
# fix for an rpmlint warning regarding wrong line feeds
sed -i -e "s/\r//" README
#Upstream patches
%patch -P 2 -p2
#SUSE specific patches
%patch -P 0 -p2
@@ -381,7 +382,6 @@ install -D -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/modprobe.d/50-vmnics.co
%pre
%service_add_pre vmtoolsd.service
%service_add_pre vgauthd.service
%service_add_pre vmblock-fuse.service
%if 0%{?suse_version} > 1500
# Prepare for migration to /usr/etc; save any old .rpmsave
for i in pam.d/vmtoolsd ; do