Skip to content

Instantly share code, notes, and snippets.

@cniw
Last active April 18, 2024 15:59
Show Gist options
  • Save cniw/7a0220ce8b75368f7f57aa422d3fea97 to your computer and use it in GitHub Desktop.
Save cniw/7a0220ce8b75368f7f57aa422d3fea97 to your computer and use it in GitHub Desktop.
Install Waydroid on unsupported Debian based distro caused by incompatible python3-gbinder package
#!/bin/bash
# script name: install_waydroid.sh
# description: Install Waydroid on unsupported Debian based distro caused by incompatible python3-gbinder package
# related to : https://github.com/waydroid/waydroid/issues/214#issuecomment-1120926304
# author : Wachid Adi Nugroho <wachidadinugroho.maya@gmail.com>
# date : 2022-07-07
export distro=$(grep -oP '(?<=^NAME=).*' /etc/os-release)
if [[ -f /usr/bin/dpkg ]];
then
export arch=$(dpkg --print-architecture)
if ! ([[ $arch == "amd64" ]] || [[ $arch == "arm64" ]]);
then
echo "You're using $arch machine, currently waydroid repo only provides deb packages for amd64 and arm64 machine."
echo "If you're really want to install waydroid on this $arch machine you should build it with all the dependencies."
echo "Go check this link https://gist.github.com/cniw/98e204d7dbc73a3fa1bf61629b2a2fc1 or just run this command"
echo -e "\n \`curl -s https://gist.githubusercontent.com/cniw/98e204d7dbc73a3fa1bf61629b2a2fc1/raw | bash\`\n"
exit 0
fi
[[ ${distro} =~ Debian ]] && \
export codename=bullseye || \
export codename=focal
[[ ! -f /usr/bin/curl ]] && sudo apt install -y curl
sudo curl https://repo.waydro.id/waydroid.gpg -o /usr/share/keyrings/waydroid.gpg
echo "deb [signed-by=${_}] https://repo.waydro.id/ ${codename} main" | \
sudo tee /etc/apt/sources.list.d/waydroid.list
sudo apt update
sudo apt install -y \
build-essential cdbs devscripts equivs fakeroot \
git git-buildpackage git-lfs \
libgbinder-dev
mkdir ~/build-packages
cd ${_}
git clone https://github.com/waydroid/gbinder-python.git
cd gbinder-python
curl https://raw.githubusercontent.com/MrCyjaneK/waydroid-build/main/build_changelog -o build_changelog
bash ${_} $(git tag -l --sort=authordate | sed 's/[a-z/]//g' | uniq | tail -n1)
sudo mk-build-deps -ir -t "apt -o Debug::pkgProblemResolver=yes -y --no-install-recommends"
sudo debuild -b -uc -us
sudo apt install -f -y ../*.deb
sudo apt remove -y gbinder-python-build-deps libgbinder-dev \
git-buildpackage git-lfs fakeroot equivs devscripts cdbs
echo "You can remove git and build-essential packages too, by run:"
echo -e "\t\`sudo apt remove git build-essential\`"
sudo apt autoremove
sudo apt install -y waydroid
else
echo "Your distro ${distro} is not use dpkg as package manager"
fi
@cniw
Copy link
Author

cniw commented May 11, 2022

how to run this script:

curl -s https://gist.githubusercontent.com/cniw/7a0220ce8b75368f7f57aa422d3fea97/raw | bash

copy this line, paste in your terminal then press enter to run

@dreamcat4
Copy link

hi @cniw
When I run here this part:

  curl https://raw.githubusercontent.com/MrCyjaneK/waydroid-build/main/build_changelog | bash

it has an error. it says:

  curl https://raw.githubusercontent.com/MrCyjaneK/waydroid-build/main/build_changelog | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   506  100   506    0     0   3316      0 --:--:-- --:--:-- --:--:--  3307
Your branch is up-to-date with 'origin/bullseye'.
gbp:debug: ['git', 'rev-parse', '--show-cdup']
gbp:debug: ['git', 'rev-parse', '--is-bare-repository']
gbp:debug: ['git', 'rev-parse', '--git-dir']
gbp:debug: ['git', 'symbolic-ref', 'HEAD']
gbp:debug: ['git', 'show-ref', 'refs/heads/bullseye']
gbp:debug: ['git', 'merge-base', 'HEAD', 'upstream']
gbp:debug: No upstream tag found: Failed to get common ancestor: fatal: Not a valid object name upstream
gbp:debug: debchange ['--no-auto-nmu', '--create', '--package', 'gbinder-python', '--', ''] []
gbp:debug: ['git', 'tag', '-l', 'debian/unknown']
gbp:debug: ['git', 'tag', '-l', 'debian/unknown']
gbp:debug: ['git', 'log', '--pretty=format:%H', '--no-show-signature', '-1', '--', 'debian/changelog']
gbp:info: Starting from first commit
gbp:debug: ['git', 'log', '--pretty=format:%H', '--no-show-signature', 'HEAD', '--no-merges', '--']
gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', '834198b2e6cbeebdce80e982a81b1bf37bb3adbd^0']
gbp:debug: ['git', 'show', '--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%f%x00%b%x00', '-z', '--date=raw', '--no-renames', '--name-status', '--no-show-signature', '834198b2e6cbeebdce80e982a81b1bf37bb3adbd']
gbp:debug: debchange ['--no-auto-nmu', '--nomultimaint-merge', '--multimaint', '--', '[[[insert-git-dch-commit-message-here]]]'] []
gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', '1959f81d19dae83a88670b5a7627cd05e49fcfaf^0']
gbp:debug: ['git', 'show', '--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%f%x00%b%x00', '-z', '--date=raw', '--no-renames', '--name-status', '--no-show-signature', '1959f81d19dae83a88670b5a7627cd05e49fcfaf']
gbp:debug: debchange ['--no-auto-nmu', '--nomultimaint-merge', '--multimaint', '--', '[[[insert-git-dch-commit-message-here]]]'] []
gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', '121095747e4dabe32a5d0f64ad9b4da7a663d5b6^0']
gbp:debug: ['git', 'show', '--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%f%x00%b%x00', '-z', '--date=raw', '--no-renames', '--name-status', '--no-show-signature', '121095747e4dabe32a5d0f64ad9b4da7a663d5b6']
gbp:debug: debchange ['--no-auto-nmu', '--nomultimaint-merge', '--multimaint', '--', '[[[insert-git-dch-commit-message-here]]]'] []
gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', '2e1e05c0a0240d6c06e9bbe9b22dcc35c2e0211c^0']
gbp:debug: ['git', 'show', '--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%f%x00%b%x00', '-z', '--date=raw', '--no-renames', '--name-status', '--no-show-signature', '2e1e05c0a0240d6c06e9bbe9b22dcc35c2e0211c']
gbp:debug: debchange ['--no-auto-nmu', '--nomultimaint-merge', '--multimaint', '--', '[[[insert-git-dch-commit-message-here]]]'] []
gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', '6538376c0699e47640981d5f2e7ad4a8799d9158^0']
gbp:debug: ['git', 'show', '--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%f%x00%b%x00', '-z', '--date=raw', '--no-renames', '--name-status', '--no-show-signature', '6538376c0699e47640981d5f2e7ad4a8799d9158']
gbp:debug: debchange ['--no-auto-nmu', '--nomultimaint-merge', '--multimaint', '--', '[[[insert-git-dch-commit-message-here]]]'] []
gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', '88566f61e686651d3a7b58e73e9b20aa520d201c^0']
gbp:debug: ['git', 'show', '--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%f%x00%b%x00', '-z', '--date=raw', '--no-renames', '--name-status', '--no-show-signature', '88566f61e686651d3a7b58e73e9b20aa520d201c']
gbp:debug: debchange ['--no-auto-nmu', '--nomultimaint-merge', '--multimaint', '--', '[[[insert-git-dch-commit-message-here]]]'] []
gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', 'cd7620aa0d2e8875785708ad4263808636f3dce5^0']
gbp:debug: ['git', 'show', '--pretty=format:%an%x00%ae%x00%ad%x00%cn%x00%ce%x00%cd%x00%s%x00%f%x00%b%x00', '-z', '--date=raw', '--no-renames', '--name-status', '--no-show-signature', 'cd7620aa0d2e8875785708ad4263808636f3dce5']
gbp:debug: debchange ['--no-auto-nmu', '--nomultimaint-merge', '--multimaint', '--', '[[[insert-git-dch-commit-message-here]]]'] []
gbp:debug: Set header option 'urgency' to 'medium'
gbp:debug: debchange ['--no-auto-nmu', '--nomultimaint-merge', '--multimaint', '--urgency=medium', '--nomainttrailer', '--', ''] []
bash: You did not set version. Assuming 0.0.0
VERSION=0.0.0+git.202109121608
θ127° [id:~/.builds/ … id/build-packages/gbinder-python] bullseye* ± 

so then the version 0.0.0 is wrong. Any way to fix?

@dreamcat4
Copy link

ok...
you seem to be missing a manually specified verision string so it defaults to 0.0.0 which might have later on caused apt update to mark the package as held back etc.

So i added 1.1.9 as argument to this line here:

curl https://raw.githubusercontent.com/MrCyjaneK/waydroid-build/main/build_changelog 1.1.9 | bash

Not sure if it's going to 'stay good' after doing subsequent apt-get updates. (but at least it's not 0.0.0 anymore)

@cniw
Copy link
Author

cniw commented May 20, 2022

@dreamcat4 thank you very much for the feedback

it has an error. it says:

it's not errors, it's just debug messages

so then the version 0.0.0 is wrong. Any way to fix?

fixed, use version number get from the gbinder-python repo git tag, now it get version 1.0.0-2

So i added 1.1.9 as argument to this line here:

i presume you're use old libgbinder version as reference cause now it already at 1.1.19 version, keep in mind that libgbinder and gbinder-python is from different repo and use different version

@suoko
Copy link

suoko commented Jun 11, 2022

...
dpkg-buildpackage: info: source package gbinder-python-build-deps
dpkg-buildpackage: info: source version 1.0.0-2+git.202109121608
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Equivs Dummy Package Generator <root@ubu>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --before-build .
 debian/rules clean
dh clean
   dh_clean
error: Found argument '-r' which wasn't expected, or isn't valid in this context

USAGE:
    fd [FLAGS/OPTIONS] [<pattern>] [<path>...]

For more information try --help
dh_clean: error: find .  \( \( \
                \( -path .\*/.git -o -path .\*/.svn -o -path .\*/.bzr -o -path .\*/.hg -o -path .\*/CVS -o -path .\*/.pc -o -path .\*/_darcs \) -prune -o -type f -a \
                \( -name '#*#' -o -name '.*~' -o -name '*~' -o -name DEADJOE \
                 -o -name '*.orig' -o -name '*.rej' -o -name '*.bak' \
                 -o -name '.*.orig' -o -name .*.rej -o -name '.SUMS' \
                 -o -name TAGS -o \( -path '*/.deps/*' -a -name '*.P' \) \
                \) -exec rm -f {} + \) -o \
                \( -type d -a -name autom4te.cache -prune -exec rm -rf {} + \) \) returned exit code 1
make: *** [debian/rules:3: clean] Error 1
dpkg-buildpackage: error: debian/rules clean subprocess returned exit status 2
Error in the build process: exit status 2
dpkg: error: cannot access archive 'gbinder-python-build-deps_1.0.0-2+git.202109121608_all.deb': No such file or directory
mk-build-deps: dpkg --unpack failed
 dpkg-buildpackage -us -uc -ui -b

@cniw
Copy link
Author

cniw commented Jun 11, 2022

error: Found argument '-r' which wasn't expected, or isn't valid in this context

USAGE:
fd [FLAGS/OPTIONS] [] [...]

For more information try --help
dh_clean: error: find . ( ( \

@suoko I guess it's because you're using the fd command instead of ordinary find maybe use alias or something like that but the -r option doesn't provided in the fd command, so please try to unset their alias.

@whipplej5
Copy link

how to run this script:

curl -s https://gist.githubusercontent.com/cniw/7a0220ce8b75368f7f57aa422d3fea97/raw | bash

copy this line, paste in your terminal then press enter to run

I tried running this on a fresh Mobian bookworm install on a 128G SD card on a Pinephone Pro. It filled the whole card and then the system crashed due to no disk space.

I thought maybe I did something wrong so reflashed the SD and tried again..... same results. I guess it needs more than 128 G to run this script? Or am I doing something wrong?

@cniw
Copy link
Author

cniw commented Jun 26, 2022

I tried running this on a fresh Mobian bookworm install on a 128G SD card on a Pinephone Pro. It filled the whole card and then the system crashed due to no disk space.

check disk usage with df

df -h | grep -E "Filesystem|^/dev"

or for more details use apps like ncdu or gdu

sudo apt install -y gdu
sudo gdu -d  # to select the partition, use keyboard arrow key to navigate and `q` key to quit
sudo gdu /   # to scan all

I guess it needs more than 128 G to run this script?

no, i think it just need couple KB for gbinder-python source and still less than 250MB for all build deps package and build disk space requirement

Or am I doing something wrong?

i don't know

@whipplej5 btw does the script running or stuck on which step?

@whipplej5
Copy link

whipplej5 commented Jun 26, 2022

I tried running this on a fresh Mobian bookworm install on a 128G SD card on a Pinephone Pro. It filled the whole card and then the system crashed due to no disk space.

check disk usage with df

df -h | grep -E "Filesystem|^/dev"

or for more details use apps like ncdu or gdu

sudo apt install -y gdu
sudo gdu -d  # to select the partition, use keyboard arrow key to navigate and `q` key to quit
sudo gdu /   # to scan all

I guess it needs more than 128 G to run this script?

no, i think it just need couple KB for gbinder-python source and still less than 250MB for all build deps package and build disk space requirement

Or am I doing something wrong?

i don't know

@whipplej5 btw does the script running or stuck on which step?

My apologies. I failed to expand the partitions after I flashed the SD card so was not utilizing the whole card. I should have looked into this further before requesting help. Thanks so much for your time.

@SoulInfernoDE
Copy link

Hey thanks for the script. Unfortunately it didn't work on linux mint 21.1 (ubuntu 22.04) so i tried to fix some errors which now seems to work for me at least.

🔗 install_waydroid.sh : fixed

@38github
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment