• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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