question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Installed cron `keymaker-group-sync` fails on adding user to group

See original GitHub issue

The automatically installed cron /etc/cron.d/keymaker-group-sync fails when it needs to add a user to a group:

INFO:keymaker:Syncing IAM group keymaker_mynewgroup
WARNING:keymaker:User myuser1 is not provisioned or not managed by keymaker, skipping
INFO:keymaker:Adding user myuser2 to group sudo
Traceback (most recent call last):
  File "/usr/local/bin/keymaker", line 89, in <module>
    locals()[args.command](args)
  File "/usr/local/lib/python2.7/dist-packages/keymaker/__init__.py", line 240, in sync_groups
    subprocess.check_call(["usermod", "--append", "--groups", unix_group_name, user])
  File "/usr/lib/python2.7/subprocess.py", line 535, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Problem is that the $PATH variable is not set. Current solution is to set the variable manually (used /etc/environment):

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
*/5 * * * * root /usr/local/bin/keymaker sync_groups

The cron would have probably also failed on the other commands used by sync_groups: groupadd and gpasswd. By setting the PATH these commands should work as well.

My environment details: Keymaker: 0.4.3 Distribution: Ubuntu 14.04.5 LTS Kernel: Linux 3.13.0-112-generic #159-Ubuntu

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jbergknoff-rivalcommented, Sep 26, 2019

Same situation on Ubuntu 18.04

0reactions
jbergknoff-rivalcommented, Oct 14, 2019

Sorry I didn’t respond earlier. This problem can be reproduced using a stock Ubuntu 18.04 AMI in EC2, i.e. those provided by Canonical here: https://cloud-images.ubuntu.com/locator/ec2/.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is my crontab not working, and how can I troubleshoot it?
Edit your crontab; go to the end of the line which contains the last command and insert a new line (press enter). Check...
Read more >
Crontab error: no crontab For [user] - Unix Stack Exchange
It turns out the actual root cause of the problem was that I was using ctrl+z to close nano (sends process to background)...
Read more >
IJ37076: USER LICENSE TYPE CHANGED FROM ... - IBM
PROBLEM DESCRIPTION: To an Express Concurrent user, Adding READ access to AWADMIN application incorrectly changes the user to CONCURRENT.
Read more >
Controlling Access to the crontab Command
Controlling Access to the crontab Command. You can control access to the crontab command by using two files in the /etc/cron.d directory: cron.deny...
Read more >
How To Use Cron to Automate Tasks on Ubuntu 18.04
To schedule a job, open up your crontab for editing and add a task written in the form of a cron expression. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found