Proxmox Container 4.3/4.4 and 5.2 problem setting up quota.

rickyo

Active Member
Oct 21, 2015
25
17
43
Hi,

I'm trying to initialize Quotas on a newly installed LXC-container with quota selected while setup.

When using centos7 (template) I get the following error while using quotacheck and also trying to read the root filesystem using the device directly. It worked with Debian 9 (template).

Example:
quotacheck -ugcm /
quotacheck: error (1) while opening /dev/mapper/pve-vm--102--disk--1

Anyway, this used to work before (like last year?) but I haven't checked it for a long time.

The installation documentation for Prox is:

Using Quotas Inside Containers

Quotas allow to set limits inside a container for the amount of disk space that each user can use. This only works on ext4 image based storage types and currently does not work with unprivileged containers.


Activating the quota option causes the following mount options to be used for a mount point: usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0


This allows quotas to be used like you would on any other system. You can initialize the /aquota.user and /aquota.group files by running


quotacheck -cmug /
quotaon /

and edit the quotas via the edquota command. Refer to the documentation of the distribution running inside the container for details.


upload_2018-8-14_14-0-8.png You need to run the above commands for every mount point by passing the mount point’s path instead of just /.



I hope someone else can confirm that I'm not alone and maybe have a solution as I need quota working.

Thanks in advance,
Rickard
 
Think I solved it.
I thought about it a bit and I knew it worked before so it must have been some update from CentOS side.

I decided to install an old version of CentOS 7 quota file. Current new version is quota-4.0.17 and I decided to install quota-4.0.14 from :
http://vault.centos.org/7.4.1708/os/x86_64/Packages/ using rpm -i command. Note you have to uninstall quota-nls and quota first on the container and then reinstall using rpm -i thereafter for quota-nls and then quota

And it now works perfectly hopefully.
 
This happens to me also with a image of debian buster.

root@test-lxc ~ # quotacheck -cmug /
quotacheck: error (1) while opening /dev/mapper/pve-vm--9002--disk--0

Downgrading to quota from debian stretch (Debian 9):

root@test-lxc ~ # dpkg -i quota_4.03-2+deb9u1_amd64.deb
dpkg: warning: downgrading quota from 4.04-2 to 4.03-2+deb9u1
(Reading database ... 45469 files and directories currently installed.)
Preparing to unpack quota_4.03-2+deb9u1_amd64.deb ...
Unpacking quota (4.03-2+deb9u1) over (4.04-2) ...
Setting up quota (4.03-2+deb9u1) ...
Created symlink /etc/systemd/system/sysinit.target.wants/quota.service -> /lib/systemd/system/quota.service.
Created symlink /etc/systemd/system/multi-user.target.wants/quotarpc.service -> /lib/systemd/system/quotarpc.service.
Processing triggers for systemd (239-9) ...
Processing triggers for man-db (2.8.4-2) ...
root@test-lxc ~ # quotacheck -cmug /
root@test-lxc ~ #


root@test-lxc ~ # repquota -a
*** Report for user quotas on device /dev/mapper/pve-vm--9002--disk--0
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 1197332 0 0 50728 0 0
man -- 1136 0 0 140 0 0
_apt -- 12 0 0 3 0 0
postfix -- 60 0 0 44 0 0

This is kind of dissapointing since it has not much logic...
 
I reported the bug to Debian and with the new version of quota package, solved these issues.

This happens to me also with a image of debian buster.

root@test-lxc ~ # quotacheck -cmug /
quotacheck: error (1) while opening /dev/mapper/pve-vm--9002--disk--0

Downgrading to quota from debian stretch (Debian 9):

root@test-lxc ~ # dpkg -i quota_4.03-2+deb9u1_amd64.deb
dpkg: warning: downgrading quota from 4.04-2 to 4.03-2+deb9u1
(Reading database ... 45469 files and directories currently installed.)
Preparing to unpack quota_4.03-2+deb9u1_amd64.deb ...
Unpacking quota (4.03-2+deb9u1) over (4.04-2) ...
Setting up quota (4.03-2+deb9u1) ...
Created symlink /etc/systemd/system/sysinit.target.wants/quota.service -> /lib/systemd/system/quota.service.
Created symlink /etc/systemd/system/multi-user.target.wants/quotarpc.service -> /lib/systemd/system/quotarpc.service.
Processing triggers for systemd (239-9) ...
Processing triggers for man-db (2.8.4-2) ...
root@test-lxc ~ # quotacheck -cmug /
root@test-lxc ~ #


root@test-lxc ~ # repquota -a
*** Report for user quotas on device /dev/mapper/pve-vm--9002--disk--0
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 1197332 0 0 50728 0 0
man -- 1136 0 0 140 0 0
_apt -- 12 0 0 3 0 0
postfix -- 60 0 0 44 0 0

This is kind of dissapointing since it has not much logic...
 
I reported the bug to Debian and with the new version of quota package, solved these issues.

I have error too with debian 10, package 4.04-2+deb10u1, and I had to install old package from stretch 4.03-2+deb9u1. However usage is not updated when I create new files, repquota still report same files count, and it's updated when I run quotacheck. Is It everything working as expected to you? What version do you have?
 
I found problem about usage not updated, quotaon is not being called on boot, I don't know how to fix it, when I install quota package it enables quota systemd service, which calls /usr/share/quota/quota-initial-check.sh, but it doesn't enable /etc/init.d/quota, quotaon -ap report quota is off.

Calling /etc/init.d/quota start doesn't starts quota, because it calls systemd quota service too.
I can call quotaon -a manually, but how is it supposed to work on boot?
 
I have fixed call quotaon on boot with a symbolic link from /lib/systemd/system/quotaon.service to /etc/systemd/system/sysinit.target.wants/quotaon.service. systemctl enable quotaon complained about missing requirements for install.
 
quotaon is not being called on boot
I've run into the same problem with a fresh Debian 10 container - it's a privileged container with quota enabled in the container options, however even after installing the quota package quota isn't turned on automatically after booting, not even if I manually create an /etc/fstab entry corresponding to how Proxmox/LXC mounts the root FS for the container (which I needed to anyway because some installer checks for quota that way).

when I install quota package it enables quota systemd service, which calls /usr/share/quota/quota-initial-check.sh, but it doesn't enable /etc/init.d/quota
As far as I've been able to find out, this change has been intentional and with systemd, these days systemd-quotacheck.service followed by the quotaon.service have the job of actually enabling quota. It seems that in the normal course of action, systemd should call those automatically when mounting a file system with any of the relevant quotaoptions, such as usrjquota, grpjquota, etc., however for some reason this doesn't seem to actually work.
My personal solution has been to create a dummy service whose only purpose is to actually force those quota services to run, though it still seems somewhat hacky:
Bash:
#!/bin/bash

echo '[Unit]
Description=Helper service to force File System Quota Startup
DefaultDependencies=no
After=quota.service
Requires=systemd-quotacheck.service quotaon.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
StandardOutput=journal+console

[Install]
WantedBy=sysinit.target' > /etc/systemd/system/quotahelper.service
systemctl enable quotahelper
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!