Git cannot allocate enough memory to install Homebrew - linux

I am trying to install Homebrew on Linux on a cluster. But I am constantly getting the following error messages:
fatal: packfile .git/objects/pack/pack-9d2d97f367d3ebfa65a3b708b2d87333a8eb2bf0.pack cannot be mapped: Cannot allocate memory
error: https://github.com/Homebrew/homebrew-core did not send all necessary objects
Failed during: git fetch --force origin refs/heads/master:refs/remotes/origin/master
I then created a .git repository using the git init command on the .linuxbrew folder.
Can you please tell me how can I solve this problem?
Thank you.

From the message it looks like git is trying to memory map the entire given file and running out of physical memory. You might want to add more virtual memory to your sistem. It will be slower but there is a chance it will proceed forward.
https://askubuntu.com/questions/33697/how-do-i-add-swap-after-system-installation

Related

unable to push a existing git repository to github

Their is an error I have been having for awhile on ubuntu that is not allowing me to push an existing repository from the command line. this error keeps showing up. How do I fix this.
Thank you
error: chmod on /mnt/e/myproject/.git/config.lock failed: Operation not permitted
Is this disk drive NTFS?, if not, please try using sudo.

Resolving Errors With Git Index Too Small

I recently updated the development server that hosts our code repos to a newer version of Ubuntu (18.04). As part of the process git was upgraded to version 2.23.0. The actual application servers where the code gets deployed to need to be able to checkout the latest changes from the git repos. When I try to do a 'git fetch' on those servers I get a long list of errors that look like this:
error: index file
./objects/pack/._pack-5b58f700fea57ee6f8ff29514a376b945bb1c8a9.idx is
too small
I did some digging around to see if I could come up with a solution but so far noting has worked. I tried the answers listed here: git error: "index file is too small" .
Neither git index-pack nor git repack -a -d solved the issue. I even tried deleting the local copy of the files from the application server and installing fresh using git clone. The clone itself threw a bunch of errors similar to before
remote: error: index file
./objects/pack/._pack-5b58f700fea57ee6f8ff29514a376b945bb1c8a9.idx is
too small
At this point I'm out of ideas. Any help would be appreciated.
Edit: The output of du -h suggests that there is enough disk space.
The error message sounds like file corruption. If you have not run out of disk space, you can delete the index file and recreate it with:
git index-pack -v ./objects/pack/._pack-5b58f700fea57ee6f8ff29514a376b945bb1c8a9.idx
You might also want to run use git-fsck to
verify the connectivity and validity of the objects in the GIT database -- both the remote the local one.
If your index is corrupt, you can also try to reset the branch which will create a new index file:
To be safe, backup .git/index.
Remove the index file .git/index.
Perform git reset
References
The issue is a possible duplicate of git error: "index file is too small"
Documentation on git index-pack can be found at https://git-scm.com/docs/git-index-pack
Some notes on repairing a broken index: https://makandracards.com/makandra/5899-how-to-fix-a-corrupt-git-index
fatal: packfile name 'server' does not end with '.pack'
I encounter this error when transfer my git repo from Mac OS to another system. Files start with '._' are Mac OS meta files generated by tar command. So look at this question to avoid '._*' files: Tar command in mac os x adding "hidden" files, why?

Ubuntu "git pull --rebase" gets errors of "can't stat objects" - can you suggest what is the problem

I've been installing packages on my VM, (python / dev 3.6 oriented especially), and it seems I corrupted some setup, so now I get the following errors:
git pull --rebase
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
error: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log.
Automatic cleanup will not be performed until the file is removed.
error: Could not stat '.git/objects/4f/6716241438e21094af08213c05290a34cffdd7'
error: Could not stat '.git/objects/4f/abf345fc90d14f6f0026cf91bcc4c2fd5c58b8'
and lot more of them
could you suggest how to fix it?
"git gc" solved the problem (see git docs)

Foresight linux repo needs to be rebuild

We have a serious problem with foresight linux. As we know it, foresight has no support due to the conary package method which is shutdown now. However in our application the build fails because the online repo is not reachable (rpath).
This is the error we get during build:
Error occurred opening repository http://foresight.rpath.org/conary/: Connection refused
So we found a way to get a list of conary packages on the local server as a dump(from git - mirror of conary repo).
Now we are really not sure on how and where to update foresight Linux to look over new repo path instead of foresight.rpath.org/conary.
The fact is that we would not expect any major upgrade or update on the packages. This is to let build run without getting exit saying online repo issue, so that we can plan and manage until the application gets completely migrated.
You can edit the repo list by yourself, the path is
cat /etc/apt/sources.list

Ubuntu Linux git gc says error: failed to run repack

I am reading other threads with similar titles but seems not related to me. I have a git repo in my local ubuntu box. The files I have is mysql dump I split into 2mb files each. When I git gc, this is the output:
git#pc:~/repos/x$ git gc
Counting objects: 17244, done.
Delta compression using up to 4 threads.
Killedssing objects: 90% (2491/2767)
error: failed to run repack
Is there a way to trace what is causing? I already tried
git config --global pack.windowMemory "20m"
git config --global pack.packSizeLimit "20m"
git config --global pack.threads "1"
But this is the output
git#pc:~/repos/x$ git gc
Counting objects: 17244, done.
Killedssing objects: 3% (88/2767)
error: failed to run repack
Edit
This worked for me:
git config --global pack.windowMemory "20m"
git config --global pack.packSizeLimit "20m"
git config --global pack.threads "4"
git config --global pack.window "2"
git config --global pack.depth "10"
It seems because I only have 256 ram vps. and other process already eating 100mb. I will try also to upgrade my vps because this config makes git gc and git clone very slow.
Edit Again
After more investigation, it is because of the threads. I have 4 virtual cores assigned to my vps, and when I put the pack.threads "2" without the others, the problem went away.
I asked my provider to give me more ram but that did not help. Only when I configure the threads. Hope this help others
From your output, it looks like the process is being killed by an external process such as the Linux OOM Killer, or some other resource management process, during the delta compression stage. If you're running out of memory or disk space, then that gives you a logical place to start your investigation.
You might also consider running your process under strace. This will often tell you what the program was doing when it receives the signal, but may not always tell you who the signal sender actually was.
If strace fails you, the Git source currently has 12 references to sigaction(2), which you might be able to leverage to determine the signal sender by examining the siginfo_t struct. This would most likely require a core dump or an interactive debugger such as gdb.

Resources