jk_init: Error: `/usr/bin/less` and `/var/www/clients/client15/web20/usr/bin/less` are the same file
Found a case of bad/recursive symlinks which causes jk_init to error. I think this is a local problem due to an odd update path for both old->new debian versions combined with converting lxc -> kvm about a year ago, and not likely to be seen by many people, but I'll look at updating the jailkit cleanup routine to find these.
For one example, jk_init ended with:
Copying /usr/bin/less to /var/www/clients/client15/web20/usr/bin/less
Traceback (most recent call last):
File "/usr/sbin/jk_init", line 261, in <module>
main()
File "/usr/sbin/jk_init", line 258, in main
activateConfig(config, jail, args)
File "/usr/sbin/jk_init", line 173, in activateConfig
ji.handle_cfg_section(config,jail,cfg,section)
File "/usr/sbin/jk_init", line 119, in handle_cfg_section
self.didfiles = jk_lib.copy_binaries_and_libs(chroot, paths2, config['force'], config['verbose'], 1, try_hardlink=config['hardlink'],try_glob_matching=1,ha
ndledfiles=self.didfiles)
File "/usr/share/jailkit/jk_lib.py", line 737, in copy_binaries_and_libs
copy_with_permissions(file,chrootrfile,be_verbose, try_hardlink, allow_suid, retain_owner)
File "/usr/share/jailkit/jk_lib.py", line 565, in copy_with_permissions
shutil.copyfile(src,dst)
File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
raise Error("`%s` and `%s` are the same file" % (src, dst))
shutil.Error: `/usr/bin/less` and `/var/www/clients/client15/web20/usr/bin/less` are the same file
That is because:
# ls -l /var/www/clients/client15/web20/usr/bin/less /bin /usr/bin/less
lrwxrwxrwx 1 root root 7 Oct 1 2019 /bin -> usr/bin
-rwxr-xr-x 1 root root 166664 May 7 2018 /usr/bin/less
lrwxrwxrwx 1 root root 9 Oct 1 2019 /var/www/clients/client15/web20/usr/bin/less -> /bin/less