• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Resolved fetch_url command suddenly broken in chrooted environment

Talistech

Basic Pleskian
Server operating system version
Ubuntu 22.04.2 LTS
Plesk version and microupdate number
Version 18.0.54 Update #2
Hi fellow Pleskians,

I broke the fetch_url command in a chrooted environment for only 1 specific user.
I'm getting the following mail sent by failed cron jobs:
Code:
-: line 1: /opt/psa/admin/sbin/fetch_url: No such file or directory

Running/fetching the urls via the web interface works well, no errors there.
Anyone has an idea how I can fix this? I have already found older forum posts about reverting the Shell environment to bash, but I don't want that.
I want to keep this users chrooted.

Thank you,

Kind regards,
Mustafa
 
Could you please provide the cron file content from /var/spool/cron of that specific cronjob? The domain name can be redacted partially, but please leave most of it intact, e.g. if there are parameters added. I can imagine that the issue is caused by an unusual URL or parameter string.
 
Could you please provide the cron file content from /var/spool/cron of that specific cronjob? The domain name can be redacted partially, but please leave most of it intact, e.g. if there are parameters added. I can imagine that the issue is caused by an unusual URL or parameter string.
Sadly no parameters or unusual urls :/

Bash:
root@[REDACTED]:~# cat /var/spool/cron/crontabs/[REDACTED]
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/opt/psa/tmp/sssxmShj8 installed on Fri Aug  4 09:19:31 2023)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
MAILTO="info@[REDACTED]"
SHELL="/opt/psa/bin/chrootsh"
*/15    *    *    *    *    (/opt/psa/admin/sbin/fetch_url 'https://[REDACTED]/cron/index')  > /dev/null

The issue only occurs in a chrooted environment. The rest of my fetch_url calls are working fine for users with a /bin/bash environment. Executing the calls via the web gui also works flawlessly through the admin user though.
 
I have tried to reproduce the issue but had no success. Whatever I did, the SHELL in my cron file always remained /bin/sh. I change the shell of the account before creating the cron job, while the cron job existed and changed it back between chrooted and other shell types, but this had no influence on the cron file.

It is true that the shell for this job needs to be /bin/sh, because else the fetch_url utility cannot be run, but here it remains unclear why the wrong shell is set.

To mitigate the issue I suggest to manually changing the SHELL line to
SHELL="/bin/sh"
for this cron entry.
 
I just got it fixed, I don't know where I went wrong but some other commands were also missing, such as "ls" and "mktemp".

Code:
curl -o update-chroot.sh https://raw.githubusercontent.com/plesk/kb-scripts/master/update-chroot/update-chroot.sh
chmod 700 update-chroot.sh
./update-chroot.sh  --add /opt/psa/admin/sbin/fetch_url
./update-chroot.sh  --add mktemp
./update-chroot.sh  --add ls
./update-chroot.sh  --apply all

Seems good for now. Thanks for looking with me @Peter Debik! Very much appreciated how you are always replying to every forum post.
 
I have tried to reproduce the issue but had no success. Whatever I did, the SHELL in my cron file always remained /bin/sh. I change the shell of the account before creating the cron job, while the cron job existed and changed it back between chrooted and other shell types, but this had no influence on the cron file.

It is true that the shell for this job needs to be /bin/sh, because else the fetch_url utility cannot be run, but here it remains unclear why the wrong shell is set.

To mitigate the issue I suggest to manually changing the SHELL line to
SHELL="/bin/sh"
for this cron entry.

Yes that fixes it but it's not the correct fix. Changing it to /bin/bash was also working but that takes the user out of the chrooted environment. See my reply top of here. Seems fixed for now, thanks
 
Back
Top