#8016 BLOC 8.2.0 (: Rainbow state conflicts when switching back and forward between 8.1 and 8.2

Zarro Boogs per Child bugtracker at laptop.org
Sun Aug 17 15:08:34 EDT 2008


#8016: Rainbow state conflicts when switching back and forward between 8.1 and 8.2
---------------------------+------------------------------------------------
 Reporter:  tvoverbeek     |         Owner:  mstone              
     Type:  defect         |        Status:  new                 
 Priority:  blocker        |     Milestone:  8.2.0 (was Update.2)
Component:  security       |       Version:  not specified       
 Keywords:  blocks?:8.2.0  |   Next_action:  never set           
 Verified:  0              |     Blockedby:                      
 Blocking:                 |  
---------------------------+------------------------------------------------
 When alternate booting between 8.1 (build 708) and 8.2 (joyride-2302) back
 and forward some activities do not start because they cannot find their
 home directory.
 The problem is that rainbow state is divided between a part common to both
 8.1 and 8.2 (/home/olpc/isolation/1/) and a part individual to each OS
 (/etc/passwd and /etc/group).
 I have traced the cause to the following code snippet of function
 grab_home in inject.py:

 {{{

  149     uid_cmd = ['/usr/sbin/useradd', '-m', '-u', str(uid), '-g',
 str(gid),
  150                                     '-c', comment, '-d', home,
 str(uid)]
  151     log('adding user: %s', ' '.join(uid_cmd))
  152     try:
  153         subprocess.check_call(uid_cmd)
  154     except subprocess.CalledProcessError, e:
  155         if e.returncode == 9: # we don't care if the user already
 exists
  156             log('notice: home dir %s already exists', home)
  157         else:
  158             raise e
 }}}

 Line 155 is the problem. When the user exists in /etc/passwd, but the
 users home directory has been deleted useradd will still return with
 errorcode 9.

 In this case (errorcode 9) maybe rainbow should check that the home
 directory indeed exists, and if not create it. Disadvantage: an extra
 check at every activity launch. Alternatively when rainbow starts gc.py
 should check for consistency between /etc/passwd, /etc/group and the
 isolation spool.

 Here a scenario to reproduce the problem (assumption a machine with both
 an 8.1 and 8.2 OS as alternate boots):[[BR]]
 - Boot in 8.1 and on vt2 (do not use the Terminal activity) as root delete
 all rainbow users from /etc/passwd and all rainbow groups from /etc/group
 and 'rm -fr /home/olpc/isolation/1/'.[[BR]]
 - Reboot in 8.2 and do the same there on vt2.[[BR]]
 - Now we have a pristine situation for both 8.1 and 8.2.[[BR]]
 - Reboot into 8.1[[BR]]
 - Run the Calculator and Memorize activities in sequence. Calculator will
 get uid,gid 10000,10001; Memorize will get 1002,1003. The uid_pool will
 contain 10000,10001,10002,10003.[[BR]]
 - Reboot in 8.2. Now /etc/passwd and /etc/group will not contain any
 rainbow uids/gids yet. But bundle_id_to_gid will not be empty.
 Run the Memorize activity. Memorize will now get uid,gid
 10000,10003.[[BR]]
 - Reboot back into 8.1. If you boot verbose ('x' game key) you will see
 some error messages from gc.py when rainbow daemon starts about uid 10000
 (lines 50 and 32 of gc.py in build 708).
 The users 10000 and 10002 will stil exist in /etc/passwd.[[BR]]
 - Start Memorize. This hangs because the home directory specified in
 /etc/passwd does not exist.[[BR]]

 A similar scenario can be devised the other way. So there might be
 problems upgrading from a heavily used 8.1 system (many uids) to 8.2.

 For now I put a blocks?:8.2.0 in the keyword field, but I leave it up to
 'the powers that be' to decide if this is a real blocker for 8.2.0. You
 could mention the 'clean isolation spool and /etc/passwd and /etc/group'
 as a work-around in the Release Notes in case people have problems. Not
 too many people will boot back and forward between 8.1 and 8.2 (I hope).

-- 
Ticket URL: <http://dev.laptop.org/ticket/8016>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system


More information about the Bugs mailing list