Unable to complete Power off / Reboot tests

Bug #1201769 reported by Po-Hsu Lin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox
Fix Released
High
Daniel Manrique

Bug Description

While testing the poweroff / reboot tests, the system will shutdown / reboot correctly.
But after it reboots, the small prompt window, which will show test result to tester, will not pop out.
And the log is not complete, the after-boot result is not there.

I think this might related to some policy-kit issue.
This conjecture arose because tester will be asked to enter password when running checkbox.

Checkbox version:
ii checkbox 0.16.4+bzr2261+201307140920~precise1 System testing application
ii checkbox-certification 0.16.4~ppa+bzr581+201307041618~precise1 Checkbox Certification Tests
ii checkbox-certification-client 0.16.4~ppa+bzr581+201307041618~precise1 Client Certification
ii checkbox-certification-tools 0.16.4~ppa+bzr581+201307041618~precise1 Checkbox Certification Tools
ii checkbox-qt 0.16.4+bzr1981+201307051440~precise1 QT4 interface for checkbox

Please find attachment for the poweroff log.

Related branches

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :
Revision history for this message
Daniel Manrique (roadmr) wrote :

Hello, Po-Hsu!

OK, looks like the username is not being correctly determined by the script. See how it thinks the username is "None", typical of a string representation of a Python variable with value "None":

2013-07-16 04:55:50,064 DEBUG Executing: "sed -i -e '$a# Automatically added by pm.py\\nNone ALL=NOPASSWD: /usr/bin/python' /etc/sudoers"..
.
2013-07-16 04:55:50,071 DEBUG Writing desktop file ('~None/.config/autostart/pm_test.desktop')...

So it's both creating entries for a nonexistent user, and trying to write a file to a bogus location. I suspect you'll find a ~None (literally) directory in the ubuntu user's home dir :)

Looking at the code, the problem is clear: it uses the SUDO_USER variable to determine the username. If running under policykit, this variable is most likely undefined.

username = os.getenv('SUDO_USER')

I'll find an equivalent and ensure the script works well with both, hopefully I'll have something by tomorrow.

Thanks for reporting this!

Changed in checkbox:
assignee: nobody → Daniel Manrique (roadmr)
importance: Undecided → High
status: New → In Progress
Revision history for this message
Daniel Manrique (roadmr) wrote :

OK, sudo documentation says:

     SUDO_UID Set to the user ID of the user who invoked sudo.

     SUDO_USER Set to the login name of the user who invoked sudo.

And pkexec documentation says:

the PKEXEC_UID environment variable is set to the user id of the process invoking pkexec.

So while SUDO_USER has no direct equivalent, we can approximate the behavior by using PKEXEC_UID.

so if SUDO_USER is blank, we can get the username with pwd.getpwuid(os.getenv('PKEXEC_UID')).

Of course we should do proper validation of all these variables to ensure our information makes sense. If the script can't determine the originally-running user, it should exit gracefully with a clear error message indicating the problem.

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

Hmm, that's strange.
I didn't see any nonexistent (for instance, None) user directory in the home dir.

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

It works fine now (checkbox-dev ver 2325)
I think maybe this bug could be marked as Fix Released?

Revision history for this message
Daniel Manrique (roadmr) wrote :

Yes, I'll mark as Released now. Thanks!

Changed in checkbox:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.