[Bug 1362920] [NEW] OSError: [Errno 9] Bad file descriptor

Launchpad Bug Tracker 1362920 at bugs.launchpad.net
Tue Sep 9 09:25:27 UTC 2014


You have been subscribed to a public bug:

After working around https://bugs.launchpad.net/ubuntu/+source/oem-
config/+bug/1361595, oem-config still does not properly run on server
based installs.

Code that had previously worked under python 2.x (used in 12.04 LTS,
AFAICT) is now too aggressive under python 3.x (used in 14.04 LTS).
This is resulting the the file descriptor for /dev/urandom being closed
prematurely in open_terminal(), due to the following section:

        for i in range(tty):
            if i != 2:
                os.close(i)

However, as reported here: http://bugs.python.org/issue21207, once the
urandom persistent fd is closed it wasn't being reopend.  Given this
report is from April of 2014, I'm pretty sure the version of python
shipped with 14.04 LTS has the same behavior.

Sure enough, if I prevent oem-config from closing the fd for
/dev/urandom, oem-config is finally able to at least run.

The following is how I've solved the problem so far.

        # need to avoid closing the FD for /dev/urandom
        # http://bugs.python.org/issue21207
        urand_inode = os.stat('/dev/urandom').st_ino
        for i in range(tty):
            if i != 2:
                inode = os.fstat(i).st_ino
                if inode != urand_inode:
                    os.close(i)

** Affects: ubiquity (Ubuntu)
     Importance: Undecided
         Status: New

-- 
OSError: [Errno 9] Bad file descriptor
https://bugs.launchpad.net/bugs/1362920
You received this bug notification because you are a member of Ubuntu Foundations Bugs, which is subscribed to ubiquity in Ubuntu.



More information about the foundations-bugs mailing list