I have also verified the fix using systemd 255.4-1ubuntu8.5 from noble-
proposed.

I was able to launch the transient unit with MemoryKSM=yes (this step
used to fail without the fix) and now  systemctl reports:

# systemctl show povalles-j  | grep -i memoryksm
MemoryKSM=yes

Thank you! Now I can move on and test KSM itself :-)

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/2081192

Title:
  Cannot change MemoryKSM in systemd units

Status in systemd package in Ubuntu:
  Fix Released
Status in systemd source package in Noble:
  Fix Committed

Bug description:
  [Impact]

  Units with MemoryKSM=yes setting will fail to start with an "Invalid
  argument" error. This makes the setting unusable on Noble.

  [Test Plan]

  On Noble, start a systemd service with MemoryKSM=yes:

  $ systemd-run -u test-memory-ksm.service --wait -p MemoryKSM=yes
  /usr/bin/true

  On an affected system, this will fail immediately. Inspecting the
  journal will show why, e.g.:

  $ journalctl -u test-memory-ksm.service
  Oct 17 10:37:20 six (sleep)[1494131]: test-memory-ksm.service: Failed to set 
KSM: Invalid argument
  Oct 17 10:37:20 six systemd[1]: Started test-memory-ksm.service - 
/usr/bin/sleep infinity.
  Oct 17 10:37:20 six systemd[1]: test-memory-ksm.service: Main process exited, 
code=exited, status=245/KSM
  Oct 17 10:37:20 six systemd[1]: test-memory-ksm.service: Failed with result 
'exit-code'.

  On a patched system, the unit should start/exit normally.

  [Where problems could occur]

  This patch simply adds missing arguments to the prctl call for
  PR_SET_MEMORY_MERGE. Problems would be isolated to the MemoryKSM=
  setting.

  [Other information]

  The patch is from upstream:
  
https://github.com/systemd/systemd/commit/9bb89a55a235a3c64ec099bb86296d7fd1bb3302

  [Original Description]

  In one of my working unit (service), I try to toggle the MemoryKSM
  boolean setting.

  Using any of:

  MemoryKSM=yes
  MemoryKSM=on
  MemoryKSM=true
  MemoryKSM=1

  Results in:

  Sep 19 16:16:56 systemd[1]: Started XXX.service - XXX service.
  Sep 19 16:16:56 (e_server)[4487]: XXX.service: Failed to set KSM: Invalid 
argument
  Sep 19 16:16:56 systemd[1]: XXX.service: Main process exited, code=exited, 
status=245/KSM
  Sep 19 16:16:56 systemd[1]: XXX.service: Failed with result 'exit-code'.

  The following lines allow the service to start:

  MemoryKSM="yes"
  MemoryKSM="on"
  MemoryKSM="true"
  MemoryKSM="1"

  but still, MemoryKSM stays off:

  # systemctl show XXX.service | grep MemoryKSM
  MemoryKSM=no

  KSM is activated in my running kernel:
  # cat /boot/config-$(uname -r) | grep KSM
  CONFIG_KSM=y

  Using prctl (libc6 2.39-0ubuntu8.3) to toggle KSM inside a running
  process also works. I can read and set the memory_merge switch.

  ProblemType: Bug
  DistroRelease: Ubuntu 24.04
  Package: systemd 255.4-1ubuntu8.4
  ProcVersionSignature: Ubuntu 6.8.0-45.45-generic 6.8.12
  Uname: Linux 6.8.0-45-generic x86_64
  ApportVersion: 2.28.1-0ubuntu3.1
  Architecture: amd64
  CasperMD5CheckResult: unknown
  CloudArchitecture: x86_64
  CloudBuildName: server
  CloudID: openstack
  CloudName: openstack
  CloudPlatform: openstack
  CloudSerial: 20240612
  CloudSubPlatform: metadata (http://169.254.169.254)
  Date: Thu Sep 19 16:06:51 2024
  Lsusb:
   Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
   Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd QEMU Tablet
   Bus 001 Device 003: ID 0627:0001 Adomax Technology Co., Ltd QEMU Tablet
  Lsusb-t:
   /:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=uhci_hcd/2p, 12M
       |__ Port 001: Dev 002, If 0, Class=Human Interface Device, 
Driver=usbhid, 12M
       |__ Port 002: Dev 003, If 0, Class=Human Interface Device, 
Driver=usbhid, 12M
  MachineType: OpenStack Foundation OpenStack Nova
  ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-6.8.0-45-generic 
root=UUID=1c5e2fdc-a746-403d-9fc0-71af31bc9c19 ro console=tty1 console=ttyS0
  SourcePackage: systemd
  UpgradeStatus: No upgrade log present (probably fresh install)
  dmi.bios.date: 02/06/2015
  dmi.bios.release: 0.0
  dmi.bios.vendor: EFI Development Kit II / OVMF
  dmi.bios.version: 0.0.0
  dmi.chassis.type: 1
  dmi.chassis.vendor: QEMU
  dmi.chassis.version: pc-q35-4.2
  dmi.modalias: 
dmi:bvnEFIDevelopmentKitII/OVMF:bvr0.0.0:bd02/06/2015:br0.0:svnOpenStackFoundation:pnOpenStackNova:pvr26.2.3:cvnQEMU:ct1:cvrpc-q35-4.2:sku:
  dmi.product.family: Virtual Machine
  dmi.product.name: OpenStack Nova
  dmi.product.version: 26.2.3
  dmi.sys.vendor: OpenStack Foundation

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2081192/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to