If you want to install a Debian package (<package>.deb) on Arch Linux, you can use the debtap tool. Install it with

yay -S debtap

then run

sudo debtap -u

to update its database.

Once you have debtap installed, you can run

debtap my_package.deb

to generate a .tar.zst (something like my_package-1.2.3-x86_64.tar.zst).

You can then install the package by running

sudo pacman -U my_package-1.2.3-x86_64.tar.zst

And voila, you have installed the package!

Troubleshooting

I am getting the error warning: cannot resolve "libfoo1.2.3", a dependency of "my_package"

There is an error in the package dependencies generated by debtap where it didn’t correctly specify the version constraint. You will need to extract the package by following the instructions in Extracting the package.

Edit the line in .PKGINFO that says depend = libfoo1.2.3 to depend = libfoo>=1.2.3. There may also be a line above that one that says depend = libfoo. You can get rid of that line if it’s there.

Finally, recreate the package by following the instructions in Creating a new package.

When I install the package with pacman, I get error: command failed to execute correctly

If you run into something like the following error

/tmp/alpm_qzgZiM/.INSTALL: line 16: syntax error near unexpected token `fi'
/tmp/alpm_qzgZiM/.INSTALL: line 16: `	fi'
/usr/bin/bash: line 1: pre_install: command not found
error: command failed to execute correctly

it is probably because debtap generated an empty if or else block.

To fix this, unpack the package following the instructions in Extracting the package.

Then, edit .INSTALL to either remove the empty if or else branch, or insert : into the branch (: is a no-op command, similar to pass in Python).

# before
if [ "$arg" = "abort-remove" ]; then
fi
 
# after (remove branch)
# <empty>
 
# after (add `:`)
if [ "$arg" = "abort-remove" ]; then
    :
fi
# before
if [ -f $FCT_CONFIG ] || [ -f $EC_CONFIG ]; then
    mkdir $BACKUP_DIR && chmod 0600 $BACKUP_DIR
else
fi
 
# after (remove branch)
if [ -f $FCT_CONFIG ] || [ -f $EC_CONFIG ]; then
    mkdir $BACKUP_DIR && chmod 0600 $BACKUP_DIR
fi
 
# after (add `:`)
if [ -f $FCT_CONFIG ] || [ -f $EC_CONFIG ]; then
    mkdir $BACKUP_DIR && chmod 0600 $BACKUP_DIR
else
    :
fi

You can check that the .INSTALL is valid by running

bash .INSTALL

If it produces no output, the file is valid.

Finally, you can recreate the package by following the instructions in Creating a new package.

Extracting the package

First create the directory to unpack into. In this case, we will call it my_package/.

mkdir my_package/

Then, unpack the package into that directory.

tar --zstd -xf my_package-1.2.3-x86_64.tar.zst -C my_package/

The contents of the package will be extracted into my_package/.

Creating a new package

Assuming the contents of the package are found in my_package/, run the following command:

tar --zstd -cf my_package-1.2.3-x86_64.tar.zst -C my_package/ . --transform 's#^\./##'

This will create the package my_package-1.2.3-x86_64.tar.zst.