Project

General

Profile

Bug #24759

Fix "Run now" button for Cron Jobs and Rsync Tasks

Added by Ben Leung almost 4 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Expected
Assignee:
William Grzybowski
Category:
Middleware
Target version:
Seen in:
Severity:
New
Reason for Closing:
Reason for Blocked:
Needs QA:
No
Needs Doc:
Yes
Needs Merging:
Yes
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:
ChangeLog Required:
No

Description

Running on FreeNAS-11.0-RELEASE (a2dc21583) and noticed I could not run any rsync tasks from the GUI when clicking "Run now". I did some troubleshooting and have determined I cannot run any cron jobs or rsync tasks from the GUI's "Run now" button.

Looking at /var/log/debug.log, I've narrowed it down to a Permission error with the following being logged:
[CODE]
Jun 21 23:43:09 server /runnow.py: [tools.runnow:133] Entered in daemon context
Jun 21 23:43:09 server /runnow.py: [tools.runnow:137] Exception on run now
Jun 21 23:43:09 server /runnow.py: [tools.runnow:12] Traceback (most recent call last):
Jun 21 23:43:09 server /runnow.py: [tools.runnow:12] File "/usr/local/www/freenasUI/tools/runnow.py", line 135, in <module>
Jun 21 23:43:09 server /runnow.py: [tools.runnow:12] main(args)
Jun 21 23:43:09 server /runnow.py: [tools.runnow:12] File "/usr/local/www/freenasUI/tools/runnow.py", line 91, in main
Jun 21 23:43:09 server /runnow.py: [tools.runnow:12] os.setgid(passwd.pw_gid)
Jun 21 23:43:09 server /runnow.py: [tools.runnow:12] PermissionError: [Errno 1] Operation not permitted
Jun 21 23:43:09 server /runnow.py: [tools.runnow:140] Exiting runnow process
[/CODE]

I've checked as many users and reset/changed passwords, all to no avail. I am logged into the FreeNAS GUI with the root user when clicking "Run now". I know these rsync jobs were running the GUI when I was running pre-Corral but have been running rsync manually when SSH'ed in so not sure when exactly this functionality broke. I ended up doing the downgrade from Corral to 9.10-something then back up to 11 release if that changes anything.

Can anyone suggest permissions I should check and on which users?


Related issues

Related to FreeNAS - Bug #25151: Fix cron job "Run now" buttonResolved2017-07-15
Is duplicate of FreeNAS - Bug #24786: rsync taskClosed: Duplicate2017-06-23

Associated revisions

Revision e75f252e (diff)
Added by William Grzybowski almost 4 years ago

fix(gui): setusercontext already sets user/group/login and much more Ticket: #24759

Revision d00fc1d2 (diff)
Added by William Grzybowski almost 4 years ago

fix(gui): setusercontext already sets user/group/login and much more Ticket: #24759 (cherry picked from commit e75f252ec1a696a16cb2cfe49fadf273266b2395)

Revision 88de79c5 (diff)
Added by William Grzybowski almost 4 years ago

fix(gui): setusercontext already sets user/group/login and much more Ticket: #24759

History

#1 Updated by William Grzybowski almost 4 years ago

  • Status changed from Unscreened to Screened
  • Priority changed from No priority to Expected
  • Target version set to 11.0-U1

#2 Updated by William Grzybowski almost 4 years ago

  • Status changed from Screened to 15

I dont seem to be able to reproduce this issue.

Can you get Save Debug (System - Advanced) and attach here?

The output of "procstat -s `pgrep uwsgi`" would be useful as well.

#3 Updated by Ben Leung almost 4 years ago

  • File debug-bdlmelnas1-20170622095754.tgz added

Procstat output:

PID COMM EUID RUID SVUID EGID RGID SVGID UMASK FLAGS GROUPS
4769 uwsgi 0 0 0 0 0 0 000 - 0
2780 uwsgi 0 0 0 0 0 0 000 - 0

Debug file attached

#4 Updated by William Grzybowski almost 4 years ago

With what user are you trying to run this job? I can't seem to reproduce this in any way.

#5 Updated by Ben Leung almost 4 years ago

William Grzybowski wrote:

With what user are you trying to run this job? I can't seem to reproduce this in any way.

I'm logged in with the 'root' user on the GUI and clicking "Run now" whilst logged in.

Any new rsync jobs and cron jobs I create have exactly the same problem.

Reinstall time?

#6 Updated by William Grzybowski almost 4 years ago

Ben Leung wrote:

William Grzybowski wrote:

With what user are you trying to run this job? I can't seem to reproduce this in any way.

I'm logged in with the 'root' user on the GUI and clicking "Run now" whilst logged in.

Any new rsync jobs and cron jobs I create have exactly the same problem.

Reinstall time?

No, I mean, what user did you pick in User field of CronJob dialog/form?

#7 Updated by Ben Leung almost 4 years ago

William Grzybowski wrote:

Ben Leung wrote:

William Grzybowski wrote:

With what user are you trying to run this job? I can't seem to reproduce this in any way.

I'm logged in with the 'root' user on the GUI and clicking "Run now" whilst logged in.

Any new rsync jobs and cron jobs I create have exactly the same problem.

Reinstall time?

No, I mean, what user did you pick in User field of CronJob dialog/form?

I just checked the user in the rsync task and it is the "rsyncuser" user that I had created to run rsync tasks. Based on your question, I just did some further tests and if I switch that to the 'root' user the "Run Now" button runs the rsync task. Scheduling of the rsync task also works fine with 'root' as the user.

#8 Updated by Vaibhav Chauhan almost 4 years ago

  • Target version changed from 11.0-U1 to 11.0-U2

#9 Updated by William Grzybowski almost 4 years ago

Ben Leung wrote:

William Grzybowski wrote:

Ben Leung wrote:

William Grzybowski wrote:

With what user are you trying to run this job? I can't seem to reproduce this in any way.

I'm logged in with the 'root' user on the GUI and clicking "Run now" whilst logged in.

Any new rsync jobs and cron jobs I create have exactly the same problem.

Reinstall time?

No, I mean, what user did you pick in User field of CronJob dialog/form?

I just checked the user in the rsync task and it is the "rsyncuser" user that I had created to run rsync tasks. Based on your question, I just did some further tests and if I switch that to the 'root' user the "Run Now" button runs the rsync task. Scheduling of the rsync task also works fine with 'root' as the user.

What is special about your rsyncuser? What is its id and what groups does it belong to? Is it part of AD or something?

#10 Updated by Ben Leung almost 4 years ago

William Grzybowski wrote:

Ben Leung wrote:

William Grzybowski wrote:

Ben Leung wrote:

William Grzybowski wrote:

With what user are you trying to run this job? I can't seem to reproduce this in any way.

I'm logged in with the 'root' user on the GUI and clicking "Run now" whilst logged in.

Any new rsync jobs and cron jobs I create have exactly the same problem.

Reinstall time?

No, I mean, what user did you pick in User field of CronJob dialog/form?

I just checked the user in the rsync task and it is the "rsyncuser" user that I had created to run rsync tasks. Based on your question, I just did some further tests and if I switch that to the 'root' user the "Run Now" button runs the rsync task. Scheduling of the rsync task also works fine with 'root' as the user.

What is special about your rsyncuser? What is its id and what groups does it belong to? Is it part of AD or something?

Looking at it, it doesn't have any particular special attributes - it's user ID is 1004, it's a member of 'rsyncuser' group (id: 1004), not part of AD, no home dir, sudo not permitted, no auxiliary group membership

Tried "Run Now"ing as another user and it also failed. What permissions does a user account need to be able to "Run Now" an rsync task?

#11 Updated by William Grzybowski almost 4 years ago

Ben Leung wrote:

William Grzybowski wrote:

Ben Leung wrote:

William Grzybowski wrote:

Ben Leung wrote:

William Grzybowski wrote:

With what user are you trying to run this job? I can't seem to reproduce this in any way.

I'm logged in with the 'root' user on the GUI and clicking "Run now" whilst logged in.

Any new rsync jobs and cron jobs I create have exactly the same problem.

Reinstall time?

No, I mean, what user did you pick in User field of CronJob dialog/form?

I just checked the user in the rsync task and it is the "rsyncuser" user that I had created to run rsync tasks. Based on your question, I just did some further tests and if I switch that to the 'root' user the "Run Now" button runs the rsync task. Scheduling of the rsync task also works fine with 'root' as the user.

What is special about your rsyncuser? What is its id and what groups does it belong to? Is it part of AD or something?

Looking at it, it doesn't have any particular special attributes - it's user ID is 1004, it's a member of 'rsyncuser' group (id: 1004), not part of AD, no home dir, sudo not permitted, no auxiliary group membership

Tried "Run Now"ing as another user and it also failed. What permissions does a user account need to be able to "Run Now" an rsync task?

There should not be any, I can run with the "nobody" user just fine. I'll make some more experimentations.

#12 Updated by Ben Leung almost 4 years ago

William Grzybowski wrote:

Ben Leung wrote:

William Grzybowski wrote:

Ben Leung wrote:

William Grzybowski wrote:

Ben Leung wrote:

William Grzybowski wrote:

With what user are you trying to run this job? I can't seem to reproduce this in any way.

I'm logged in with the 'root' user on the GUI and clicking "Run now" whilst logged in.

Any new rsync jobs and cron jobs I create have exactly the same problem.

Reinstall time?

No, I mean, what user did you pick in User field of CronJob dialog/form?

I just checked the user in the rsync task and it is the "rsyncuser" user that I had created to run rsync tasks. Based on your question, I just did some further tests and if I switch that to the 'root' user the "Run Now" button runs the rsync task. Scheduling of the rsync task also works fine with 'root' as the user.

What is special about your rsyncuser? What is its id and what groups does it belong to? Is it part of AD or something?

Looking at it, it doesn't have any particular special attributes - it's user ID is 1004, it's a member of 'rsyncuser' group (id: 1004), not part of AD, no home dir, sudo not permitted, no auxiliary group membership

Tried "Run Now"ing as another user and it also failed. What permissions does a user account need to be able to "Run Now" an rsync task?

There should not be any, I can run with the "nobody" user just fine. I'll make some more experimentations.

I edited by rsync task and changed user to "nobody" and have the same permissions error as per original report. Please let me know if you want me to test anything else.

#13 Updated by William Grzybowski almost 4 years ago

#14 Updated by William Grzybowski almost 4 years ago

Ben Leung wrote:

I edited by rsync task and changed user to "nobody" and have the same permissions error as per original report. Please let me know if you want me to test anything else.

Can you take a screenshot of the Task you're using? I don't seem to get it to reproduce in any way.

#15 Updated by William Grzybowski almost 4 years ago

  • Status changed from 15 to Fix In Progress

Nevermind I could reproduce it now.

#16 Updated by William Grzybowski almost 4 years ago

  • Category changed from OS to 3
  • Status changed from Fix In Progress to Needs Developer Review
  • Assignee changed from William Grzybowski to Suraj Ravichandran

#17 Updated by Suraj Ravichandran almost 4 years ago

  • Status changed from Needs Developer Review to Reviewed by Developer
  • Assignee changed from Suraj Ravichandran to William Grzybowski
  • % Done changed from 0 to 100

LGTM, there is this minor change that I suggested but we can live without that too.

Thus, marking this as reviewed.

However, I have not tested this (just tested brief parts of it on my Python interpreter) so I request that QA do the needful
@Release Engineer, note that this is an old style ticket (i.e. pre new RE procedure) so please treat is as the same (there is a fix branch and such).

Thanks

#18 Updated by Vaibhav Chauhan almost 4 years ago

  • Target version changed from 11.0-U2 to 11.0-U3

#19 Updated by Dru Lavigne almost 4 years ago

  • Related to Bug #25151: Fix cron job "Run now" button added

#20 Updated by Vaibhav Chauhan over 3 years ago

please publish your changes in a PR which will be merged against stable branch, also please let us know here when you have PR ready.

#21 Updated by Vaibhav Chauhan over 3 years ago

  • Status changed from Reviewed by Developer to 47

#22 Updated by Dru Lavigne over 3 years ago

  • Subject changed from Tasks: Cron Jobs / Rsync Tasks - "Run now" button not running tasks due to a PermissionError to Fix "Run now" button for Cron Jobs and Rsync Tasks

#23 Updated by Joe Maloney over 3 years ago

  • Status changed from 47 to Ready For Release
  • Needs QA changed from Yes to No
  • QA Status Test Passes added
  • QA Status deleted (Not Tested)

For rsync verified that run now works by creating module named graphics on TrueNAS. Clicked run now, and watched the destination populate from the FreeNAS with rsync push task:

root@ixqa1-nodeb:/mnt/tank/graphics/graphics # ls la
total 27
drwxr-xr-x 7 root wheel 7 Aug 28 13:44 .
drwxr-xr-x 3 root wheel 3 Aug 28 13:44 ..
drwx-----
2 root wheel 4 Aug 28 13:44 .~tmp~
drwxr-xr-x 3 root wheel 3 Aug 28 13:44 .AppleDB
drwxr-xr-x 2 root wheel 2 May 4 08:57 AD01
drwxr-xr-x 8 root wheel 8 Aug 28 13:44 bonnie
drwxr-xr-x 2 root wheel 2 May 4 08:58 bonniemini

For cron created a task that leaves stdout enabled date > /mnt/tankb/cronttest.out. Clicked run now and watched the file get created with timestamp:
root@bonniemini:/mnt/tankb # more cron-test.out
Mon Aug 28 10:40:15 PDT 2017

#24 Updated by Dru Lavigne over 3 years ago

  • Status changed from Ready For Release to Resolved

#25 Updated by Dru Lavigne over 3 years ago

  • File deleted (debug-bdlmelnas1-20170622095754.tgz)

Also available in: Atom PDF