<SOLVED> Error installing GitHub CLI: Malformed entry 1 in list file

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
ikariGendou
Level 1
Level 1
Posts: 8
Joined: Mon Jul 12, 2021 10:24 am
Location: Namekku-sei

<SOLVED> Error installing GitHub CLI: Malformed entry 1 in list file

Post by ikariGendou »

TLDR: I spent quite a few hours fixing this. I want to share my solution and also ask: What is causing this error?

I tried to install gh on Linux Mint 20. I followed the official instructions from GitHub: https://github.com/cli/cli/blob/trunk/d ... -pi-os-apt

But when I tried to input "sudo apt update" I got this error:

"Malformed entry 1 in list file /etc/apt/sources.list.d/github-cli.list ([option] not assignment)"

After doing some research, I run "inxi -Sr" and I dissect these lines:

Active apt repos in: /etc/apt/sources.list.d/github-cli.list
1: deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main

I rewrote the line from the GitHub website to this:

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null

Then I was able to finish installing gh by inputting:
sudo apt update
sudo apt install gh

This problem tortured me for hours so I hope my solution helps others.

What causes the error? Would the GitHub original instructions work on Debian/Ubuntu?

iG
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
ikariGendou
Level 1
Level 1
Posts: 8
Joined: Mon Jul 12, 2021 10:24 am
Location: Namekku-sei

Re: Error installing GitHub CLI: Malformed entry 1 in list file

Post by ikariGendou »

I must add:

My tweak works because first I ran in the terminal the command "dpkg --print-architecture" and it returned "amd64". In other systems, you may get a different output. So you have to adjust accordingly for my recipe to work.

I also had an epiphany: The original line from the GitHub instructions mixes code with data. The error could be happening due to the interpreter not evaluating the command above and returning "amd64" in front of the data.

I do not understand the purpose of the dollar sign before the parenthesis in "$(dpkg --print-architecture)". Is it supposed to act like a tilde? Whatever is interpreting that line, how can it differentiate the code (dpkg --print-architecture) from the remaining data?

iG
mikeflan
Level 17
Level 17
Posts: 7097
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Error installing GitHub CLI: Malformed entry 1 in list file

Post by mikeflan »

Yeah, arch=amd64 is correct.
This page explain the dollar sign:
https://askubuntu.com/questions/833833/ ... command-do
Locked

Return to “Software & Applications”