Remove quotas breaks diskspace plugin

Thanks for making quotas on option now!

I just noticed that when you remove the quotas option via package management that it breaks the diskspace plugin in rutorrent.
It’s a simple fix, but maybe the removal option could take care of this by itself?

You need to remove the
$quotaUser = “username”;
line out of the users config.php file

Cheers!

1 Like

Noted Thanks for the contribution @Msan, we’ll work this into the package. :slight_smile:

No. This is incorrect.

The disk space plugins have been updated to ensure that quotaUser can be set without having Quotas installed so that the plugin still functions.

Please ensure you have the latest version of the ruTorrent plugins and that this line is present in the diskspace plugin you use:

  if (isset($quotaUser) && file_exists('/install/.quota.lock')) {

This check ensures quota info is displayed only if quotaUser is set and the lock file also exists.

If your plugin file is up to date and this behavior persists then this is a bug and the check needs to be fixed. I don’t want to mess around with adding/removing quotaUsers to conf files on the fly. It’s an easy way for things to get really messy really quickly.

Please let me know if your plugins are up to date // if they aren’t and it fixed it for you.

I just ran the removal of the user from the conf using:

sed -i "s/\$quotaUser = \"${username}\";/\$quotaUser = \"\";/g" /srv/rutorrent/conf/users/"${username}"/config.php

This did not change the fact that a users diskspace plugin shows blank within ruTorrent. Since this is currently happening on a test install I have going I am going to check the additional plugins. I notice an unusual occurrence where it has always removed the visible value of torrents loaded as well. However, I have another install exactly like this one (minus any active torrents) and everything (diskspace plugin included) is in tip top shape.

The numeric of rtorrent torrents loaded is from a missing .sessions/rtorrent.lock <-- that’s solely my fault :neutral_face: - A long day thus far.

It looks like for some reason the update on an old install didn’t pull in the updated plugin. I just encountered this and upon inspection of the diskspace plugin, this is in fact as @liara has stated. The new diskspace/action.php should like like the following:

<?php

##########################################################################
##  [Quick Box - action.php modified for quota systems use]
##########################################################################
# GITHUB REPOS
# GitHub _ packages  :   https://github.com/QuickBox/quickbox_rutorrent-plugins
# LOCAL REPOS
# Local _ packages   :   ~/QuickBox/rtplugins
# Author             :   QuickBox.IO
# URL                :   https://plaza.quickbox.io
#
# QuickBox Copyright (C) 2016 QuickBox.io
# Licensed under GNU General Public License v3.0 GPL-3 (in short)
#
#   You may copy, distribute and modify the software as long as you track
#   changes/dates in source files. Any modifications to our software
#   including (via compiler) GPL-licensed code must also be made available
#   under the GPL along with build & install instructions.
#
##########################################################################

  require_once( '../../php/util.php' );
  if (isset($quotaUser) && file_exists('/install/.quota.lock')) {
      $total = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u / | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf $4*1024}'");
      $free = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u / | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf ($4-$3)*1024}'");
      cachedEcho('{ "total": '.$total.', "free": '.$free.' }',"application/json");
  } else {
      cachedEcho('{ "total": '.disk_total_space($topDirectory).', "free": '.disk_free_space($topDirectory).' }',"application/json");
  }

?>

I just did a “check for updates” before removing the quotas, so I should have the latest of everything no?

btw, whats the correct command to do an update via the commandline?

updateQuickBox

However, I am pushing an update now… the updater was not pulling the plugins directory :blush:

@Msan, could you go to your /root directory and do the following:

rm -rf QuickBox
git clone --recursive https://lab.quickbox.io/QuickBox/QuickBox QuickBox

This will remove the old GitHub clone and replace it with our new repo which is hosted locally. This is where all future updates will be pulled from. I have also pushed the update that addresses the plugins not updating here:

ok, did that and reloaded the services and added the line back into the config.php file.
the diskspace plugin doesnt display anything, so it’s not working… :frowning:

If you need me to check anything else, let me know…

rebooted the server and all is well now… wierd…

actually… I just noticed there are 2 diskspace plugins active now.
one shows ok and the other is blank?

Right, if you are on a /home mount, you can uninstall the diskspace plugin from your dashboard.
If you are on a /(root) mount, you can uninstall the diskspaceH plugin.

It also retools the default template… this also will be addressed in a future update.

The update basically puts both of the plugins back in the socket and you’ll need to remove the one that is not needed. This will be addressed once we have v2.4.0 of QuickBox ready for release.

ok, removed the diskspaceh plugin. and it seems that was the one that was working.
and I am positive that I am on a / (root) mount

Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 7.9G 0 7.9G 0% /dev
tmpfs tmpfs 1.6G 170M 1.4G 11% /run
/dev/sda2 ext4 916G 420G 450G 49% /
tmpfs tmpfs 7.9G 0 7.9G 0% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
/dev/sda1 ext4 180M 93M 74M 56% /boot
tmpfs tmpfs 1.6G 0 1.6G 0% /run/user/1000

What is the output of la -l with the rutorrent/plugins directory?

There is a quick alias to get there. Type rutorrent then cd plugins.

beast:/srv/rutorrent/plugins# la -l
total 212K
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 autodl_irssi
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 autotools
drwxrwsr-x 4 www-data www-data 4.0K Jun 8 12:55 check_port
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 chunks
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 cookies
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 cpuload
drwxrwsr-x 4 www-data www-data 4.0K Jun 8 12:55 create
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 data
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 datadir
drwxrwsr-x 4 www-data www-data 4.0K Jun 8 12:55 diskspace
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 edit
drwxrwsr-x 2 www-data www-data 4.0K Jun 8 12:55 erasedata
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 extratio
drwxrwsr-x 5 www-data www-data 4.0K Jun 8 12:55 extsearch
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 feeds
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 filedrop
drwxrwsr-x 5 www-data www-data 4.0K Jun 8 12:55 filemanager
drwxrwsr-x 5 www-data www-data 4.0K Jun 8 12:55 fileshare
drwxrwsr-x 5 www-data www-data 4.0K Jun 8 12:55 fileupload
drwxrwsr-x 4 www-data www-data 4.0K Jun 8 12:55 geoip
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 history
drwxrwsr-x 2 www-data www-data 4.0K Jun 8 12:55 httprpc
drwxrwsr-x 4 www-data www-data 4.0K Jun 8 12:55 loginmgr
drwxrwsr-x 4 www-data www-data 4.0K Jun 8 12:55 logoff
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 lookat
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 mediainfo
drwxrwsr-x 6 www-data www-data 4.0K Jun 8 12:55 mobile
drwxrwsr-x 4 www-data www-data 4.0K Jun 8 12:55 pausewebui
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 ratio
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 ratiocolor
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 retrackers
drwxrwsr-x 2 www-data www-data 4.0K Jun 8 12:55 rpc
drwxrwsr-x 4 www-data www-data 4.0K Jun 8 12:55 rss
drwxrwsr-x 4 www-data www-data 4.0K Jun 8 12:55 rssurlrewrite
drwxrwsr-x 4 www-data www-data 4.0K Jun 8 12:55 rutracker_check
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 scheduler
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 screenshots
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 seedingtime
drwxrwsr-x 2 www-data www-data 4.0K Jun 8 12:55 show_peers_like_wtorrent
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 source
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 stream
drwxrwsr-x 4 www-data www-data 4.0K Jun 8 12:55 theme
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 throttle
drwxrwsr-x 4 www-data www-data 4.0K Jun 8 12:55 tracklabels
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 trafic
drwxrwsr-x 3 www-data www-data 4.0K Jun 8 12:55 unpack
drwxrwsr-x 4 www-data www-data 4.0K Jun 8 12:55 xmpp
drwxrwsr-x 2 www-data www-data 4.0K Jun 8 12:55 _getdir
drwxrwsr-x 2 www-data www-data 4.0K Jun 8 12:55 _noty
drwxrwsr-x 2 www-data www-data 4.0K Jun 8 12:55 _noty2
drwxrwsr-x 4 www-data www-data 4.0K Jun 8 12:55 _task
-rw-rw-r-- 1 www-data www-data 46 Jun 8 12:55 .git
-rw-rw-r-- 1 www-data www-data 27 Jun 8 12:55 README.md

Interesting, permissions look to be on point. Go into your diskspace directory and show my the output of cat action.php

beast:/srv/rutorrent/plugins/diskspace# cat action.php

<?php //-------------------------------------------------------------------------------- // [Quick Box - action.php modified for quota systems use] // // GitHub: https://github.com/JMSDOnline/quick-box // Author: Jason Matthews // URL: https://jmsolodesigns.com/code-projects/quick-box/seedbox-installer //-------------------------------------------------------------------------------- require_once( '../../php/util.php' ); if (isset($quotaUser)) { $total = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u / | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf $4*1024}'"); $free = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u / | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf ($4-$3)*1024}'"); cachedEcho('{ "total": '.$total.', "free": '.$free.' }',"application/json"); } else { cachedEcho('{ "total": '.disk_total_space($topDirectory).', "free": '.disk_free_space($topDirectory).' }',"application/json"); } ?>

That’s what I thought… please replace all that with this.

<?php

##########################################################################
##  [Quick Box - action.php modified for quota systems use]
##########################################################################
# GITHUB REPOS
# QuickLab _ packages:   https://lab.quickbox.io/QuickBox/quickbox_rutorrent-plugins
# LOCAL REPOS
# Local _ packages   :   ~/QuickBox/rtplugins
# Author             :   QuickBox.IO
# URL                :   https://plaza.quickbox.io
#
# QuickBox Copyright (C) 2016 QuickBox.io
# Licensed under GNU General Public License v3.0 GPL-3 (in short)
#
#   You may copy, distribute and modify the software as long as you track
#   changes/dates in source files. Any modifications to our software
#   including (via compiler) GPL-licensed code must also be made available
#   under the GPL along with build & install instructions.
#
##########################################################################

  require_once( '../../php/util.php' );
  if (isset($quotaUser) && file_exists('/install/.quota.lock')) {
      $total = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u / | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf $4*1024}'");
      $free = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u / | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf ($4-$3)*1024}'");
      cachedEcho('{ "total": '.$total.', "free": '.$free.' }',"application/json");
  } else {
      cachedEcho('{ "total": '.disk_total_space($topDirectory).', "free": '.disk_free_space($topDirectory).' }',"application/json");
  }

?>

ok, did that, reloaded… no go… checked the contents:

beast:/srv/rutorrent/plugins/diskspace# cat action.php 
# QuickLab _ packages:   https://lab.quickbox.io/QuickBox/quickbox_rutorrent-plugins
# LOCAL REPOS
# Local _ packages   :   ~/QuickBox/rtplugins
# Author             :   QuickBox.IO
# URL                :   https://plaza.quickbox.io
#
# QuickBox Copyright (C) 2016 QuickBox.io
# Licensed under GNU General Public License v3.0 GPL-3 (in short)
#
#   You may copy, distribute and modify the software as long as you track
#   changes/dates in source files. Any modifications to our software
#   including (via compiler) GPL-licensed code must also be made available
#   under the GPL along with build & install instructions.
#
##########################################################################

  require_once( '../../php/util.php' );
  if (isset($quotaUser) && file_exists('/install/.quota.lock')) {
      $total = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u / | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf $4*1024}'");
      $free = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u / | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf ($4-$3)*1024}'");
      cachedEcho('{ "total": '.$total.', "free": '.$free.' }',"application/json");
  } else {
      cachedEcho('{ "total": '.disk_total_space($topDirectory).', "free": '.disk_free_space($topDirectory).' }',"application/json");
  }

?>

sorry, not sure why the paste got all wierd…

Do you also have the .quota.lock file in your /install directory?

ls -la /install

I executed this as you said JMSolo:

rm -rf QuickBox
git clone --recursive https://lab.quickbox.io/QuickBox/QuickBox QuickBox

On /root it is updating well:

seedbox:~/QuickBox/rtplugins/diskspace# cat action.php
<?php

//--------------------------------------------------------------------------------
// [Quick Box - action.php modified for quota systems use]
//
// GitHub:   https://github.com/JMSDOnline/quick-box
// Author:   Jason Matthews
// URL:      https://jmsolodesigns.com/code-projects/quick-box/seedbox-installer
//--------------------------------------------------------------------------------

  require_once( '../../php/util.php' );
  if (isset($quotaUser) && file_exists('/install/.quota.lock')) {
      $total = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u / | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf $4*1024}'");
      $free = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u / | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf ($4-$3)*1024}'");
      cachedEcho('{ "total": '.$total.', "free": '.$free.' }',"application/json");
  } else {
      cachedEcho('{ "total": '.disk_total_space($topDirectory).', "free": '.disk_free_space($topDirectory).' }',"application/json");
  }

?>
seedbox:~/QuickBox/rtplugins/diskspace#

But in the “production” directory it is not doing anything:

seedbox:~/QuickBox/rtplugins/diskspace# cat /srv/rutorrent/plugins/diskspace/action.php
<?php

//--------------------------------------------------------------------------------
// [Quick Box - action.php modified for quota systems use]
//
// GitHub:   https://github.com/JMSDOnline/quick-box
// Author:   Jason Matthews
// URL:      https://jmsolodesigns.com/code-projects/quick-box/seedbox-installer
//--------------------------------------------------------------------------------

  require_once( '../../php/util.php' );
  if (isset($quotaUser)) {
      $total = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u / | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf $4*1024}'");
      $free = shell_exec("/usr/bin/sudo /usr/sbin/repquota -u / | /bin/grep ^".$quotaUser." | /usr/bin/awk '{printf ($4-$3)*1024}'");
      cachedEcho('{ "total": '.$total.', "free": '.$free.' }',"application/json");
  } else {
      cachedEcho('{ "total": '.disk_total_space($topDirectory).', "free": '.disk_free_space($topDirectory).' }',"application/json");
  }

?>

updateQuickBox says everything is up to date. Do you know what can be happening?

Thank you!

I’ll look into this as soon as time permits. We were doing soft updates to avoid a possible overwrite on the settings.

I am wondering if these were being pushed to our Development Repo and not to the Public Repo.

Try this out (or attempt to run the update once more from your dashboard):

Qrtplugins
git checkout master && git pull
rutorrent=/srv/rutorrent/
local_rplugins=/root/QuickBox/rtplugins/
rsync -aP ${local_rplugins}* plugins
chown -R www-data ${rutorrent}*
chgrp -R www-data ${rutorrent}*
chmod -R g+rw ${rutorrent}*
sh -c 'find /srv/rutorrent/* -type d -print0 | sudo xargs -0 chmod g+s'