Ticket #5819 (closed defect: fixed)

Opened 7 years ago

Last modified 6 years ago

Can't set timezone with control panel with login shell (su -)

Reported by: kimquirk Owned by: erikos
Priority: normal Milestone: Update.1
Component: other-activity Version:
Keywords: Cc: cscott
Action Needed: Verified: no
Deployments affected: Blocked By: #5537
Blocking:

Description

Build 650

Go into terminal activity and try to set timezone with: sugar-control-panel -s timezone America/Los_Angeles

And it says you need to be root. If I set su - first; then the error message is: RuntimeError "the SUGAR_PATH environment is not set".

I'm not asking to fix it on 650; but I'm wondering how it worked earlier and stopped in 650; and to make sure it works in the next release, Update1.

Change History

Changed 7 years ago by blahedo

This is more or less a dup of #5547, although I'll note that if you type "su" by itself, without the hyphen that triggers a full login shell, it works ok.

Changed 7 years ago by erikos

  • priority changed from blocker to normal
  • summary changed from Can't set timezone with control panel to Can't set timezone with control panel with login shell (su -)

If you use su by itself without hyphen it will work fine - as blahedo says this does not trigger the login shell (which looses the SUGAR_PATH). su by itself always worked i noted how to become root here: http://wiki.laptop.org/go/Sugar_Control_Panel

#5537 is handling how to preserve the SUGAR_PATH for the sudo command which seems to be the new way of handling to become root privileges.

So I think this is not a blocker anymore since we have a working way.

Changed 7 years ago by erikos

  • status changed from new to closed
  • resolution set to fixed

We use sudo now to get root privileges we need for certain commands. The sudo command which preserves the SUGAR_PATH went into joyride and update-1 (tested in 1525 and update.1-679) and the following command should now be used to set the timezone:

sudo sugar-control-panel -s timezone [timezone]

Changed 7 years ago by chihyu

  • status changed from closed to reopened
  • resolution deleted

tested with joyride 1537, still failed.

  • Hit ctrl-alt-mesh
  • Hit Enter to login (as root)
  • Type sudo sugar control-panel -s timezone America/New_York, returns the following error message:
     File "/usr/bin/sugar-control-panel", line 26, in <module>
       sys.path.insert(0, env.get_shell_path())
     File "/usr/lib/python2.5/site-packages/sugar/env.py", line 90, in get_shell_path
       return _get_sugar_path('shell', path)
     File "/usr/lib/python2.5/site-packages/sugar/env.py", line 36, in _get_sugar_path
       raise RuntimeError("The SUGAR_PATH environment variable is not set.")
    RuntimeError: The SUGAR_PATH environment variable is not set.
    
  • Type sugar control-panel -s timezone America/New_York returns the same message.

Changed 7 years ago by erikos

You are using the virtual console i guess. In the virtual console you are logged in as root and the SUGAR_PATH is not set. You should use the Terminal for these commands (tested in 680 as working). I am not sure setting the SUGAR_PATH works for the virtual console, I think Bernie and m_stone did the work with the auto-login.

Changed 7 years ago by cscott

  • cc cscott added

Let's keep an eye on this as #5537 changes back to su.

Changed 7 years ago by erikos

  • keywords jg removed
  • blockedby 5537 added

Changed 7 years ago by erikos

'export SUGAR_PATH=/usr/share/sugar' if you want to use s.c.p in the virtual console. With the sugar rework the SUGAR_PATH is no longer required - but this will probably go into Update.2.

You are all good when you use sudo if you need to set settings using root privileges and invoke the command in the terminal activity - i would say this is the recommended way. If you invoke for example 'sugar-control-panel language' as root - the /root/.i18n file will be used since the code relies on $HOME :/

Changed 6 years ago by cscott

Is this bug still open? I'm pretty sure the sudo and wiki instruction changes fixed this?

Changed 6 years ago by erikos

  • status changed from reopened to closed
  • resolution set to fixed

This is fixed in current joyride. You can use the s.c.p from the virtual console. It woun't work as root.

Note: See TracTickets for help on using tickets.