RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 596255 - cryptsetup: semop failed for cookie, incorrect semaphore state
Summary: cryptsetup: semop failed for cookie, incorrect semaphore state
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: device-mapper
Version: 6.0
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Peter Rajnoha
QA Contact: Release Test Team
URL:
Whiteboard:
: 606807 (view as bug list)
Depends On:
Blocks: 582286
TreeView+ depends on / blocked
 
Reported: 2010-05-26 13:23 UTC by Jan Stodola
Modified: 2018-10-27 10:46 UTC (History)
16 users (show)

Fixed In Version: lvm2-2.02.66-3.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-07-02 18:57:59 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jan Stodola 2010-05-26 13:23:12 UTC
Description of problem:
When working with cryptsetup on s390x, error messages are displayed:

[root@rtt6 ~]# cryptsetup luksClose test
semid 622592: semop failed for cookie 0xd4da050: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223191120 (0xd4da050) to initialize waiting for incoming notifications.

The same error you can see if you perform installation on s390x with encrypted device(s). Error message is shown when user enter passphrase to unlock encrypted device. It doesn't seem to have any impact on functionality, system boots.


Version-Release number of selected component (if applicable):
RHEL6.0-20100523.0
cryptsetup-luks-1.1.1-0.2.el6.s390x.rpm 
kernel-2.6.32-28.el6.s390x.rpm 

How reproducible:
always

Steps to Reproduce:

[root@rtt6 ~]# dd if=/dev/zero of=file bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 2.05507 s, 51.0 MB/s
[root@rtt6 ~]# losetup /dev/loop0 file 
[root@rtt6 ~]# cryptsetup luksFormat /dev/loop0 

WARNING!
========
This will overwrite data on /dev/loop0 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase: 
Verify passphrase: 
semid 491520: semop failed for cookie 0xd4dd77a: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223205242 (0xd4dd77a) to initialize waiting for incoming notifications.
[root@rtt6 ~]# cryptsetup luksOpen /dev/loop0 test
Enter passphrase for /dev/loop0: 
semid 557056: semop failed for cookie 0xd4d8a1e: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223185438 (0xd4d8a1e) to initialize waiting for incoming notifications.
Key slot 0 unlocked.
[root@rtt6 ~]# cryptsetup luksClose test
semid 622592: semop failed for cookie 0xd4da050: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223191120 (0xd4da050) to initialize waiting for incoming notifications.
  
Actual results:
semid 622592: semop failed for cookie 0xd4da050: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223191120 (0xd4da050) to initialize waiting for incoming notifications.

Expected results:
no error message

Comment 1 Martin Banas 2010-05-26 13:36:05 UTC
The same result on PPC64 with build RHEL6.0-20100523.0. Changing architecture to ALL.

Password [/dev/sda3 (luks-a68...)]::*********
semid 32768: semop failed for cookie 0xd4dd5dc: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223204828 (0xd4dd5dc) to initialize waiting for incoming notifications.
Key slot 0 unlocked.
semid 131072: semop failed for cookie 0xd4d666c: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223176300 (0xd4d666c) to initialize waiting for incoming notifications.
Key slot 0 unlocked.
semid 229376: semop failed for cookie 0xd4dca38: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223201848 (0xd4dca38) to initialize waiting for incoming notifications.
Key slot 0 unlocked.

Comment 2 RHEL Program Management 2010-05-26 13:38:38 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 3 Milan Broz 2010-05-26 13:43:59 UTC
This is probably underlying device-mapper issue. Peter?

Comment 4 Milan Broz 2010-05-26 13:46:48 UTC
(Just to be sure - it works on i386 & x86_64, right?)

Comment 5 Martin Banas 2010-05-26 13:57:54 UTC
[root@ibm-js22-vios-01-lp2 ~]# cryptsetup luksOpen /dev/loop0 test --debug
# cryptsetup 1.1.1-rc2 processing "cryptsetup luksOpen /dev/loop0 test --debug"
# Locking memory.
# Allocating crypt device /dev/loop0 context.
# Trying to open and read device /dev/loop0.
# Initialising device-mapper backend, UDEV is enabled.
# Detected dm-crypt target of version 1.7.0.
# Timeout set to 0 miliseconds.
# Password retry count set to 3.
# Iteration time set to 1000 miliseconds.
# Password verification disabled.
# Trying to load LUKS1 crypt type from device /dev/loop0.
# Initializing crypto backend (using secure memory).
# Reading LUKS header of size 1024 from device /dev/loop0
# Activating volume test [keyslot -1] using [none] passphrase.
# dm status test  OF   [16384]
Enter passphrase for /dev/loop0: 
# Trying to open key slot 0 [3].
# Reading key slot 0 area.
# DM-UUID is CRYPT-TEMP-temporary-cryptsetup-4615
# Udev cookie 0xd4d8ace (semid 720896) created
# Udev cookie 0xd4d8ace (semid 720896) incremented
# Udev cookie 0xd4d8ace (semid 720896) incremented
# Udev cookie 0xd4d8ace (semid 720896) assigned to dm_task type 0 with flags 0xe
# dm create temporary-cryptsetup-4615 CRYPT-TEMP-temporary-cryptsetup-4615 OF   [16384]
# temporary-cryptsetup-4615: Stacking NODE_ADD (253,6) 0:6 0660
# dm reload temporary-cryptsetup-4615  OF   [16384]
# dm resume temporary-cryptsetup-4615  OF   [16384]
# temporary-cryptsetup-4615: Stacking NODE_READ_AHEAD 256 (flags=1)
# Udev cookie 0xd4d8ace (semid 720896) decremented
# Udev cookie 0xd4d8ace (semid 720896): Waiting for zero
# Udev cookie 0xd4d8ace (semid 720896) destroyed
# /dev/mapper/temporary-cryptsetup-4615 not set up by udev: Falling back to direct node creation.
# Created /dev/mapper/temporary-cryptsetup-4615
# Setting SELinux context for /dev/mapper/temporary-cryptsetup-4615 to system_u:object_r:fixed_disk_device_t:s0.
# temporary-cryptsetup-4615: read ahead is 256
# temporary-cryptsetup-4615: Setting read ahead to 256
# Udev cookie 0xd4dfe17 (semid 753664) created
# Udev cookie 0xd4dfe17 (semid 753664) incremented
# Udev cookie 0xd4dfe17 (semid 753664) incremented
# Udev cookie 0xd4dfe17 (semid 753664) assigned to dm_task type 2 with flags 0x0
# dm remove temporary-cryptsetup-4615  OF   [16384]
# temporary-cryptsetup-4615: Stacking NODE_DEL (replaces other stacked ops)
semid 753664: semop failed for cookie 0xd4dfe17: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223215127 (0xd4dfe17) to initialize waiting for incoming notifications.
# Udev cookie 0xd4dfe17 (semid 753664) destroyed
Key slot 0 unlocked.
# Calculated device size is 202744 sectors (RW), offset 2056.
# DM-UUID is CRYPT-LUKS1-338aa9a1350e4ba6b8fbed7d0e7b57e7-test
# Udev cookie 0xd4d1800 (semid 786432) created
# Udev cookie 0xd4d1800 (semid 786432) incremented
# Udev cookie 0xd4d1800 (semid 786432) incremented
# Udev cookie 0xd4d1800 (semid 786432) assigned to dm_task type 0 with flags 0x0
# dm create test CRYPT-LUKS1-338aa9a1350e4ba6b8fbed7d0e7b57e7-test OF   [16384]
# test: Stacking NODE_ADD (253,6) 0:6 0660
# dm reload test  OF   [16384]
# dm resume test  OF   [16384]
# test: Stacking NODE_READ_AHEAD 256 (flags=1)
# Udev cookie 0xd4d1800 (semid 786432) decremented
# Udev cookie 0xd4d1800 (semid 786432): Waiting for zero
# Udev cookie 0xd4d1800 (semid 786432) destroyed
# /dev/mapper/test not set up by udev: Falling back to direct node creation.
# Created /dev/mapper/test
# Setting SELinux context for /dev/mapper/test to system_u:object_r:fixed_disk_device_t:s0.
# test: read ahead is 256
# test: Setting read ahead to 256
# Releasing crypt device /dev/loop0 context.
# Releasing device-mapper backend.
# Unlocking memory.
Command successful.

Comment 6 Milan Broz 2010-05-26 14:02:12 UTC
(In reply to comment #5)

> # /dev/mapper/temporary-cryptsetup-4615 not set up by udev: Falling back to
> direct node creation.
> # Created /dev/mapper/temporary-cryptsetup-4615
> # Setting SELinux context for /dev/mapper/temporary-cryptsetup-4615 to

> # /dev/mapper/test not set up by udev: Falling back to direct node creation.
> # Created /dev/mapper/test
> # Setting SELinux context for /dev/mapper/test to

... udev/device-mapper issue, reassigning to device-mapper.

Comment 7 Peter Rajnoha 2010-05-27 15:20:12 UTC
During initialisation of the semaphores we use for udev synchronisation, we set a certain initial semaphore value that is also expected at the end of the synchronisation. This value was not initialised correctly due to incorrect definition of semctl's arguments ending up with the error messages reported.

We should use standard "union semun" for all semctl operations that expect additional arguments, not just a direct value. Otherwise problems like these can appear on some architectures because of misalignment of the arguments.

The fix is in the upstream now...

Comment 9 Milan Broz 2010-06-22 14:40:59 UTC
*** Bug 606807 has been marked as a duplicate of this bug. ***

Comment 10 Jan Stodola 2010-06-25 08:27:35 UTC
Tested on build RHEL6.0-20100622.1 with lvm2-2.02.66-3.el6, architectures: x86_64, ppc64, s390x, this issue is fixed.

Moving to VERIFIED.

Comment 12 releng-rhel@redhat.com 2010-07-02 18:57:59 UTC
Red Hat Enterprise Linux Beta 2 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.

Comment 13 Sami Farin 2014-03-20 07:48:20 UTC
having this problem. kernel 3.14.0-rc7-g4907cdca+, device-mapper 1.02.82-5.fc20, systemd-208-15.fc20

# cryptsetup -h sha256 -i 3000 -s 512 luksFormat /dev/sdd4

WARNING!
========
This will overwrite data on /dev/sdd4 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter passphrase: 
Verify passphrase: 
semid 294912: semop failed for cookie 0xd4dcdb0: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223202736 (0xd4dcdb0) to initialize waiting for incoming notifications.


Note You need to log in before you can comment on or make changes to this bug.