Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: apt-get/synaptic bandwidth limiting (mini-HOWTO)

  1. #1
    Join Date
    Mar 2005
    Beans
    4

    apt-get/synaptic bandwidth limiting (mini-HOWTO)

    I'm sure many of you miss an option to limit the donwload-rate in apt-get, it's quite useful if you share bandwidth, ... so I decided to write a mini-HOWTO about it.

    Download bandwidth limiting can be accomplished using trickle (an user-space bandwidth shaper) with the http and ftp file retrieval "plug-ins" of apt.

    First of all you have to install trickle, then you have to make apt-get use trickle for downloads, for example with the http method :

    dpkg-divert --local --rename /usr/lib/apt/methods/http
    echo '#!/bin/sh' > /usr/lib/apt/methods/http
    echo '/usr/bin/trickle -s -d 25 /usr/lib/apt/methods/http.distrib' >> usr/lib/apt/methods/http
    chmod 755 /usr/lib/apt/methods/http

    Repeat this process for the ftp method (if you have any ftp repository) replacing http for ftp.

    The "-d 25" sets the rate-limit to 25KB/s. You may want to remove the -s/-d switches and configure trickled.

    If you want to remove it:

    rm /usr/lib/apt/methods/http
    dpkg-divert --local --remove /usr/lib/apt/methods/http
    Last edited by francesc; March 16th, 2005 at 01:48 PM. Reason: Added how to remove it.

  2. #2
    Join Date
    Feb 2005
    Location
    Texas, U.S.A.
    Beans
    96

    Re: apt-get/synaptic bandwidth limiting (mini-HOWTO)

    Quote Originally Posted by francesc
    dpkg-divert --local --rename /usr/lib/apt/methods/http
    echo '#!/bin/sh' > /usr/lib/apt/methods/http
    echo '/usr/bin/trickle -s -d 25 /usr/lib/apt/methods/http.distrib' >> usr/lib/apt/methods/http
    chmod 755 /usr/lib/apt/methods/http
    Executing the first line works just fine, with the consequence that /usr/lib/apt/methods/http disappears and /usr/lib/apt/methods/http.distrib appears. However, when trying to execute the second line, the fact that /usr/lib/apt/methods/http no longer exists gets in the way.

    Code:
    tkiesel@gecko:~ $ sudo echo '#!/bin/sh' > /usr/lib/apt/methods/http
    bash: /usr/lib/apt/methods/http: Permission denied
    I'm hoping to make my apt play nice with my MMORPG gaming brother-in-law, and would very much like getting this to work.

  3. #3
    Join Date
    Mar 2005
    Beans
    10

    Re: apt-get/synaptic bandwidth limiting (mini-HOWTO)

    Code:
    tkiesel@gecko:~ $ sudo echo '#!/bin/sh' > /usr/lib/apt/methods/http
    bash: /usr/lib/apt/methods/http: Permission denied


    Try 'sudo bash' first? Some things seem to like to work only when you've got a root shell.

  4. #4
    Join Date
    Nov 2007
    Beans
    Hidden!
    Distro
    Hardy Heron (Ubuntu Development)

    Re: apt-get/synaptic bandwidth limiting (mini-HOWTO)

    Thanks for this.

    For those having issues, switch to the root user before running this to make things easier.

    At the console:
    Code:
    su
    >Password: *****
    Also, on the 3rd line, you might want to change the path at the end to /usr/lib/apt/methods/http (note the slash at the start). This is assuming most will run the commands from their home directory.

  5. #5
    Join Date
    Dec 2006
    Location
    US and A
    Beans
    919
    Distro
    Ubuntu Development Release

    Re: apt-get/synaptic bandwidth limiting (mini-HOWTO)

    Tiny correction, on Ubuntu systems, I belive the command has to be:

    sudo su
    _,-O
    O
    (_)) ubuntu -
    -`-O

  6. #6
    Join Date
    Feb 2008
    Beans
    1,145
    Distro
    Xubuntu

    Re: apt-get/synaptic bandwidth limiting (mini-HOWTO)

    Another thing that would work is to make a shortcut with this command:

    trickle -s -d 25 gksu synaptic

  7. #7
    Join Date
    Sep 2005
    Location
    The American Empire
    Beans
    340

    Re: apt-get/synaptic bandwidth limiting (mini-HOWTO)

    You could also try Wondershaper and if you're looking for something with more features you can go with MasterShaper.

    http://lartc.org/wondershaper/ - Available via apt-get

    www.mastershaper.org/
    Registered Linux User # 437006
    http://sidux.com/ - K Desktop Environment (Debian Sid)
    MasterShaper - Network traffic under control

    Currently listening to

  8. #8
    Join Date
    Sep 2007
    Beans
    10
    Distro
    Kubuntu 8.04 Hardy Heron

    Re: apt-get/synaptic bandwidth limiting (mini-HOWTO)

    Quote Originally Posted by francesc View Post
    dpkg-divert --local --rename /usr/lib/apt/methods/http
    echo '#!/bin/sh' > /usr/lib/apt/methods/http
    echo '/usr/bin/trickle -s -d 25 /usr/lib/apt/methods/http.distrib' >> usr/lib/apt/methods/http
    chmod 755 /usr/lib/apt/methods/http
    For me, the second line was failng with a "File not found" error, then I noticed the path is missing the initial '/'

    All in all, tt should be
    Code:
    sudo su
    dpkg-divert --local --rename /usr/lib/apt/methods/http
    echo '#!/bin/sh' > /usr/lib/apt/methods/http
    echo '/usr/bin/trickle -s -d 25 /usr/lib/apt/methods/http.distrib' >>  /usr/lib/apt/methods/http
    chmod 755 /usr/lib/apt/methods/http
    The traffic shaping is working brilliantly for me. Previously, my hardy box at the office was clobbering the bandwidth on every update, the boss was not very pleased.

  9. #9
    Join Date
    Oct 2005
    Location
    Adelaide, South Australia
    Beans
    746
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: apt-get/synaptic bandwidth limiting (mini-HOWTO)

    Code:
     			 				trickle -s -d 25 sudo gnome-terminal
    You could also try Wondershaper and if you're looking for something with more features you can go with MasterShaper.
    Havent tried mastershaper, walthough i did try wondershaper when two of us were playing mmorpgs in a house of 5 that all used the net, we resorted to squid.
    Fear is the mindkiller....
    The little death that obliterates...

  10. #10
    Join Date
    Jun 2006
    Beans
    2

    Re: apt-get/synaptic bandwidth limiting (mini-HOWTO)

    I've found better sollution on internet.
    Create /etc/apt/apt.conf.d/76download file with content:
    Acquire
    {
    Queue-mode "access";
    http
    {
    Dl-Limit "25";
    };
    };

    After that apt-get will be limited to 25KB/s

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •