• 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

chroot -> Too many levels of symbolic links

Status
Not open for further replies.

Shantal

New Pleskian
Hi guys,

I am testing out Plesk control panel 12 - looks promising, but the moment I hit chroot-ed environment, many things go wrong.
Set up:

Virutal server, running linux (64 bit Ubuntu 14.04 Server LTS);
Plesk Control Panel 12.0.18, Update #14;
Currently running on a trial license;
Brand new installation on a dedicated server;
I have two disks, one is for system stuff, plus plesk; second disk is supposed to be dedicated to /var and /home

root@testthing:/var/log# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 8.7G 29G 24% /
....
/dev/vdb1 493G 2.9G 465G 1% /disk2

root@testthing:/var/log# mount
/dev/vda1 on / type ext4 (rw,errors=remount-ro)
....
/dev/vdb1 on /disk2 type ext4 (rw)

root@testthing:/# ls -l /
total 4194416
drwxr-xr-x 2 root root 4096 Aug 16 20:59 bin
....
drwxrwxr-x 5 root root 4096 Aug 16 16:23 disk2
lrwxrwxrwx 1 root root 11 Aug 16 16:24 home -> /disk2/home
drwxr-xr-x 3 root root 4096 May 8 11:57 home.old
lrwxrwxrwx 1 root root 10 Aug 16 16:41 var -> /disk2/var
drwxr-xr-x 12 root root 4096 May 8 11:53 var.old

(to save place, I've removed the regular stuff that is everywhere and makes not difference for this case ... I think)

The plesk installation went just fine; update ran fine; I can register customers, their websites run fine ... as long as they get no shell at all, or regular shell to the server.

BUT: we need to jail all our customers under chroot. If that is not possible, we can't use Plesk.

I created a Service plan cloned form the Default domain plan and changed only to give the users ssh access to the server with a chroot env.

When I try to register a new client with this new service plan, it fails with lots of error messages (one per directory it tries to make), like this:

chrootmng: cannot set permissions for "/var/www/vhosts/demowh1.blah.blah/lib":Too many levels of symbolic links
...

Dropping the GUI and xperimenting in a shell, as root: If I run:
root@testthing:/usr/local/psa/admin/sbin# ./chrootmng --create --source=/var/www/vhosts/chroot/ --target=/var/www/vhosts/demowh1.blah.blah
open_basedir_with_nofollow: opeat failed: `var', Too many levels of symbolic links
chrootmng: cannot set permissions for "/var/www/vhosts/demowh1.blah.blah/lib":Too many levels of symbolic links
open_basedir_with_nofollow: opeat failed: `var', Too many levels of symbolic links
chrootmng: cannot set permissions for "/var/www/vhosts/demowh1.blah.blah/lib/x86_64-linux-gnu":Too many levels of symbolic links
open_basedir_with_nofollow: opeat failed: `var', Too many levels of symbolic links
....

but, if I run it like this:
root@testthing:/usr/local/psa/admin/sbin# ./chrootmng --create --source=/var/www/vhosts/chroot/ --target=/disk2/var/www/vhosts/demowh1.blah.blah

it proceeds to make a copy of all directories where it should.

so, at this point I am pretty sure that the problem is my link between /var and /disk2.

Still, I want to keep the user data on a separate disk from the system/plesk data.

How do I fix this?

Thank you for reading this far and for any help and suggestions that you might have for me,
- Shantal
 
Cause of "Too many levels of symbolic links" error in that vhosts location (variable HTTPD_VHOSTS_D in /etc/psa/psa.conf) has been changed using symlink and not with the /usr/local/psa/bin/transvhosts.pl utility.
So, use /usr/local/psa/bin/transvhosts.pl for changing vhosts location.
 
IgorG, thank you for your quick response.

Hm, I expected that since plesk was installed on top of already altered file system, it would "detect" the underlying links.

I just ran:

/usr/local/psa/bin/transvhosts.pl --dest-dir /disk2/var/www/vhosts --correct-scripts

Moving files to new directory...
Correct psa configuration file...
Correct passwd file...
Correct php-fpm pools configuration...
Restart php-fpm service...
Correct Fail2Ban jails configuration...
ERROR NOK: ('plesk-apache',)
File "/etc/fail2ban/jail.local" was stored successfully.
ERROR NOK: ('plesk-apache-badbot',)
Correct database...
Update hosting settings...
done
Update subdomains settings...
done
Update system users settings...
done
The service node 'local' was successfully updated.
Correct user scripts...

.. it kind of died here. The process is still there, but does not look to be doing anything - no started subprocesses.. running now on around 15 min.
Are those ERRORs something to worry about?

- Shantal
 
That did the trick :)

I can now create new domains with the chroot-ed subscription. I have also

HTTPD_VHOSTS_D /disk2/var/www/vhosts

in my psa.conf - looks strange, but as long as plesk is happy, I am ok :)

I have some chroot issues now (like scp complaining /usr/bin/ssh: No such file or directory, lost connection), but that is a matter of further work on chroot.

The issue of this post is resolved, thank you IgorG for your quick response and follow trough.

Best wishes,
- Shantal
 
Status
Not open for further replies.
Back
Top