HowTo: Debug Quota Issues in UMC

How To:

Debug quota issues in UMC.

When opening the UMC module you might get an error about “Internal Server Error: The module process ended
In /var/log/univention/management-console-module-quota.log you will see error messages like this:

17.01.20 10:31:20.793  MODULE      ( ERROR   ) : Traceback (most recent call last):
  File "/usr/sbin/univention-management-console-module", line 121, in <module>
    notifier.loop()
  File "/usr/lib/pymodules/python2.7/notifier/nf_generic.py", line 287, in loop
    step()
  File "/usr/lib/pymodules/python2.7/notifier/nf_generic.py", line 279, in step
    __min_timer = dispatch.dispatcher_run()
  File "/usr/lib/pymodules/python2.7/notifier/dispatch.py", line 72, in dispatcher_run
    if not disp():
  File "/usr/lib/pymodules/python2.7/notifier/popen.py", line 290, in _watcher
    proc.dead( pid, status )
  File "/usr/lib/pymodules/python2.7/notifier/popen.py", line 169, in dead
    self.signal_emit( 'killed', pid, status )
  File "/usr/lib/pymodules/python2.7/notifier/signals.py", line 75, in signal_emit
    self.__signals[ signal ].emit( *args )
  File "/usr/lib/pymodules/python2.7/notifier/signals.py", line 41, in emit
    cb( *args )
  File "/usr/lib/pymodules/python2.7/notifier/popen.py", line 417, in _finished
    self.signal_emit( 'finished', pid, exit_code, self.__stdout )
  File "/usr/lib/pymodules/python2.7/notifier/signals.py", line 75, in signal_emit
    self.__signals[ signal ].emit( *args )
  File "/usr/lib/pymodules/python2.7/notifier/signals.py", line 41, in emit
    cb( *args )
  File "/usr/lib/pymodules/python2.7/notifier/__init__.py", line 104, in __call__
    return self._function( *tmp, **self._kwargs )
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/quota/user.py", line 85, in _users_query
    quotas = tools.repquota_parse(partition, callbackResult[header + 1:])
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/quota/tools.py", line 112, in repquota_parse
    quota = UserQuota(partition, grp['user'], grp['bused'], grp['bsoft'], grp['bhard'], grp['btime'], grp['fused'], grp['fsoft'], grp['fhard'], grp['ftime'])
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/quota/tools.py", line 58, in __init__
    self['sizeLimitSoft'] = block2byte(bsoft, 'MB')
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/quota/tools.py", line 320, in block2byte
    size = long(size) * float(block_size)
ValueError: invalid literal for long() with base 10: ''

This is most likely a parse error from the command line to UMC as there might be an irregular value reported by the command line tool.

Troubleshooting

Start the repquota command as it does the UMC module:

/usr/sbin/repquota -C -v $PARTITION
*** Report for user quotas on device /dev/mapper/VG02_ieu04--sr12-sh--classes
Block grace time: 7days; Inode grace time: 7days
                        Block limits                File limits
User            used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
root      -- 65843512       0       0          46116     0 54511724920832       
#6684672  --       0 11874725583052800       0              0     0     0       
#27131904 --       0 11874725583052800       0              0     0     0       
#3342336  --       0 11874725583052800 768799145984              0     0     0       
#327680   --       0 11874725583052800       0              0     0     0       
#2359296  --       0 11874725583052800       0              0     0     0       
#3899392  --       0 11874725583052800       0              0     0     0       
#26574848 --       0 11874725583052800       0              0     0     0       
#100499456 --       0 11874725583052800       0              0     0     0       
#161480704 --       0 11874725583052800       0              0     0     0       
apf116108 +-       8 -6139672926429184       0   none       1     0     0      
[...]

The output should be similar to the above block.

You have to check the output in detail to see what is wrong with it. For some sort of automated check you might use the attached script from this bug.
For reference it is posted here, too:

import sys
from univention.management.console.modules.quota.tools import repquota_parse

# get the repquota report:
# /usr/sbin/repquota -C -v $PARTITION > quotareport.txt
# call this script with the path to quotareport.txt
# wait for a traceback... the last printed line is a problem

def main():
    report_file = sys.argv[1]
    with open(report_file, 'r') as report:
        lines = report.readlines()
        for line in lines[5:]:
            try:
                repquota_parse('foo', [line.strip()])
            except ValueError:
                print('############Broken?###########')
                print(line.strip())

if __name__ == '__main__':
    main()
Mastodon