Bug 31277 - UMC module doesn't allow the configuration of quota for the root partition
UMC module doesn't allow the configuration of quota for the root partition
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Quota
UCS 3.0
Other Linux
: P5 normal (vote)
: UCS 3.2-2-errata
Assigned To: Florian Best
Erik Damrose
:
: 25415 (view as bug list)
Depends on:
Blocks: 34625 35126
  Show dependency treegraph
 
Reported: 2013-05-03 14:13 CEST by Moritz Muehlenhoff
Modified: 2014-08-07 17:41 CEST (History)
7 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Usability
Max CVSS v3 score:


Attachments
Screenshot of quota module (63.92 KB, image/png)
2013-05-07 09:18 CEST, Moritz Muehlenhoff
Details
quota.patch (1.23 KB, patch)
2014-05-13 17:48 CEST, Florian Best
Details | Diff
'/' quota activation not working (112.99 KB, image/png)
2014-06-10 12:37 CEST, Dmitry Galkin
Details
'/' quota activation working (117.01 KB, image/png)
2014-06-10 12:37 CEST, Dmitry Galkin
Details
failed to set quota for user in the umc (123.44 KB, image/png)
2014-06-16 11:30 CEST, Dmitry Galkin
Details
user quota module with system users visible (112.84 KB, image/png)
2014-06-16 11:55 CEST, Erik Damrose
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Muehlenhoff univentionstaff 2013-05-03 14:13:18 CEST
The UMC module currently doesn't work with the partition scheme of a standard UCS installation (i.e. a LVM volume, which spans all available hard disks), since the root partition doesn't allow quota.

Currently the root partition isn't even shown in the list of available partitions. It should instead be listed greyed-out. Clicking on it could display the necessary steps to enable quota on the root partition [1] or even configure the needed provisions automatically.

[1] 
- add "root2flags=quota" ro UCR grub/append and reboot
- add the "usrquota" stanza to /etc/fstab
Comment 1 Moritz Muehlenhoff univentionstaff 2013-05-07 09:16:02 CEST
(In reply to comment #0)
> The UMC module currently doesn't work with the partition scheme of a standard
> UCS installation (i.e. a LVM volume, which spans all available hard disks),
> since the root partition doesn't allow quota.
> 
> Currently the root partition isn't even shown in the list of available
> partitions. It should instead be listed greyed-out. Clicking on it could
> display the necessary steps to enable quota on the root partition [1] or even
> configure the needed provisions automatically.
> 
> [1] 
> - add "root2flags=quota" ro UCR grub/append and reboot
> - add the "usrquota" stanza to /etc/fstab

After installing the recent quota erratum enabling support for ext4, the root partition is correctly displayed.

However, after enabling quota support with the steps outlined above, the root partition is correctly shown as having active quota support, but it's not yet possible to configure quota rules for the UMC module, see screenshot
Comment 2 Moritz Muehlenhoff univentionstaff 2013-05-07 09:18:27 CEST
Created attachment 5213 [details]
Screenshot of quota module
Comment 3 Jascha Geerds univentionstaff 2013-05-07 17:04:26 CEST
*** Bug 25415 has been marked as a duplicate of this bug. ***
Comment 4 Tim Petersen univentionstaff 2014-05-13 16:23:25 CEST
Requested at ticket #2014051221012319
Comment 5 Florian Best univentionstaff 2014-05-13 17:48:10 CEST
Created attachment 5912 [details]
quota.patch

seems only a limitation in the frontend for hardcoded partitions mounted on "/". Attached patch removed the restriction.
Comment 6 Florian Best univentionstaff 2014-05-30 09:59:35 CEST
fixed. Configuring the root partition is not restricted anymore.
YAML: 2014-05-30-univention-quota.yaml
Comment 7 Philipp Hahn univentionstaff 2014-06-02 12:59:31 CEST
Removing the check is not enough, because the build the initial quota usage statistics "quotacheck" needs to be run to create "/aquota.user". It tries to remount the file-system read-only to get a consistent state; that doesn't work by default for the root filesystem, as lots of processes are running by default and have open files for writing:

$ git grep -n quotacheck
umc/python/quota/tools.py:180:          result = subprocess.call(('/sbin/quotacheck', '-u', partition.mount_point))

# quotacheck -vug /
quotacheck: Cannot remount filesystem mounted on / read-only so counted values might not be right.                  
Please stop all programs writing to filesystem or use -m flag to force checking.

A quick check shows that adding "-m" works.
Comment 8 Florian Best univentionstaff 2014-06-10 11:55:35 CEST
univention-quota 8.0.6-3.122.201406101149

On ext* filesystems quotacheck is called with -m  if the mountpoint is /.
> -m, --no-remount          do not remount filesystem read-only

On XFS no remount of / is done.
Comment 9 Dmitry Galkin univentionstaff 2014-06-10 12:37:07 CEST
Created attachment 5941 [details]
'/' quota activation not working
Comment 10 Dmitry Galkin univentionstaff 2014-06-10 12:37:35 CEST
Created attachment 5942 [details]
'/' quota activation working
Comment 11 Dmitry Galkin univentionstaff 2014-06-10 12:37:51 CEST
Does not works for me with ext* (see screenshot):

"Failed to activate quota support. Restarting the quota services has failed"

Meanwhile, with patched 'quota/tools.py' on another instance (as suggested by Philipp in comment 7) it works (another screenshot):

if create:
                result = subprocess.call(('/sbin/quotacheck', '-um', partition.mount_point))
                if result not in [0, 6]:
                        return {'partitionDevice': partition.spec, 'success': False,
                'message':  _('Generating the quota information file failed')}
if subprocess.call(('/usr/sbin/invoke-rc.d', 'quota', 'restart')):
                return {'partitionDevice': partition.spec, 'success': False,
                'message': _('Restarting the quota services has failed')}


Both instances have ext4:

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
UUID=b118c268-a34c-4a04-b354-6a99aa8a34cb       /       ext4    acl,errors=remount-ro,user_xattr,usrquota       0       1
proc    /proc   proc    defaults        0       0
UUID=0282a4bf-e9a9-4570-b756-32a7010f02f9       /boot   ext4    defaults,acl,user_xattr,usrquota        0       0
Comment 12 Dmitry Galkin univentionstaff 2014-06-10 13:08:59 CEST
sorry, the check was with the wrong 'univention-quota' package...
Comment 13 Dmitry Galkin univentionstaff 2014-06-16 11:28:37 CEST
Actually, does not work with ext3 and univention-quota 8.0.6-3.122.201406101149 too:


root@master091:~# aptitude show univention-quota 
Paket: univention-quota                       
Zustand: Installiert
Automatisch installiert: ja
Version: 8.0.6-3.122.201406101149
Priorität: --
Bereich: univention


# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/vda1       /       ext3    acl,errors=remount-ro,user_xattr,usrquota       0       1
proc    /proc   proc    defaults        0       0
/dev/xvda3      none    swap    sw      0       0


The quota for '/' activates, but cannot be set after...

Internal module error: An error occured during command processing.
Server error message:
Failed to modify quota settings for user test_user2 on partition /dev/vda1
Comment 14 Dmitry Galkin univentionstaff 2014-06-16 11:30:27 CEST
Created attachment 5961 [details]
failed to set quota for user in the umc
Comment 15 Erik Damrose univentionstaff 2014-06-16 11:46:56 CEST
The changes works fine on ext4 filesystems. I did not check ext3 as mentioned in comment 13.

REOPEN:
After activating on a xfs '/' partition the notification message says quota has been successfully activated. But the UMC module still shows 'deactivated' and i can not configure any quota for the partition. Clicking on 'Refresh' or reopening the module or logout/login does not work either.

After rebooting, the quota is shown as activated, but setting a user quota does not work on a xfs '/' partition: The kernel boot parameter 'rootflags=usrquota' has to be added. After fixing this bug, the UCS documentation should be updated (http://docs.univention.de/manual-3.2.html#shares::quota)

We should discuss if we restrict the visible users in the Quota module to domain users. Currently, if quota is activated on the '/' partition, 15 users are already shown on a UCS installation without any additional services installed.
Comment 16 Erik Damrose univentionstaff 2014-06-16 11:55:33 CEST
Created attachment 5962 [details]
user quota module with system users visible
Comment 17 Erik Damrose univentionstaff 2014-06-16 12:10:41 CEST
(In reply to Erik Damrose from comment #15)
> The kernel boot parameter 'rootflags=usrquota' has to be added.

The fstab mount option 'usrquota' does not need to be present for xfs.
Comment 18 Erik Damrose univentionstaff 2014-06-30 11:14:12 CEST
(In reply to Erik Damrose from comment #17)
> The fstab mount option 'usrquota' does not need to be present for xfs.

univention-user-quota relies on the options being present, though.
Comment 19 Florian Best univentionstaff 2014-07-01 11:51:23 CEST
The option 'rootflags=usrquota' is now added to or removed from the kernel line when (de)activating root partition with XFS.
The notification about a system reboot is also shown.

univention-quota (8.0.6-5)
YAML has been updated.
Comment 20 Erik Damrose univentionstaff 2014-07-01 14:44:35 CEST
ucs-test 60_umc-system/50_umc-service-quotas-management runs fine on ext systems. It does not support the necessary reboot for xfs.

REOPEN:
Translation is incomplete: If i deactivate the quota on a german UCS with xfs i get the following pop-up:
"Deaktivierung der Quota-Unterstützung ist fehlgeschlagen: To disable quota support for the root filesystem the system have to be rebooted."
The translation is also wrong when activating quota functionality.

Please fix the typo: "the system ha_s_ to be rebooted"

The message is also not entirely accurate: The (de)activation did not fail, it is not yet completed due to the pending reboot.
Comment 21 Florian Best univentionstaff 2014-07-02 14:56:32 CEST
(In reply to Erik Damrose from comment #20)
> REOPEN:
> Translation is incomplete: If i deactivate the quota on a german UCS with
> xfs i get the following pop-up:
> "Deaktivierung der Quota-Unterstützung ist fehlgeschlagen: To disable quota
> support for the root filesystem the system have to be rebooted."
> The translation is also wrong when activating quota functionality.
The bug here was that the python file had the wrong translation domain, so it always returned the english text! I fixed that, too.

> Please fix the typo: "the system ha_s_ to be rebooted"
fixed

YAML updated.

Merged to UCS 4.0 branch.
Comment 22 Erik Damrose univentionstaff 2014-07-02 17:22:16 CEST
(In reply to Florian Best from comment #21)
> Merged to UCS 4.0 branch.

r51439 was missing, i merged it to the 4.0 branch.

ok: Merge to UCS 4.0
ok: univention-quota 8.0.6-7
ok: YAML
Comment 23 Janek Walkenhorst univentionstaff 2014-08-07 17:41:39 CEST
http://errata.univention.de/ucs/3.2/158.html