Problem with Wine installation (on Ubuntu 20.04)

From the "Ubuntu Softwares" folder, I attempted to install Wine.

After clicking on the installation button for Wine, I received this message:

Unable to install Wine. 
E: dpkg was interrupted upi must manually run dpkg -- configure a" to correct the problem.

Also I gave a try placing the first command on the terminal as indicated by numerous website:

yd@yd:~$ dpkg --add-architecture i386
dpkg: error: unable to create new file '/var/lib/dpkg/arch-new': Permission denied

I am new to Linux and Ubuntu. What would be the most appropriate course of action to fix this?

thx


Solution 1:

You have enabled broken old repository.

To remove it use commands below:

sudo add-apt-repository -r ppa:teejee2008/ppa

Then to install wine you really do not need third-party repositories, so you have to disable all such previously added WineHQ repositories by:

sudo apt-add-repository -r "deb http://dl.winehq.org/wine-builds/ubuntu/ bionic main"
sudo apt-add-repository -r "deb http://dl.winehq.org/wine-builds/ubuntu/ focal main"
sudo apt-add-repository -r "deb http://dl.winehq.org/wine-builds/ubuntu/ groovy main"
sudo apt-add-repository -r "deb http://dl.winehq.org/wine-builds/ubuntu/ hirsute main"

sudo apt-add-repository -r "deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main"
sudo apt-add-repository -r "deb https://dl.winehq.org/wine-builds/ubuntu/ focal main"
sudo apt-add-repository -r "deb https://dl.winehq.org/wine-builds/ubuntu/ groovy main"
sudo apt-add-repository -r "deb https://dl.winehq.org/wine-builds/ubuntu/ hirsute main"

and then update package lists, install updates, resume interrupted installations by

sudo dpkg --configure -a
sudo apt-get install -f

sudo apt-get update
sudo apt-get upgrade
sudo dpkg --configure -a
sudo apt-get install -f

And finally install Wine from official repositories by

sudo apt-get install wine

or better install PlayOnLinux (sudo apt-get install playonlinux) to install Windows applications using wizards.


Note: if you have problems with official default repositories, then re-add them by

sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs) main restricted universe multiverse"
sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs)-updates main restricted universe multiverse"
sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs)-security main restricted universe multiverse"
sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs)-backports main restricted universe multiverse"

and retry above commands.

Solution 2:

The installation instruction is documented on WineHQ website, to install wine on Ubuntu 20.04:

First run (as the message say):

sudo dpkg --configure -a

then:

sudo dpkg --add-architecture i386 
wget -nc https://dl.winehq.org/wine-builds/winehq.key
sudo apt-key add winehq.key
sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main' 
sudo apt update
sudo apt install --install-recommends winehq-stable