1

I follow the steps in Upgrade Git version on Ubuntu 14.04, but when I enter the first step command: sudo add-apt-repository ppa:git-core/ppa, I receive the following error:

FileNotFoundError: [Errno 2] No such file or directory: '/etc/apt/sources.list.d/git-core-ppa-trusty.list'

you can check the following picture for detail:

error discription

With this error, when I continue to enter the remaining 2 commands, I failed to upgrade my git version. Hope someone know this problem can help me out, thank you.

Phymin
  • 13
  • Can you check if the directory /etc/apt/sources.list.d exists on your machine? Also please copy and paste command outputs as plain text and with code formatting instead of uploading screenshots. Thank you. – Byte Commander Sep 24 '17 at 15:02
  • Thank you for your formating, but with my current reputation, I can just uploading screenshots, sorry for the inconvenient. I manually create the directory of source.list.d, and the above error disappeared, but when I enter the second command: sudo apt-get update, I receive the following error: Failed to fetch http://ppa.launchpad.net/git-core/ppa/ubuntu/dists/trusty/main/binary-amd64/Packages Hash Sum mismatch. – Phymin Sep 24 '17 at 15:15
  • @Phymin you don't need to upload anything. Just copy the output and paste it here. – muru Sep 24 '17 at 15:23
  • 1
    @muru The editor blocks posting more than 2 or 3 links for new users. If the output is not formatted as code block, possible URLs inside it count as links too. The solution is to highlight the output in the editor and use the code format button {} or press Ctrl+K. – Byte Commander Sep 24 '17 at 15:35

1 Answers1

0

Your initial error (the Python FileNotFoundError) is most likely caused because the directory /etc/apt/sources.list.d inside which add-apt-repository tries to create a sources file does not exist, for whatever obscure reason.

To fix this, simply create this directory manually with e.g. this command:

sudo mkdir /etc/apt/sources.list.d
Byte Commander
  • 107,489
  • Sorry, but this doesn't work for me, the error remains the same as before. – Phymin Sep 24 '17 at 15:46
  • Then please update your question with the exact command and full output. – Byte Commander Sep 24 '17 at 15:55
  • Some comments on the answer to the linked question suggest you may additionally have to change your update server, eg, from us.ubuntu.com to XX.ubuntu.com where XX is your country code – could you try that please? Also try sudo apt clean after removing the files. – dessert Sep 24 '17 at 16:47
  • Huh, you get a hash sum mismatch on all repositories? That is weird. While I try to find something appropriate, you could indeed try switching to a different mirror server as dessert described. – Byte Commander Sep 24 '17 at 17:53
  • Could you simply try the other answers to the linked question? Maybe even waiting a few hours could solve it. I don't really know what else to try right now. – Byte Commander Sep 24 '17 at 18:11
  • Hi, I tried a lot of mirrors, the above hash sum mismatch was copied from the main server. but with all these mirrors, the hash sum match of the ppa:git-core never passed. And I also tried the other answers in the linked question, but they all didn't work. – Phymin Sep 25 '17 at 03:29
  • Well, I don't know how to proceed then. I would suggest to split your question up though. More precisely, I'd recommend you to remove everything Hash Sum mismatch related from your question (and I will do for the answer) so that only the FileNotFoundError remains, which is solved by this answer so that you could accept it. Then you post a new question about the Hash Sum mismatch error and include your full sudo apt update output as well as all possible solutions that you tried already, with a link to that question where you found them. That way more people will see it and might respond. – Byte Commander Sep 25 '17 at 10:04
  • Hi, I switched to another network and the upgrade succeeded, thanks for your help, it really helps. – Phymin Sep 25 '17 at 11:27
  • Yay, cool. Glad you got it to work :) – Byte Commander Sep 25 '17 at 11:43