Sudo apt install -f gives syntax error

I try in terminal Xubuntu the command ‘sudo apt install -f’.
This gives an error message: /usr/bin/apt: 1: /usr/bin/apt: Syntax error: word.unexpected (expecting “)”)
What do I wrong?

Specifications

-> Output of inxi -Fxz here!
-> Output of dmesg_*.log here!
-> Output of dmesg-err_*.log here!

First, install dependencies:

-> apt update
-> apt install -y dnsutils traceroute hping3 netcat tcpdump

-> ip a
-> ip route
-> traceroute 8.8.8.8
-> nslookup example.com

Additional Information (if applicable)

  • Software title | (E.g. Nextcloud)
  • Software version | (E.g. softwarename -V)
  • Was the software title installed freshly or updated/migrated?

Steps to reproduce

Expected behaviour

Actual behaviour

Extra details

Could you please fill out the template I put into your post? That would be helpful for everyone involved.

Do you see such error with other apt command variants as well?

What happens if you try one of these?

sudo apt update

sudo apt -f install

Hi Akito, I’m sorry, but I don’t understand what you mean, saying 'could you please fill out the template I put into your post". Which template? Where in my post?

Hi Abishek,

‘Sudo apt update’ gives the same error message.
‘Sudo apt -f install’ gives the same error message.

Should it be

Sudo apt-get install -f

As per your info page

Where the f is to fix the error

Or can you use apt without the get part …

1 Like

Yes, one can.
… …

1 Like

Thanks for that update … I have learned something new today

I have only used apt get never apt alone

Changed since I did the courses and exams
Glad I asked

apt is a wrapper for apt-get, which is more user-friendly. However, apt-get is still recommended for script use, as its API won’t change anymore, while nobody is so sure about that regarding apt.

2 Likes

Hi, this is some output of my terminal:

harry@harry-Aspire-One-522:~$ sudo apt install -f
[sudo] wachtwoord voor harry:
/usr/bin/apt: 1: /usr/bin/apt: Syntax error: word unexpected (expecting “)”)
harry@harry-Aspire-One-522:~$ sudo apt -f install
/usr/bin/apt: 1: /usr/bin/apt: Syntax error: word unexpected (expecting “)”)
harry@harry-Aspire-One-522:~$ sudo apt-get install -f
/usr/bin/apt-get: 1: /usr/bin/apt-get: �: not found
/usr/bin/apt-get: 1: /usr/bin/apt-get: �@8: not found
/usr/bin/apt-get: 1: /usr/bin/apt-get: ELF: not found
/usr/bin/apt-get: 15: /usr/bin/apt-get: Syntax error: “(” unexpected
harry@harry-Aspire-One-522:~$ sudo apt-get -f install
/usr/bin/apt-get: 1: /usr/bin/apt-get: �: not found
/usr/bin/apt-get: 1: /usr/bin/apt-get: �@8: not found
/usr/bin/apt-get: 1: /usr/bin/apt-get: ELF: not found
/usr/bin/apt-get: 15: /usr/bin/apt-get: Syntax error: “(” unexpected
harry@harry-Aspire-One-522:~$

So, I didn’t succeed yet.
If you can still help me…
Thanks in advance.

Did you freshly install the operating system?
Why do you need to use sudo apt install -f?

If this is a fresh OS installation, then re-install it, wiping the current one.

No, I didn’t freshly install de OS.
One or two moths ago I did an update and an upgrade (sudo apt update && sudo apt upgrade -f.

I do need to use sudo apt install -f because I tried to install Zoom, but there were issues with dependecies. On your site I red this (see: https://itsfoss.com/install-deb-files-ubuntu/ “If you get a dependency error while installing the deb packages, you can use the following command to fix it: sudo apt install -f”)
I didn’t succeed installing with the sotwarecenter, nor with Gdebi, so I tried the terminal.

The errors you are experiencing seem to indicate very serious file and/or file system corruption.

NOTE: Execute all the following commands as the root user.

Check architecture problems:

uname -a
dpkg -l | grep -E 'amd64|i386' | awk '{print $4}' | grep -c amd64
dpkg -l | grep -E 'amd64|i386' | awk '{print $4}' | grep -c i386
dpkg -l | grep -E 'apt|dpkg'

See if your hard drive is showing errors:

  1. Boot into a live medium.
  2. Execute following commands on the live medium:
apt update
apt install -y smartmontools
smartctl -x /dev/sda # or whatever your main hard drive is, where your OS is installed

Links like these indicate you were trying to fool around with architectures. Did that happen due to the Zoom installation? (Btw. Zoom is really bad software…)

If this is an architecture problem, then I would also recommend to just re-install the entire operating system, from scratch.

2 Likes

Thanks, Akito.
That’s quite a job you propose :face_with_raised_eyebrow:
But I fear you’re right, because of the link you give and because I’ve more problems.
I know Zoom is bad software, but I need it for a conference call for which it’s not me who orders the software…
I think I’m going to re-install the OS, but because that needs some time it will last for a while. In the meantime I’ll install Zoom on my smartphone.

Thanks again for your help.
Kind regards,
Harry

That is the best option in your current situation.

1 Like

/usr/bin/apt-get: 10: Syntax error: word unexpected (expecting “)”)
i have so problem in apt how to fix error in linux

What did you do with apt-get before this? Did you make any manual changes?