Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 147010 - portage-2.1.1 Global Updates OSError: [Errno 16] Device or resource busy
Summary: portage-2.1.1 Global Updates OSError: [Errno 16] Device or resource busy
Status: VERIFIED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: x86 Linux
: High blocker (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, REGRESSION
: 147009 151580 152626 153073 153248 159382 (view as bug list)
Depends on:
Blocks: 147007 149110
  Show dependency tree
 
Reported: 2006-09-09 16:37 UTC by Katarzyna Glinska
Modified: 2007-02-14 06:46 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
configuration (bug,1.85 KB, text/plain)
2006-09-09 16:42 UTC, Katarzyna Glinska
Details
fix config file updates (update_config.patch,537 bytes, patch)
2006-09-10 14:43 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Katarzyna Glinska 2006-09-09 16:37:34 UTC
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5
Build Identifier: 

emerge crashes every time I try to use it
I can't run emerge portage, emerge --websync etc.

Reproducible: Always

Steps to Reproduce:
1.emerge always crashes

Actual Results:  
kaska@Ginkgo ~ $ sudo emerge --sync


Performing Global Updates: /usr/portage/profiles/updates/2Q-2006
(Could take a couple of minutes if you have a lot of binary packages.)
  .='update pass'  *='binary update'  @='/var/db move'
  s='/var/db SLOT move' S='binary SLOT move' p='update /etc/portage/package.*'
........................................
pTraceback (most recent call last):
  File "/usr/bin/emerge", line 4049, in ?
    emerge_main()
  File "/usr/bin/emerge", line 3770, in emerge_main
    portage.global_updates(settings, trees, mtimedb["updates"])
  File "/usr/lib/portage/pym/portage.py", line 6645, in global_updates
    myupd)
  File "/usr/lib/portage/pym/portage_update.py", line 198, in update_config_files
    write_atomic(updating_file, "".join(file_contents[x]))
  File "/usr/lib/portage/pym/portage_util.py", line 728, in write_atomic
    f.close()
  File "/usr/lib/portage/pym/portage_util.py", line 696, in close
    os.rename(self.name, self._real_name)
OSError: [Errno 16] Device or resource busy


Expected Results:  
emerge should work properly...
Comment 1 Katarzyna Glinska 2006-09-09 16:42:48 UTC
Created attachment 96536 [details]
configuration
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2006-09-09 16:55:38 UTC
*** Bug 147009 has been marked as a duplicate of this bug. ***
Comment 3 Zac Medico gentoo-dev 2006-09-09 17:57:57 UTC
(In reply to comment #0)
> OSError: [Errno 16] Device or resource busy


That appears to be some type of device/filesystem/kernel misbehavior.  It happened while portage was attempting to apply package moves to one of the /etc/portage/package.* files.
Comment 4 Zac Medico gentoo-dev 2006-09-09 21:40:25 UTC
Somebody reported the same error on the gentoo-user mailing list recently.  Anyway, portage can't really guarantee much when something low level like that fails unexpectedly.
Comment 5 radfoj 2006-09-10 09:01:49 UTC
Same here, seems that to this fail start facing more people. Today emerge worked as always - correctly, till I synced a little while ago. No, I am not able to emerge enything, cant sync anymore, also emerge --info fails same way. 

As Zac reported that its some type of device/filesystem/kernel misbehavior. I am sorry, dont understand what it means. But would be nice, if somebody can help how to make portage working again. Thanks.
Comment 6 Zac Medico gentoo-dev 2006-09-10 09:24:22 UTC
(In reply to comment #5)
> As Zac reported that its some type of device/filesystem/kernel misbehavior. I
> am sorry, dont understand what it means. But would be nice, if somebody can
> help how to make portage working again. Thanks.

You've got the operating system returning a "OSError: [Errno 16] Device or resource busy" error when portage is trying to rename a file in /etc/portage/.  Things you should check:

1) Is the filesystem okay (is the reiser4 or some other experimental filesystem)?
2) Is the device and/or driver okay (maybe there's something interesting in the system log)?
3) Is the kernel okay (maybe there's a bug due to a bad patch or something)?
Comment 7 Jakub Moc (RETIRED) gentoo-dev 2006-09-10 09:28:05 UTC
Well, maybe 4) Are you using NFS / and have those files open/used by something else?
Comment 8 radfoj 2006-09-10 10:08:47 UTC
Just tried to look at "tail -f /var/log/messages" while trying to use emerge command (which failed) and nothing was written to the log. 

# dmesg | grep hda
    ide0: BM-DMA at 0xd000-0xd007, BIOS settings: hda:DMA, hdb:pio
hda: ST320410A, ATA DISK drive
hda: max request size: 128KiB
hda: 39102336 sectors (20020 MB) w/2048KiB Cache, CHS=38792/16/63, UDMA(100)
hda: cache flushes not supported
 hda: hda1 hda2 hda3 < hda5 hda6 hda7 hda8 >
ReiserFS: hda7: found reiserfs format "3.6" with standard journal
ReiserFS: hda7: using ordered data mode
ReiserFS: hda7: journal params: device hda7, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30
ReiserFS: hda7: checking transaction log (hda7)
ReiserFS: hda7: Using r5 hash to sort names
ReiserFS: hda6: found reiserfs format "3.6" with standard journal
ReiserFS: hda6: using ordered data mode
ReiserFS: hda6: journal params: device hda6, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30
ReiserFS: hda6: checking transaction log (hda6)
ReiserFS: hda6: Using r5 hash to sort names
ReiserFS: hda2: found reiserfs format "3.6" with standard journal
ReiserFS: hda2: using ordered data mode
ReiserFS: hda2: journal params: device hda2, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30
ReiserFS: hda2: checking transaction log (hda2)
ReiserFS: hda2: Using r5 hash to sort names
ReiserFS: hda8: found reiserfs format "3.6" with standard journal
ReiserFS: hda8: using ordered data mode
ReiserFS: hda8: journal params: device hda8, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30
ReiserFS: hda8: checking transaction log (hda8)
ReiserFS: hda8: Using r5 hash to sort names
Adding 546168k swap on /dev/hda5.  Priority:-1 extents:1 across:546168k

I dont see anything strangethere, same messages are in /var/log/messages. If looking there without grep, nothing interesting.

I am using ck-sources, my last installation was done on August 27 and it was version 2.6.17_p1-r3. 

I tried right now manually (with krusader) rename all files in /etc/portage/ with succes. Same with renaming to original names that.

Finally, when I havent idea, what NFS is good for, I am probably not using it.
Comment 9 Zac Medico gentoo-dev 2006-09-10 10:16:55 UTC
(In reply to comment #7)
> Well, maybe 4) Are you using NFS / and have those files open/used by something
> else?

It unlikely, considering that /etc/portage/ is generally under CONFIG_PROTECT.  Portage creates a temporary file such as '/etc/portage/._cfg0000_package.use.8756' where .8756 represents the pid of the emerge process.  After it's done writing the file, it tries to move it to '/etc/portage/._cfg0000_package.use' and recieves a "Device or resource busy" error.  Generally, the new file has a unique name that didn't exist before, so there wouldn't be any reason for something to have an exclusive lock on it already.

(In reply to comment #8)
> I dont see anything strangethere, same messages are in /var/log/messages. If
> looking there without grep, nothing interesting.

Have you tried rebooting the system yet?  That may resolve the problem, at least temporarily.
Comment 10 radfoj 2006-09-10 10:21:51 UTC
> (In reply to comment #8)
> > I dont see anything strangethere, same messages are in /var/log/messages. If
> > looking there without grep, nothing interesting.
> 
> Have you tried rebooting the system yet?  That may resolve the problem, at
> least temporarily.

Yes, I tried, but still portage is unusable > same error.

Comment 11 Katarzyna Glinska 2006-09-10 10:38:45 UTC
(In reply to comment #6)
> 1) Is the filesystem okay (is the reiser4 or some other experimental
> filesystem)?
> 2) Is the device and/or driver okay (maybe there's something interesting in 
> the
> system log)?
> 3) Is the kernel okay (maybe there's a bug due to a bad patch or something)?
> 
Ad.1 It's reiserfs 3.6 and it seems looking O.K.
Ad.2 There are nothing interesting in system log.
Ad.3 This is exacly the same kernel I used when emerge was working fine.

> 4) Are you using NFS / and have those files open/used by something
> else?

No.

emerge broke after emerge --sync
I was following instructions in http://tinyurl.com/em7lr , but nothing works for me...
Comment 12 Zac Medico gentoo-dev 2006-09-10 11:06:46 UTC
(In reply to comment #11)
> Ad.1 It's reiserfs 3.6 and it seems looking O.K.

Well, you both have reiserfs in common.  Have you tried reiserfsck on the filesystem?
Comment 13 Maarten Maathuis 2006-09-10 13:29:18 UTC
I suffer from this problem too, i use ext3. I have yet to seriously look into the problem, but i will report more once i have.
Comment 14 Zac Medico gentoo-dev 2006-09-10 14:04:03 UTC
I just tried to reproduce this and surprisingly, I am able to!  I'm going to see if I can create a test case and find out what's causing it.
Comment 15 Zac Medico gentoo-dev 2006-09-10 14:43:18 UTC
Created attachment 96616 [details, diff]
fix config file updates

This patch fixes the problem.  The errno 16 actually results from incorrect file names being passed into the rename call.  If the patch is saved as /tmp/update_config.patch, then it can be applied as follows:

cd /usr/lib/portage
patch -p0 < /tmp/update_config.patch
Comment 16 Maarten Maathuis 2006-09-11 00:30:19 UTC
This solved it for me (as far as i can see now), thanks for the fix.
Comment 17 Katarzyna Glinska 2006-09-11 01:10:18 UTC
It works for me too - thanks a lot.
Comment 18 radfoj 2006-09-11 09:44:28 UTC
(In reply to comment #15)
> cd /usr/lib/portage
> patch -p0 < /tmp/update_config.patch

Great, thanks for solving my life.  I was affraiding of playing with 
reiserfsck :-)
Comment 19 radfoj 2006-09-11 09:44:47 UTC
(In reply to comment #15)
> cd /usr/lib/portage
> patch -p0 < /tmp/update_config.patch

Great, thanks for solving my life.  I was affraiding of playing with 
reiserfsck :-)
Comment 20 Roger 2006-09-13 03:56:48 UTC
Works for me too.

Is this patch upstream yet?  I've got a box in the process of an emerge -uDN world as I type.

(It's 1-2 days after this patch has been submitted and my laptop didn't get it yesterday before a sync & update.)
Comment 21 Zac Medico gentoo-dev 2006-09-13 10:52:03 UTC
(In reply to comment #20)
> Is this patch upstream yet?  I've got a box in the process of an emerge -uDN
> world as I type.

Actually, I am upstream.  It's not available in an official release yet, but it will be in the near future.

> (It's 1-2 days after this patch has been submitted and my laptop didn't get it
> yesterday before a sync & update.)

The error is only triggered when one or more of /etc/portage/package.* files contain the old names of packages that have been recently moved.  Therefore, the problem will be triggered infrequently for random users.

For the time being, it's possible to work around the issue by adding CONFIG_PROTECT_MASK="/etc/portage" to make.conf.  Generally, it's safe to mask config protection in /etc/portage since the only reason those config files will be updated is for package moves that are performed by portage itself.
Comment 22 Zac Medico gentoo-dev 2006-09-15 20:31:13 UTC
This has been released in 2.1.2_pre1.
Comment 23 Zac Medico gentoo-dev 2006-09-25 20:33:08 UTC
This has also been released in 2.1.1-r1.
Comment 24 Jakub Moc (RETIRED) gentoo-dev 2006-10-16 09:14:31 UTC
*** Bug 151580 has been marked as a duplicate of this bug. ***
Comment 25 Zac Medico gentoo-dev 2006-10-24 00:46:30 UTC
*** Bug 152626 has been marked as a duplicate of this bug. ***
Comment 26 Jakub Moc (RETIRED) gentoo-dev 2006-10-27 15:15:53 UTC
*** Bug 153073 has been marked as a duplicate of this bug. ***
Comment 27 GNUtoo 2006-10-28 08:54:01 UTC
 emerge -av nano


Performing Global Updates: /usr/portage/profiles/updates/4Q-2006
(Could take a couple of minutes if you have a lot of binary packages.)
  .='update pass'  *='binary update'  @='/var/db move'
  s='/var/db SLOT move' S='binary SLOT move' p='update /etc/portage/package.*'
......
Traceback (most recent call last):
  File "/usr/bin/emerge", line 4503, in ?
    retval = emerge_main()
  File "/usr/bin/emerge", line 4214, in emerge_main
    portage.global_updates(settings, trees, mtimedb["updates"])
  File "/usr/lib/portage/pym/portage.py", line 7128, in global_updates
    trees["/"]["bintree"].move_ent(update_cmd)
  File "/usr/lib/portage/pym/portage.py", line 5510, in move_ent
    self.populate()
  File "/usr/lib/portage/pym/portage.py", line 5755, in populate
    mycat = mytbz2.getfile("CATEGORY").strip()
AttributeError: 'NoneType' object has no attribute 'strip'
Comment 28 GNUtoo 2006-10-28 09:02:07 UTC
the patch didn't worked for me
Comment 29 GNUtoo 2006-10-28 09:04:19 UTC
the patch didn't worked for me
Comment 30 GNUtoo 2006-10-28 09:07:42 UTC
solved by:
*download a portage tarball and remplace the old portage with the tarba;;
*copy /usr/old-portage/local/layman/make.conf /usr/portage/local/layman/make.conf
Comment 31 Jakub Moc (RETIRED) gentoo-dev 2006-10-28 09:13:56 UTC
What kind of patch? Upgrade your portage.
Comment 32 Zac Medico gentoo-dev 2006-10-28 14:14:55 UTC
(In reply to comment #27)
>   File "/usr/lib/portage/pym/portage.py", line 5755, in populate
>     mycat = mytbz2.getfile("CATEGORY").strip()
> AttributeError: 'NoneType' object has no attribute 'strip'

That's a new bug, apparently triggered by a corrupt binary package.  I've filed bug 153181 to track that one.
Comment 33 Zac Medico gentoo-dev 2006-10-29 02:18:26 UTC
*** Bug 153248 has been marked as a duplicate of this bug. ***
Comment 34 Jakub Moc (RETIRED) gentoo-dev 2006-12-29 07:52:01 UTC
*** Bug 159382 has been marked as a duplicate of this bug. ***
Comment 35 Andrew Bovill 2007-02-14 06:46:19 UTC
Just wanted to let everyone know, I have been emerging recently (just fine), I run emerge --sync every night, and I just got this same error today.

Also waned to let you know that the patch fixed it perfectly!