Problem:UCS@school collecting results in exam mode - FileNotFoundError: [Errno 2] file or directory not found

Problem

While in exam mode, you will receive the following traceback in the UCM and cannot collect exam results from students.

Interner Server-Fehler in "schoolexam/exam/collect".
Request: schoolexam/exam/collect

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/univention/management/console/base.py", line 388, in __error_handling
    six.reraise(etype, exc, etraceback)
  File "/usr/lib/python3/dist-packages/six.py", line 693, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/univention/management/console/base.py", line 285, in execute
    function.__func__(self, request, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/decorators.py", line 189, in _response
    return function(self, request)
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/decorators.py", line 478, in _response
    result = _multi_response(self, request)
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/decorators.py", line 189, in _response
    return function(self, request)
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/decorators.py", line 602, in _response
    return list(function(self, iterator, *nones))
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/decorators.py", line 444, in _fake_func
    yield function(self, *args)
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/schoolexam/__init__.py", line 827, in collect_exam
    project.collect()
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/distribution/util.py", line 756, in collect
    available_space = self._get_available_space()
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/distribution/util.py", line 689, in _get_available_space
    statvfs = os.statvfs(self.sender_projectdir)
FileNotFoundError: [Errno 2] Datei oder Verzeichnis nicht gefunden: '/home/mejneschool2/lehrer/m.muster/Klassenarbeiten/Univention-Test-Ergebnisse'

Environment

UCS: 5.0-9 errata1145
Installed: cups=2.2.1 dhcp-server=12.0 samba4=4.16 self-service=5.0 squid=3.5 ucsschool=5.0 v6 ucsschool-veyon-proxy=4.9.0.8-ucs1
Upgradable:

Solution

You have to remove the immutable flag from the directory where the exam results are stored.
chattr -i /home/mejneschool2/lehrer/m.muster/Klassenarbeiten/

If several teachers are involved at the school, you can also use the following script. This will then remove the immutable flag under /home/$(hostname)/teacher/.

remove_immutable_flag.sh (331 Bytes)

#!/bin/bash
  
# Verzeichnis definieren
DIR="/home/$(hostname)/lehrer/"

# Schleife, um durch alle Dateien und Verzeichnisse zu gehen
find "$DIR" -type f -or -type d | while read -r file; do
    # Entferne das immutable Flag
    chattr -i "$file"
done

echo "Das immutable-Flag wurde für alle Dateien und Verzeichnisse entfernt."

Command to use as root:

  1. chmod +x remove_immutable_flag.sh

  2. . remove_immutable_flag.sh

Investigation

Bug 57708

We use the so-called ‘immutable bit’ on folders containing exam results to prevent students from deleting them and to ensure that the results are always saved. Originally this was also enabled for teachers, but this caused Bug 57661. We have fixed this by removing the entire ‘Immutable’ routine for Tutors.

The problem now occurs when an environment has the Immutable bit set but not removed (for example, a system crash during the exam has left the system in an inconsistent state) and then upgrades to the latest version. As the routine is now completely missing, the bit is neither removed nor managed in any way.

Mastodon