DOMjudge / domjudge-packaging

DOMjudge packaging for (Linux) distributions and live image
32 stars 40 forks source link

Support Python3 #46

Closed rmartinsanta closed 5 years ago

rmartinsanta commented 5 years ago

I have not been able to make Python3 work inside the judgehost, steps taken:

  1. Access judgehost using docker run
  2. Install python3 using apt
  3. Test in domjudge, fails because python3 is not available inside the chroot.
  4. Try to install python3 inside chroot container with commands like: '/opt/domjudge/judgehost/bin/dj_run_chroot "apt update && apt install python3" '. Command timeouts as internet is not available.

In #38 it looks like apt worked inside the chroot, how can I replicate the behaviour? Is there any other way to start using Python3?

Thanks in advance

nickygerritsen commented 5 years ago

I wonder why Python3 is not available in the chroot, as it should be there I think for newer versions...

Can you run dj_run_chroot without arguments and see if you can ping stuff? Try both a domain (google.com) and an IP (8.8.8.8) to check if DNS is the issue.

rmartinsanta commented 5 years ago

EDIT: Ping command is not available inside the chroot @nickygerritsen

nickygerritsen commented 5 years ago

As far as I know we do not limit internet connectivity in the chroot globally, only when running submissions. I just chrooted inside a chroot I have set up and I do have internet connectivity there.

Another option that you might try is to remove the chroot directory and run /opt/domjudge/judgehost/bin/dj_make_chroot -i python3 to recreate it but then with python3.

rmartinsanta commented 5 years ago

it looks like a problem with DNS resolution inside the chroot, will keep investigating and see what can be done.

Edit: Contents of resolv.conf file

# This file is included on the metadata iso
nameserver 192.168.65.1
search fruitsalad
domain fruitsalad

The nameserver is not valid, will try to set google dns and see what happens

nickygerritsen commented 5 years ago

I wonder how it gets that nameserver.... fruitsalad is my home domain name, so clearly it got it from there.

Can you copy /etc/resolv.conf to the chroot directory? That should probably work.

If so, I will add a step to the Docker startup that does the same.

Edit: wait, we do that already: https://github.com/DOMjudge/domjudge-packaging/blob/master/docker/judgehost/scripts/start.sh#L36

See also https://github.com/DOMjudge/domjudge-packaging/issues/17

Are you running an older container by any chance?

rmartinsanta commented 5 years ago

I was using a previous container version, I made a db backup, recreated all the containers, reimport and install python3 just in case, everything seems to work right now.

Thanks for your help!

P.D: I made an script to install everything from scratch in a clean ubuntu server (docker, docker-compose, domjudge containers, configure everything), I can submit it as a PR if you are interested.

nickygerritsen commented 5 years ago

Feel free to open a pr to add this to the readme!

I will close this issue now.