Bug 4360 - zypperbackend lock file creation can fail on common partitioning layouts
Summary: zypperbackend lock file creation can fail on common partitioning layouts
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Server Installer (show other bugs)
Version: 3.4.0
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.0.0
Assignee: Karl Mikaelsson
URL:
Keywords: astrand_tester
Depends on:
Blocks:
 
Reported: 2012-07-06 09:51 CEST by Aaron Sowry
Modified: 2012-11-28 12:37 CET (History)
0 users

See Also:
Acceptance Criteria:


Attachments

Description Aaron Sowry cendio 2012-07-06 09:51:56 CEST
From issue #13481:

---
2012-07-05 17:35:36,798: Creating zypper lock...
2012-07-05 17:35:36,799: Failed to create zypper lock file: [Errno 18] Invalid cross-device link
2012-07-05 17:35:36,801: Traceback (most recent call last):
2012-07-05 17:35:36,801:   File "/opt/thinlinc/modules/thinlinc/tlsetup/pkginsthelp.py", line 44, in <lambda>
2012-07-05 17:35:36,801:     self . __worker_thread = thread . start_new_thread ( lambda : self . __worker ( ) , ( ) )
2012-07-05 17:35:36,801:   File "/opt/thinlinc/modules/thinlinc/tlsetup/pkginsthelp.py", line 51, in __worker
2012-07-05 17:35:36,801:     self . __job ( )
2012-07-05 17:35:36,801:   File "/opt/thinlinc/modules/thinlinc/tlsetup/pkginsthelp.py", line 215, in __resolver_job
2012-07-05 17:35:36,801:     if iI ( self . __packageinstaller ) :
2012-07-05 17:35:36,801:   File "/opt/thinlinc/modules/thinlinc/tlsetup/pkginsthelp.py", line 108, in iI
2012-07-05 17:35:36,801:     oo = backend . resolve ( )
2012-07-05 17:35:36,801:   File "/opt/thinlinc/modules/thinlinc/packageinstaller/zypperbackend.py", line 397, in resolve
2012-07-05 17:35:36,802:     self . lock ( )
2012-07-05 17:35:36,802:   File "/opt/thinlinc/modules/thinlinc/packageinstaller/zypperbackend.py", line 317, in lock
2012-07-05 17:35:36,802:     raise Exception ( "Failed to create zypper lock file" )
2012-07-05 17:35:36,802: Exception: Failed to create zypper lock file
---

In this case, if /tmp and /var/run are not on the same partition, trying to move the lock file os.rename() (zypperbackend.py:313) will fail. From http://docs.python.org/library/os.html?highlight=os.rename#os.rename:

"The operation may fail on some Unix flavors if src and dst are on different filesystems"

To resolve this, the lock file should be created in place by specifying the target directory when calling tempfile.mkstemp().
Comment 1 Aaron Sowry cendio 2012-07-06 10:13:46 CEST
Created attachment 447 [details]
Suggested patch
Comment 2 Karl Mikaelsson cendio 2012-08-29 13:05:37 CEST
Fixed in r25683. Now creates temp file in target directory. Initial testing performed on SLED11SP2, seems to work fine.
Comment 3 Peter Åstrand cendio 2012-10-22 11:12:30 CEST
Works great. Tested on SLED11SP2, after doing:

mount -t tmpfs /tmp /tmp

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