bugJailkit - Bugs: bug #30744, jk_init fails throws exception...

 
 

bug #30744: jk_init fails throws exception when run first to create a chroot environment

Submitter:  Sebastian Reitenbach <buzzdee>
Submitted:  Wed 11 Aug 2010 09:26:36 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Need Info
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 15 Aug 2010 10:57:42 AM UTC, comment #3: 

Yes, the directory did not existed yet.

Sebastian Reitenbach <buzzdee>
Fri 13 Aug 2010 02:36:03 PM UTC, comment #2: 

hmm I cannot reproduce this.

did the directory /home/testjail2 exist before the command or not?

Olivier Sessink <oli4>
Group administrator
Wed 11 Aug 2010 08:02:13 PM UTC, comment #1: 

hmm your patch makes the error message go away, but the code shouldn't be executed if the directory already exists...

I'll have to test this

Olivier Sessink <oli4>
Group administrator
Wed 11 Aug 2010 09:26:36 AM UTC, original submission:  

running jk_init at the first time throws below exception:


$ sudo jk_init -j /home/testjail2 jk_lsh -f               
ERROR: cannot lstat() /home/testjail2                     
/home                                                     
Creating jail /home/testjail2                             
Traceback (most recent call last):                        
  File "/usr/local/sbin/jk_init", line 246, in <module>   
    main()                                                
  File "/usr/local/sbin/jk_init", line 243, in main       
    activateConfig(config, jail, args)
  File "/usr/local/sbin/jk_init", line 163, in activateConfig
    ji.handle_cfg_section(config,jail,cfg,section)
  File "/usr/local/sbin/jk_init", line 98, in handle_cfg_section
    self.handle_cfg_section(config,chroot,cfg,tmp)
  File "/usr/local/sbin/jk_init", line 133, in handle_cfg_section
    jk_lib.init_passwd_and_group(chroot,users,groups,config['verbose'])
  File "/usr/local/share/jailkit/jk_lib.py", line 738, in init_passwd_and_group
    create_parent_path(chroot,'/etc/', be_verbose, copy_permissions=0, allow_suid=0, copy_ownership=0)
  File "/usr/local/share/jailkit/jk_lib.py", line 445, in create_parent_path
    os.mkdir(jailpath, 0755)
OSError: [Errno 17] File exists: '/home/testjail2/etc/'

running it a second time, it works as expected.

Appended patch fixes the problem for me. However, I'm not perfectly sure whether this is the right way to fix it.
I ran into the same problem on SLES 11 and OpenBSD.

patch is against jailkit-2.11

Sebastian Reitenbach <buzzdee>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #21187:  patch-py_jk_lib_py added by buzzdee (631B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by oli4 (Posted a comment)
  • -email is unavailable- added by buzzdee (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-08-13 oli4 StatusNone Need Info
    2010-08-11 buzzdee Attached File- Added patch-py_jk_lib_py, #21187

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code