fbpx

Archive

403 User Rate Limit Exceeded Error | SOLUTION – Google Drive Fixed !

If you are getting; googleapi User Rate Limit Exceeded,  gdrive 403 Rate Limit Exceeded we have a solution for you.

We have been using Gdrive to upload some of our essential files for many months. Recently, we noticed that our daily backup was not working as expected. Gdrive error logs show us, Failed to get file: googleapi: Error 403: Rate Limit Exceeded, rateLimitExceeded and Failed to get file: googleapi: Error 404: File not found: Failed., notFound errors.

 

We tried rebooting our servers refreshing our auth logins etc. none of them fixed our gdrive User Rate Limit Exceeded errors. The problem was an API related issue so we need to create a new API and build Gdrive from source. The solution is simple but takes times, If you are figuring out how to do it. However, It took a couple of our hours to do it but it will take minutes of your time, if you follow this guide you will solve your google drive 403 Rate Limit Exceeded error.

 

PS: We applied all the steps on our Centos server, but it will be the same with all platforms.

 

Part 1

Carefully follow the steps to fix google drive User Rate Limit Exceeded Error.

Downloading and Installing GO

You will need root privileges or sudo for ubuntu.

Download the files :

To download the Go binary on your linux server you can use wget or curl:

wget https://dl.google.com/go/go1.11.5.linux-amd64.tar.gz

You need to extract Go binary files from go1.11.5.linux-amd64.tar.gz After successful extraction; you will have a go named folder. You should move it to /usr/local location because it is recommended by publishers.

tar -xzf go1.11.5.linux-amd64.tar.gz
mv go /usr/local

 

Creating Workspace Folder for Go

For better-organized projects, create a projects folder with bin and src folder together in user home directory.

 

mkdir  -p ~/projectss/{bin,src}

 

Setting Environment Variables for Go

We need to set a $PATH Environment variable for Go to use it like any other commands in our UNIX system.

Create path.sh script in /etc/profile.d directory location

nano /etc/profile.d/path.sh

Add the following to the file, save and exit. (/etc/profile.d/path.sh)

/usr/local/go/bin

Additionally, we need to define GOPATH and GOBIN Go environment variables in the user’s  .bash_profile file to point to the recently created projects folder. GOPATH is our Go source files GOBIN is our compiled Go binary files. Open the .bash_profile file:

nano ~/.bash_profile

Append the following to the end of the file, save and exit: (~/.bash_profile)

export GOBIN="$HOME/projects/bin"
export GOPATH="$HOME/projects/src"

Apply to changes in our system; we need to update profiles with source command

 

source /etc/profile && source ~/.bash_profile

Let’s test our Go if it is working

[[email protected] ~]# go version 
go version go1.11.5 
linux/amd64

We needed to have Go in our system to compile Gdrive so that’s all for installing Go. We can continue Part 2 where we will compile Gdrive from source files.

Part 2

We will continue to solve googleapi 403 Rate Limit Exceeded error. Keep following the steps…

Creating Google API for Gdrive

If you see these errors while running Gdrive on your system:

Failed to get file: googleapi: Error 403: Rate Limit Exceeded, rateLimitExceeded

You need your own Google Drive API to use with Gdrive so you can get information from your usages. Google API’s provide  Quotas Information which is very helpful in our situation. We need to know if we Exceed our limits.

Visit https://console.developers.google.com/apis/dashboard

Top of the page, click Select a project then New Project. 

Fill Project name as you want it.

Google API New Project

 

Choose your newly created project at the top of the page. At the dashboard, click  ENABLE APIS AND SERVICES

It will redirect you API Library. Search Drive keyword and find Google Drive API. You need to enable Google Drive API to use it in your project.

 

Add and Enable Google Drive API

We successfully add Google Drive API in our project. Gdrive requries Google Drive API’s credentials. Let’s create one.

 

Google Drive API Credentials

Create Credentials Details and choose the option ” Help me choose.”

Google API Credentials

Choose the settings as I did:

Google API Credentials Settings

 

I filled Client Name as same as my API Name.

Google API Name

Next step, fill your mail address and write a Product name.

 

Google API OAuth Name

After that, It will give us the Credentials we need.

 

Google Drive Error 403 User Rate Limit Exceeded Solution

Click download and done.

It will download a JSON file which contains our Credentials for Gdrive. Open the client_id.json file with a text editor. Notepad++ is a good option.

You will see,

“client_id”:”205xxxxxxxxx-22imoxxxxxxxxxxxxxxxxpsm.apps.googleusercontent.com”

“client_secret”:”NxxxxxxG-4HxxxxxxxxxxxxxxxwZA”

We need that two value so note it.

 

Getting Source Files of Gdrive

We need Gdrive projects files from Github so that we can compile it with Go. Let’s download files into our ~/projects/ folder that we created earlier.

 

cd ~/projects/

Use GO to download Gdrive src files from GitHub.

 

go get github.com/prasmussen/gdrive

We need to change Credentials in handlers_drive.go where is located in the gdrive folder.

 

cd ~/projects/src/src/github.com/prasmussen/gdrive/

nano handlers_drive.go

const ClientId = "3671xxxxxxxxxxxxxxxxxxxxxxeg.apps.googleusercontent.com"
const ClientSecret = "1qsNxxxxxxxxhoO"

 

No More googleapi User Rate Limit Exceeded

Change ClientId and ClientSecret with your own Google Drive API Credentials form client_id.json 

Save and exit.

We are ready to build Gdrive.

Let’s build it:

 

cd ~/projects/src/src/github.com/prasmussen/gdrive/
go build

 

After the build, you will see gdrive executable file. Copy it to /usr/bin/ folder to use it.

 

cp gdrive /usr/bin/gdrive

 

Note: If you had gdrive on your system, you need to delete old token_v2.json.

 

cd ~/.gdrive

rm token_v2.json

Now, we have gdrive installed in our system with our Google Drive API settings.

Let’s test it.

 

gdrive list

 

If it is your first time to use Gdrive or deleted token file, Gdrive needs Authentication from you.

 

Authentication needed
Go to the following url in your browser:

Enter verification code:

Paste the link in your browser and get the verification code.

 

Execute gdrive list again

We Solved google drive 403 Rate Limit Exceeded

That is it is working without errors!

 

Let’s check if our API is working too.

Gdrive Quotas – gdrive User Rate Limit Exceeded

Yes ! it is working too. Now we can see our Quota limit.

For Windows, please check this: https://github.com/prasmussen/gdrive/issues/426#issue-404775200

If you have any question, please leave a comment below. We will answer them ASAP.

 

Thanks.

 

How to install and update GCC on Centos 7

I will show you How to install and update GCC on Centos 7 step by step. Just follow my steps and if you get any error just comment on this post i will reply as soon as possible.

If your centos 7 is freshly installed you need to update our centos 7.

yum update

After that just install some basic requirements that will be needed nex steps.

yum install bzip2
yum install wget
yum install nano

How to install GCC on Centos 7

Just follow same steps as centos 6 and compile GCC on your machine. You must made a change for centos 7. Only one difference is at 7 step when you are compiling GCC.

Adjust your command as your need :

../gcc-6.1.0/configure –enable-languages=c,c++ –disable-multilib && make -j <number of CPU cores> && sudo make install && echo “success”

you have too add these paramaters : –enable-languages=c,c++ –disable-multilib

Other step as same as follows

How To Install Newer Version Of GCC on CentOS 6.x

 

How to solve GLIBCXX Not Found Error on Centos 7

 

Just follow these steps (You must compile newer version of GCC):

cd /usr/local/lib64
cp libstdc++.so.6.0.22 /usr/lib64/
cd /usr/lib64/
mv libstdc++.so.6 libstdc++.so.6.OLD
ln -sf libstdc++.so.6.0.22 libstdc++.so.6

This will solve these problems :

libstdc++.so.6 not found CentOS 7.3
/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21′ not found

 

Lets Check :

strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX

Output :

GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22

How to Update glibc Newer Version on Centos 6.x

You tried to runs some commands and got error about your glibc version is not high enough to complete your command. Thus, You may need newer version glibc on your Centos 6.x VPS server. I will show you how to update glibc.

How to Update glibc Newer Version on Centos 6.x

We have two way to accomplish this task. One way is that compile from source which take too long time to do that. Another way is that get files from repo which is relatively easy step.

Lets first check our glibc versions that installed in our VPS server:

strings /lib64/libc.so.6 | grep GLIBC

Result:

GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12

 

1.  Compile glibc From Source

We can get soruce file in 2 ways, using git or ftp. You can get latest version from git. We need GLIBC_2.17 version for our centos 6.x so we will use ftp.

mkdir ~/glibc-install; cd ~/glibc-install
wget http://ftp.gnu.org/gnu/glibc/glibc-2.17.tar.gz
tar -zxvf glibc-2.17.tar.gz

After Download and extract all source files we need to create a build folder. It is better way to have another folder for build.

cd glibc-2.17
mkdir build

We need to put files  separete place in order to not corrput our linux system. /opt/glibc-2.17

cd build
../configure --prefix=/opt/glibc-2.17

We can start compiling our source files. It will take hours depending your CPU cores. You can find your <number of CPU Cores> by using nproc command.

make -j<number of CPU Cores>
make install

After compiling is done we need to show place of our new glibc to program we are gonna use. In order to do that follow step below;

 

LD_LIBRARY_PATH=/opt/glibc-2.17/lib

export LD_LIBRARY_PATH.

Furing your current login session on VPS Library is exposed

Another way is that creating symbolic link :

ln -sf /opt/glibc-2.17/glibc-2.17.so /lib/libc.so.6.

I do not recommend this step because linux use older version of glibc and if you create a symbolic link somethings will sure go wrong.

If you are not experienced system administrator do not play with glibc, it might break your Linux system.

2. Using RPM to install new version of glibc

Update glibc to 2.17 for CentOS 6

I found a script from github. We will use it. Lets appreciated his work : https://gist.github.com/harv/f86690fcad94f655906ee9e37c85b174

Script :


#! /bin/sh

# update glibc to 2.17 for CentOS 6

wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-common-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-devel-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-headers-2.17-55.el6.x86_64.rpm

sudo rpm -Uvh glibc-2.17-55.el6.x86_64.rpm \
glibc-common-2.17-55.el6.x86_64.rpm \
glibc-devel-2.17-55.el6.x86_64.rpm \
glibc-headers-2.17-55.el6.x86_64.rpm

You might ecounter some errors: “error: Failed dependencies:

To fix it just add this parameter --force --nodeps at the end of the all command.

After finished up lets check again :

strings /lib64/libc.so.6 | grep GLIBC

Result :

GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_PRIVATE

We have GLIBC_2.17 on our centos 6.x VPS server.

If you have a question just post as a comment and i will reply it as soon as possible.

GLIBCXX_3.4.xx Not Found – Install Newer Version Of GLIBCXX on Centos 6

Centos 6.x user might face it the GLIBCXX version error on their VPS server. You can solve this error switching your OS version to more newer ones like centos 7.x. However, if you want to stick with centos 6.x and have newer version of GLIBCXX just follow steps i will show on this article.

 

GLIBCXX_3.4.xx Not Found Error means that version on your Cenots 6.x VPS machine is not high enough to run the binary. Thus we will need  to upgrade GLIBCXX version.

Lets first check our Centos 6.x VPS’s GLIBCXX versions.

strings /usr/lib64/libstdc++.so.6 | grep GLIBC

Here is the result:

GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_FORCE_Yeni
GLIBCXX_DEBUG_MESSAGE_LENGTH

We need more newer version to run our programs on centos 6.x.

Fixing  /lib/libstdc++.so.6: version GLIBCXX_3.4.xx not found Error

We need libstdc++.so.6.0.22 file in order to have higer version of GLIBCXX. You can create the file by following the steps from this article : How To Install Newer Version Of GCC on CentOS 6.x

After you created libstdc++.so.6.0.22 file just follow these steps :

cd /usr/local/lib64
cp libstdc++.so.6.0.22 /usr/lib64/
cd /usr/lib64/
mv libstdc++.so.6 libstdc++.so.6.OLD
ln -sf libstdc++.so.6.0.22 libstdc++.so.6

Lets check GLIBCXX versions again:

strings /usr/lib64/libstdc++.so.6 | grep GLIBC

Result :

GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBC_2.3
GLIBC_2.2.5
GLIBC_2.3.2
GLIBCXX_FORCE_Yeni
GLIBCXX_DEBUG_MESSAGE_LENGTH

We have new version of GLIBCXX on our centos 6.x VPS server now. You can try to run your program and check that you are not getting same error anymore.

 

If you have any question just write a comment and i will reply as soon as possible.

How To Install Newer Version Of GCC on CentOS 6.x

 
 
You might encounter GCC libraries erros that stated you use older  version of gcc or you need newer version of gcc in some cases to run some programs on CentOS 6 system.

I will show you How To Install Newer Version Of GCC on CentOS 6.x

You have to compile new gcc version on your linux machine. I suggest you to use a server that has more than 4 cpu because compiling gcc takes hours if you have limited cpu on your server. In addition to cpu number importance, you need a more than 20gb free space for compiling gcc. Please take account these suggestions.

As of the writing of this article, centos 6.x use GCC v4.4.7 version and latest GCC v7.3 released. You can install any version on your VPS server.

How To Install GCC on CentOS 6.x

We will install older version of GCC from base repo on our VPS because we need C++ compiler in order to compile newer version on our VPS server

1. Login to your VPS

A. Login as a Root user
B. Create a user account and set a password for it
adduser <username>
passwd <username>

C. You have to give root privileges to your newly created user account
visudo
Find the line "root ALL=(ALL) ALL" and after that line
Add the line "<username> ALL=(ALL) ALL"
then Ctrl+C and write :wq and exit.

D. You can logou t from your root account and re-login with new accout that you gave root privileges

2. Install GCC packages on your Centos 6.x VPS.
sudo yum install gcc gcc-c++

3. After install, Check GCC versions and locations.
gcc --version
May say: gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
g++ --version
May say: g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
which gcc
/usr/bin/gcc
which g++
/usr/bin/g++

How To Install Newer Version Of GCC on CentOS 6.x

We installed officially supported GCC version on our VPS but we want newer version so lets continue…

1. Be sure! you installed older version of GCC that we show you complete steps above. 

2. We need to install additionally required packages:
sudo yum install svn texinfo-tex flex zip libgcc.i686 glibc-devel.i686

3. We can decide which version of GCC we are gonna compile and use our VPS. This command will show you all availabe versions GCC :
svn ls svn://gcc.gnu.org/svn/gcc/tags | grep gcc | grep release

gcc_6_1_0_release/
gcc_6_2_0_release/
gcc_6_3_0_release/
gcc_6_4_0_release/
gcc_7_1_0_release/
gcc_7_2_0_release/
gcc_7_3_0_release/

4. We decided to compile GCC 6.1 version. This steps could takes few minutes depending on your internet connection. This article is written for gcc_6_1_0_release/ so please be careful while copying our code if you decided to install different version.
mkdir ~/GCC-source
cd ~/GCC-source
svn co svn://gcc.gnu.org/svn/gcc/tags/gcc_6_1_0_release/

5. After getting all files, lets install source of additional prerequisites. It will install MPFR, GMP , and MPC on your VPS. Run this command inside of the source files.
cd gcc_6_1_0_release/
./contrib/download_prerequisites
--- Important, run this as shown, from the gcc_6_1_0_release directory.
--- Do not! cd to the contrib directory or you get errors

6. compiling use great amount of memory so if you have a memory lower than 1GB on your VPS server we suggest you to follow these steps. However, If you have more than 2GB you can skip this step. This step add 500MB of virtual memory, using a swap file.
SWAP=/tmp/swap
dd if=/dev/zero of=$SWAP bs=1M count=500
mkswap $SWAP
sudo swapon $SWAP

7. We are building ! This could take hours depending on how man cpu you have. If this thing goes smoothly we will see “finished” as a last line. It is normal to see some error like messages. We will use different directory to compile this because it is better way to do it.
cd ..
mkdir gcc_6_1_0_release-build/
cd gcc_6_1_0_release-build/
../gcc_6_1_0_release-build/configure && make && sudo make install && echo "finished"
--- If your VPS has multiple CPU cores, you can speed up this progress by changing the middle part of the code
--- change line from "&& make &&" to "&& make -j <number of CPU cores> &&".
--- You can see how many CPU cores your VPS has by running this code "nproc"

8. If you followed the instructions at 6. steps remove the swap file.
sudo swapoff $SWAP
rm /tmp/swap

9. Lets check installed versions and their locations
hash -r
(Makes your login "forget" about the previously seen locations of gcc and g++)
gcc --version
May say: gcc (GCC) 6.1.0
g++ --version
May say: g++ (GCC) 6.1.0
which gcc
/usr/local/bin/gcc
which g++
/usr/local/bin/g++

10. We need to add new libraries to ld (the GNU linker).
echo "/usr/local/lib64" > usrLocalLib64.conf
sudo mv usrLocalLib64.conf /etc/ld.so.conf.d/
sudo ldconfig
--- This may say a file or two "is not an ELF file - it has the wrong magic bytes at the start."
--- You may ignore this message. It is silent about the work it successfully completed.

11. After we compiling newer version of GCC, our GCC-source folder size is over 8.0GB or so. We can keep this folder in case of need in future. However, if you need space you can reclaim this space.

cd ~/
rm -rf GCC-source

Yes, we have newer version of GCC on our centos 6.x VPS now.

CentOS officially supported GCC versions can be found in /usr/bin/ and include files in /usr/include

You newer GCC version files can be found in : /usr/local/bin  newer 32-bit libs in  /usr/local/lib newer 64-bit libs in /usr/local/lib64 newer include files in /usr/local/include

Lets point out some other issues that Centos 6.x users face and solve with it newly compiled GCC versions :  GLIBCXX_3.4.xx Not Found – Install Newer Version Of GLIBCXX on Centos 6