Alexpux / MSYS2-pacman

MSYS2 port of Arch Linux packman package manager.
GNU General Public License v2.0
164 stars 34 forks source link

Manually Install Pacman Binaries #50

Closed AntumDeluge closed 6 years ago

AntumDeluge commented 6 years ago

I'm sorry that this may not be directly related to the MSYS2 project. But I'm hoping I can get some insight here since I am working with an MSYS/MinGW environment.

I have installed Git for Windows on Windows 10 64-bit, & I'm trying to figure out if it's possible to use pacman from MSYS2 project with it. Turns out, Git for Windows comes with a MinGW/MSYS environment, but no package manager. I'd prefer to only have one MSYS environment on my system. If worse comes worst, I'll just uninstall Git for Windows & create a regular MSYS2 environment. But if I can, I'd like the try & use pacman with my current Git/MinGW/MSYS environment.

I downloaded the latest 64-bit MSYS2 tarball package & extracted its contents. I've copied the /usr/bin/pacman.exe executable, /var & /etc/pacman.d directories, & /etc/pacman.conf file to the Git/MSYS environment.

I turned off my firewall & opened the MinTTY/Bash terminal that came with Git using administrative privileges. I ran pacman & got some complaints. I don't remember what the original complaints were, but I ended up doing the following to try & add the MSYS2 public PGP key as trusted:

# gpg --recv-keys 5F92EFC1A47D45A1
gpg: requesting key A47D45A1 from hkp server keys.gnupg.net
gpg: key A47D45A1: public key "Alexey Pavlov (Alexpux) <alexpux@gmail.com>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1

# gpg --list-keys
/c/Users/antum/.gnupg/pubring.gpg
---------------------------------
pub   2048D/A47D45A1 2013-11-11
uid                  Alexey Pavlov (Alexpux) <alexpux@gmail.com>
sub   2048g/31CF7700 2013-11-11

# gpg --edit-key Alexpux
gpg (GnuPG) 1.4.22; Copyright (C) 2015 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

pub  2048D/A47D45A1  created: 2013-11-11  expires: never       usage: SC
                     trust: unknown       validity: unknown
sub  2048g/31CF7700  created: 2013-11-11  expires: never       usage: E
[ unknown] (1). Alexey Pavlov (Alexpux) <alexpux@gmail.com>

gpg> trust
pub  2048D/A47D45A1  created: 2013-11-11  expires: never       usage: SC
                     trust: unknown       validity: unknown
sub  2048g/31CF7700  created: 2013-11-11  expires: never       usage: E
[ unknown] (1). Alexey Pavlov (Alexpux) <alexpux@gmail.com>

Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)

  1 = I don't know or won't say
  2 = I do NOT trust
  3 = I trust marginally
  4 = I trust fully
  5 = I trust ultimately
  m = back to the main menu

Your decision? 5
Do you really want to set this key to ultimate trust? (y/N) y

pub  2048D/A47D45A1  created: 2013-11-11  expires: never       usage: SC
                     trust: ultimate      validity: unknown
sub  2048g/31CF7700  created: 2013-11-11  expires: never       usage: E
[ unknown] (1). Alexey Pavlov (Alexpux) <alexpux@gmail.com>
Please note that the shown key validity is not necessarily correct
unless you restart the program.

gpg> quit

# gpg --list-keys
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
/c/Users/antum/.gnupg/pubring.gpg
---------------------------------
pub   2048D/A47D45A1 2013-11-11
uid                  Alexey Pavlov (Alexpux) <alexpux@gmail.com>
sub   2048g/31CF7700 2013-11-11

pacman-key --init
gpg: /etc/pacman.d/gnupg/trustdb.gpg: trustdb created
gpg: no ultimately trusted keys found
gpg: Generating pacman keyring master key...
gpg: skipping control `%no-protection' ()
.......+++++
+++++
gpg: key 7431EEEA marked as ultimately trusted
gpg: Done
==> Updating trust database...
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u

# pacman -Syu
warning: Public keyring not found; have you run 'pacman-key --init'?
error: mingw32: key "5F92EFC1A47D45A1" is unknown
error: key "5F92EFC1A47D45A1" could not be looked up remotely
error: mingw64: key "5F92EFC1A47D45A1" is unknown
error: key "5F92EFC1A47D45A1" could not be looked up remotely
error: msys: key "5F92EFC1A47D45A1" is unknown
error: key "5F92EFC1A47D45A1" could not be looked up remotely
error: no operation specified (use -h for help)

Not sure how to get it to accept the key. Something is missing or not set up right. I may ask for help over at the Git project as well.

EDIT: It was suggested to me to use pacman-key for adding the public key because pacman uses its own keyring. So, I did the following but am still getting the same error:

# pacman-key --recv-keys 5F92EFC1A47D45A1
gpg: requesting key A47D45A1 from hkp server pool.sks-keyservers.net
gpg: key A47D45A1: public key "Alexey Pavlov (Alexpux) <alexpux@gmail.com>" imported
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: Total number processed: 1
gpg:               imported: 1
==> Updating trust database...
gpg: no need for a trustdb check

# pacman-key --edit-key Alexpux

pub  2048D/A47D45A1  created: 2013-11-11  expires: never       usage: SC
                     trust: unknown       validity: unknown
sub  2048g/31CF7700  created: 2013-11-11  expires: never       usage: E
[ unknown] (1). Alexey Pavlov (Alexpux) <alexpux@gmail.com>

gpg> trust
pub  2048D/A47D45A1  created: 2013-11-11  expires: never       usage: SC
                     trust: unknown       validity: unknown
sub  2048g/31CF7700  created: 2013-11-11  expires: never       usage: E
[ unknown] (1). Alexey Pavlov (Alexpux) <alexpux@gmail.com>

Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)

  1 = I don't know or won't say
  2 = I do NOT trust
  3 = I trust marginally
  4 = I trust fully
  5 = I trust ultimately
  m = back to the main menu

Your decision? 5
Do you really want to set this key to ultimate trust? (y/N) y

pub  2048D/A47D45A1  created: 2013-11-11  expires: never       usage: SC
                     trust: ultimate      validity: unknown
sub  2048g/31CF7700  created: 2013-11-11  expires: never       usage: E
[ unknown] (1). Alexey Pavlov (Alexpux) <alexpux@gmail.com>
Please note that the shown key validity is not necessarily correct
unless you restart the program.

gpg> quit
==> Updating trust database...
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   2  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 2u

# pacman-key --list-keys
/etc/pacman.d/gnupg/pubring.gpg
-------------------------------
pub   2048R/7431EEEA 2017-12-24
uid                  Pacman Keyring Master Key <pacman@localhost>

pub   2048D/A47D45A1 2013-11-11
uid                  Alexey Pavlov (Alexpux) <alexpux@gmail.com>
sub   2048g/31CF7700 2013-11-11

# pacman -Syu
warning: Public keyring not found; have you run 'pacman-key --init'?
error: mingw32: key "5F92EFC1A47D45A1" is unknown
error: key "5F92EFC1A47D45A1" could not be looked up remotely
error: mingw64: key "5F92EFC1A47D45A1" is unknown
error: key "5F92EFC1A47D45A1" could not be looked up remotely
error: msys: key "5F92EFC1A47D45A1" is unknown
error: key "5F92EFC1A47D45A1" could not be looked up remotely
error: no operation specified (use -h for help)

EDIT: Found a little more info here. I deleted /etc/pacman.d/gnupg & copied /usr/share/pacman directory from extracted MSYS2 package to Git/MSYS environment, then ran the following:

# pacman-key --init
gpg: /etc/pacman.d/gnupg/trustdb.gpg: trustdb created
gpg: no ultimately trusted keys found
gpg: Generating pacman keyring master key...
gpg: skipping control `%no-protection' ()
+++++
...+++++
gpg: key 2C176BB2 marked as ultimately trusted
gpg: Done
==> Updating trust database...
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u

# pacman-key --populate msys2
==> Appending keys from msys2.gpg...
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
==> Locally signing trusted keys in keyring...
  -> Locally signing key D55E7A6D7CE9BA1587C0ACACF40D263ECA25678A...
  -> Locally signing key 123D4D51A1793859C2BE916BBBE514E53E0D0813...
  -> Locally signing key B91BCF3303284BF90CC043CA9F418C233E652008...
  -> Locally signing key 9DD0D4217D75A33B896159E6DA7EF2ABAEEA755C...
==> Importing owner trust values...
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: inserting ownertrust of 4
==> Updating trust database...
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   4  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: depth: 1  valid:   4  signed:   3  trust: 0-, 0q, 0n, 4m, 0f, 0u
gpg: depth: 2  valid:   3  signed:   0  trust: 3-, 0q, 0n, 0m, 0f, 0u

# pacman-key --refresh-keys
gpg: refreshing 8 keys from hkp://pool.sks-keyservers.net
gpg: requesting key 2C176BB2 from hkp server pool.sks-keyservers.net
gpg: requesting key CA25678A from hkp server pool.sks-keyservers.net
gpg: requesting key AEEA755C from hkp server pool.sks-keyservers.net
gpg: requesting key 3E0D0813 from hkp server pool.sks-keyservers.net
gpg: requesting key 3E652008 from hkp server pool.sks-keyservers.net
gpg: requesting key A47D45A1 from hkp server pool.sks-keyservers.net
gpg: requesting key 2C51581E from hkp server pool.sks-keyservers.net
gpg: requesting key 4CA56930 from hkp server pool.sks-keyservers.net
gpgkeys: key 30E6F43BF83E664B7D534995568B2E4B2C176BB2 not found on keyserver
gpg: key CA25678A: "Alexey Pavlov (Alexpux) <alexey.pawlow@gmail.com>" 4 new signatures
gpg: key AEEA755C: "Martell Malone (martell) <martellmalone@gmail.com>" 3 new signatures
gpg: key 3E0D0813: "Ray Donnelly (MSYS2 Developer - master key) <mingw.android@gmail.com>" 2 new signatures
gpg: key 3E652008: "Ignacio Casal Quinteiro <icquinteiro@gmail.com>" 2 new signatures
gpg: key A47D45A1: "Alexey Pavlov (Alexpux) <alexpux@gmail.com>" 1 new signature
gpg: key 2C51581E: "Martell Malone (MSYS2 Developer) <martellmalone@gmail.com>" not changed
gpg: key 4CA56930: "Ray Donnelly (MSYS2 Developer) <mingw.android@gmail.com>" 2 new signatures
gpg: Total number processed: 7
gpg:              unchanged: 1
gpg:         new signatures: 14
gpg: keyserver communications error: key not found
gpg: keyserver communications error: bad public key
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   4  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: depth: 1  valid:   4  signed:   3  trust: 0-, 0q, 0n, 4m, 0f, 0u
gpg: depth: 2  valid:   3  signed:   0  trust: 3-, 0q, 0n, 0m, 0f, 0u
gpg: keyserver refresh failed: bad public key
==> ERROR: A specified local key could not be updated from a keyserver.

Error persists, but now all keys for MSYS2 are added to keyring:

# pacman-key --list-keys
/etc/pacman.d/gnupg/pubring.gpg
-------------------------------
pub   2048R/E5F3307F 2017-12-24
uid                  Pacman Keyring Master Key <pacman@localhost>

pub   2048R/CA25678A 2014-09-28
uid                  Alexey Pavlov (Alexpux) <alexey.pawlow@gmail.com>
sub   2048R/2BBF340E 2014-09-28

pub   4096R/AEEA755C 2014-10-04
uid                  Martell Malone (martell) <martellmalone@gmail.com>
sub   4096R/2A292C03 2014-10-04

pub   4096R/3E0D0813 2014-09-28
uid                  Ray Donnelly (MSYS2 Developer - master key) <mingw.android@gmail.com>
sub   4096R/8603AA9D 2014-09-28

pub   2048R/3E652008 2014-09-29
uid                  Ignacio Casal Quinteiro <icquinteiro@gmail.com>
sub   2048R/64D62A76 2014-09-29

pub   2048D/A47D45A1 2013-11-11
uid                  Alexey Pavlov (Alexpux) <alexpux@gmail.com>
sub   2048g/31CF7700 2013-11-11

pub   4096R/2C51581E 2015-07-22
uid                  Martell Malone (MSYS2 Developer) <martellmalone@gmail.com>
sub   4096R/282D6707 2015-07-22

pub   4096R/4CA56930 2014-09-28
uid                  Ray Donnelly (MSYS2 Developer) <mingw.android@gmail.com>
sub   4096R/576CF231 2014-09-28
AntumDeluge commented 6 years ago

Was able to get it to work by downloading the binary pacman package & manually installing all its contents to Git/MSYS environment. Then doing the steps above (Note: /usr/share/pacman/keyrings had to be copied from another MSYS2 environment):

Initialize keyring: $ pacman-key --init

Reload the default keys from /usr/share/pacman/keyrings: $ pacman-key --populate msys2

Update keys from a keyserver: $ pacman-key --refresh-keys

Force update packages: $ pacman -Syu --force

Now pacman works correctly. But need to use --force parameter to overwrite package files previously installed by Git installer.

To make sure correct packages are re-installed, do the following (credit to Mefju in this thread post): $ for PKG in $(pacman -Q | cut -d' ' -f1); do pacman -S --force --noconfirm "${PKG}"; done"

evandrocoan commented 4 years ago

Thanks @AntumDeluge for your steps! I just used them to install pacman in my Git for windows hosted on the new GitHub Actions. The only thing I could not do was your last step asking to run $ for PKG in $(pacman -Q | ... because on my system pacman -Q returns empty. Because of this, I have to always install the packages with pacman -S --overwrite='*' (The --force parameter for pacman was deprecated in favor of this --overwrite thing).

Another different thing I did was to download the mirrors list and the keyrings directly from the msys2 repository and unpack them directly on the %programfiles%\Git directory. So, I do not need another msys2 installation to copy them from.

I also suggested to them to ship Git for windows SDK instead of just the standard Git for windows with no a package manager, so they can stop installing the mingw environment with choco install mingw (another thing which does not have a package manager!).

This is the script/steps I used for the GitHub Actions:

jobs:
  test:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - name: Configure environment variables
        run: |
          echo "::set-env name=pacmanbin::pacman-5.1.1-3-x86_64.pkg.tar.xz"
          echo "::set-env name=pacmanmirror::pacman-mirrors-20200307-1-any.pkg.tar.xz"
          echo "::set-env name=pacmankeys::msys2-keyring-r9.397a52e-1-any.pkg.tar.xz"
      - name: Set up pacman, rsync, rename
        shell: cmd
        run: |
          echo on
          curl -LO http://repo.msys2.org/msys/x86_64/%pacmanbin%
          curl -LO http://repo.msys2.org/msys/x86_64/%pacmanmirror%
          curl -LO http://repo.msys2.org/msys/x86_64/%pacmankeys%

          :: https://stackoverflow.com/questions/1359793/programmatically-extract-tar-gz
          7z x "%pacmanbin%" -so | 7z x -aoa -si -ttar -o"%programfiles%\Git"
          7z x "%pacmanmirror%" -so | 7z x -aoa -si -ttar -o"%programfiles%\Git"
          7z x "%pacmankeys%" -so | 7z x -aoa -si -ttar -o"%programfiles%\Git"

          set "PATH=%programfiles%\Git\usr\bin"
          bash pacman-key --init
          bash pacman-key --populate msys2
          bash pacman-key --refresh-keys
          pacman -Tv
          pacman -Syuv --overwrite='*'

          :: We must install bash first, otherwise we will have bash fork errors:
          :: https://github.com/evandroforks/anki/runs/524857054?check_suite_focus=true
          :: 0 [main] pacman 748 dofork: child -1 - forked process 2896 died unexpectedly
          pacman --version
          pacman -Sv --noconfirm --overwrite='*' bash 
          pacman -Sv --noconfirm --overwrite='*' rsync
          pacman -Sv --noconfirm --overwrite='*' util-linux

          :: clean all packages to decrease image size
          pacman -Sccv --noconfirm 

Here are the relevant log results from a clean/working installation https://github.com/evandroforks/anki/runs/524866924?check_suite_focus=true#step:5:199

``` D:\a\anki\anki>curl -LO http://repo.msys2.org/msys/x86_64/pacman-5.1.1-3-x86_64.pkg.tar.xz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 12.8M 0 103k 0 0 103k 0 0:02:06 --:--:-- 0:02:06 415k 100 12.8M 100 12.8M 0 0 12.8M 0 0:00:01 --:--:-- 0:00:01 22.2M D:\a\anki\anki>curl -LO http://repo.msys2.org/msys/x86_64/pacman-mirrors-20200307-1-any.pkg.tar.xz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 20440 100 20440 0 0 20440 0 0:00:01 --:--:-- 0:00:01 159k D:\a\anki\anki>curl -LO http://repo.msys2.org/msys/x86_64/msys2-keyring-r9.397a52e-1-any.pkg.tar.xz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 19348 100 19348 0 0 19348 0 0:00:01 --:--:-- 0:00:01 120k D:\a\anki\anki>7z x "pacman-5.1.1-3-x86_64.pkg.tar.xz" -so | 7z x -aoa -si -ttar -o"C:\Program Files\Git" 7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21 Extracting archive: -- Path = Type = tar Code Page = UTF-8 Everything is Ok Folders: 125 Files: 309 Size: 47296964 Compressed: 227840 D:\a\anki\anki>7z x "pacman-mirrors-20200307-1-any.pkg.tar.xz" -so | 7z x -aoa -si -ttar -o"C:\Program Files\Git" 7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21 Extracting archive: -- Path = Type = tar Code Page = UTF-8 Everything is Ok Folders: 2 Files: 6 Size: 173477 Compressed: 10240 D:\a\anki\anki>7z x "msys2-keyring-r9.397a52e-1-any.pkg.tar.xz" -so | 7z x -aoa -si -ttar -o"C:\Program Files\Git" 7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21 Extracting archive: -- Path = Type = tar Code Page = UTF-8 Everything is Ok Folders: 4 Files: 6 Size: 25450 Compressed: 13824 D:\a\anki\anki>cd /d "C:\Program Files\Git\usr\bin" C:\Program Files\Git\usr\bin>.\bash pacman-key --init gpg: /etc/pacman.d/gnupg/trustdb.gpg: trustdb created gpg: no ultimately trusted keys found gpg: starting migration from earlier GnuPG versions gpg: porting secret keys from '/etc/pacman.d/gnupg/secring.gpg' to gpg-agent gpg: migration succeeded gpg: Generating pacman keyring master key... gpg: key 0229B1960D28EAA4 marked as ultimately trusted gpg: directory '/etc/pacman.d/gnupg/openpgp-revocs.d' created gpg: revocation certificate stored as '/etc/pacman.d/gnupg/openpgp-revocs.d/A9D51AE9895C8D32D04EB2C00229B1960D28EAA4.rev' gpg: Done ==> Updating trust database... gpg: marginals needed: 3 completes needed: 1 trust model: pgp gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u C:\Program Files\Git\usr\bin>.\bash pacman-key --populate msys2 ==> Appending keys from msys2.gpg... ==> Locally signing trusted keys in keyring... -> Locally signing key D55E7A6D7CE9BA1587C0ACACF40D263ECA25678A... -> Locally signing key 123D4D51A1793859C2BE916BBBE514E53E0D0813... -> Locally signing key B91BCF3303284BF90CC043CA9F418C233E652008... -> Locally signing key 9DD0D4217D75A33B896159E6DA7EF2ABAEEA755C... ==> Importing owner trust values... gpg: setting ownertrust to 4 gpg: setting ownertrust to 4 gpg: setting ownertrust to 4 gpg: inserting ownertrust of 4 ==> Updating trust database... gpg: marginals needed: 3 completes needed: 1 trust model: pgp gpg: depth: 0 valid: 1 signed: 4 trust: 0-, 0q, 0n, 0m, 0f, 1u gpg: depth: 1 valid: 4 signed: 3 trust: 0-, 0q, 0n, 4m, 0f, 0u gpg: depth: 2 valid: 3 signed: 0 trust: 3-, 0q, 0n, 0m, 0f, 0u C:\Program Files\Git\usr\bin>.\bash pacman-key --refresh-keys gpg: refreshing 8 keys from hkps://hkps.pool.sks-keyservers.net gpg: key 4DF3B7664CA56930: "Ray Donnelly (MSYS2 Developer) " not changed gpg: key D595C9AB2C51581E: "Martell Malone (MSYS2 Developer) " not changed gpg: key 5F92EFC1A47D45A1: "Alexey Pavlov (Alexpux) " not changed gpg: key 9F418C233E652008: "Ignacio Casal Quinteiro " not changed gpg: key BBE514E53E0D0813: "Ray Donnelly (MSYS2 Developer - master key) " not changed gpg: key DA7EF2ABAEEA755C: "Martell Malone (martell) " not changed gpg: key F40D263ECA25678A: "Alexey Pavlov (Alexpux) " not changed gpg: Total number processed: 7 gpg: unchanged: 7 C:\Program Files\Git\usr\bin>.\pacman -Tv warning: database file for 'mingw32' does not exist (use '-Sy' to download) warning: database file for 'mingw64' does not exist (use '-Sy' to download) warning: database file for 'msys' does not exist (use '-Sy' to download) Root : / Conf File : /etc/pacman.conf DB Path : /var/lib/pacman/ Cache Dirs: /var/cache/pacman/pkg/ Hook Dirs : /usr/share/libalpm/hooks/ /etc/pacman.d/hooks/ Lock File : /var/lib/pacman/db.lck Log File : /var/log/pacman.log GPG Dir : /etc/pacman.d/gnupg/ Targets : None C:\Program Files\Git\usr\bin>.\pacman -Syuv Root : / Conf File : /etc/pacman.conf DB Path : /var/lib/pacman/ Cache Dirs: /var/cache/pacman/pkg/ Hook Dirs : /usr/share/libalpm/hooks/ /etc/pacman.d/hooks/ Lock File : /var/lib/pacman/db.lck Log File : /var/log/pacman.log GPG Dir : /etc/pacman.d/gnupg/ Targets : None :: Synchronizing package databases... downloading mingw32.db... downloading mingw32.db.sig... downloading mingw64.db... downloading mingw64.db.sig... downloading msys.db... downloading msys.db.sig... :: Starting core system upgrade... there is nothing to do :: Starting full system upgrade... there is nothing to do C:\Program Files\Git\usr\bin>.\pacman -Sv --noconfirm --overwrite='*' bash Root : / Conf File : /etc/pacman.conf DB Path : /var/lib/pacman/ Cache Dirs: /var/cache/pacman/pkg/ Hook Dirs : /usr/share/libalpm/hooks/ /etc/pacman.d/hooks/ Lock File : /var/lib/pacman/db.lck Log File : /var/log/pacman.log GPG Dir : /etc/pacman.d/gnupg/ Targets : bash resolving dependencies... looking for conflicting packages... Packages (2) msys2-runtime-3.0.7-6 bash-4.4.023-2 Total Download Size: 4.45 MiB Total Installed Size: 21.69 MiB :: Proceed with installation? [Y/n] :: Retrieving packages... downloading msys2-runtime-3.0.7-6-x86_64.pkg.tar.xz... downloading bash-4.4.023-2-x86_64.pkg.tar.xz... checking keyring... checking package integrity... loading package files... checking for file conflicts... checking available disk space... :: Processing package changes... installing msys2-runtime... installing bash... C:\Program Files\Git\usr\bin>.\pacman -Sv --noconfirm --overwrite='*' rsync Root : / Conf File : /etc/pacman.conf DB Path : /var/lib/pacman/ Cache Dirs: /var/cache/pacman/pkg/ Hook Dirs : /usr/share/libalpm/hooks/ /etc/pacman.d/hooks/ Lock File : /var/lib/pacman/db.lck Log File : /var/log/pacman.log GPG Dir : /etc/pacman.d/gnupg/ Targets : rsync resolving dependencies... looking for conflicting packages... Packages (14) coreutils-8.32-1 db-5.3.28-2 gcc-libs-9.1.0-2 gdbm-1.18.1-2 gmp-6.2.0-1 libcrypt-2.1-2 libdb-5.3.28-2 libgdbm-1.18.1-2 libiconv-1.16-1 libintl-0.19.8.1-1 libreadline-8.0.004-1 ncurses-6.2-1 perl-5.30.1-1 rsync-3.1.3-1 Total Download Size: 21.02 MiB Total Installed Size: 96.87 MiB :: Proceed with installation? [Y/n] :: Retrieving packages... downloading gcc-libs-9.1.0-2-x86_64.pkg.tar.xz... downloading libdb-5.3.28-2-x86_64.pkg.tar.xz... downloading db-5.3.28-2-x86_64.pkg.tar.xz... downloading ncurses-6.2-1-x86_64.pkg.tar.xz... downloading libreadline-8.0.004-1-x86_64.pkg.tar.xz... downloading libgdbm-1.18.1-2-x86_64.pkg.tar.xz... downloading gdbm-1.18.1-2-x86_64.pkg.tar.xz... downloading libcrypt-2.1-2-x86_64.pkg.tar.xz... downloading gmp-6.2.0-1-x86_64.pkg.tar.xz... downloading libiconv-1.16-1-x86_64.pkg.tar.xz... downloading libintl-0.19.8.1-1-x86_64.pkg.tar.xz... downloading coreutils-8.32-1-x86_64.pkg.tar.xz... downloading perl-5.30.1-1-x86_64.pkg.tar.xz... downloading rsync-3.1.3-1-x86_64.pkg.tar.xz... checking keyring... checking package integrity... loading package files... checking for file conflicts... checking available disk space... :: Processing package changes... installing gcc-libs... installing libdb... installing db... installing ncurses... installing libreadline... installing libgdbm... installing gdbm... installing libcrypt... installing gmp... installing libiconv... installing libintl... installing coreutils... installing perl... installing rsync... C:\Program Files\Git\usr\bin>.\pacman -Sv --noconfirm --overwrite='*' util-linux Root : / Conf File : /etc/pacman.conf DB Path : /var/lib/pacman/ Cache Dirs: /var/cache/pacman/pkg/ Hook Dirs : /usr/share/libalpm/hooks/ /etc/pacman.d/hooks/ Lock File : /var/lib/pacman/db.lck Log File : /var/log/pacman.log GPG Dir : /etc/pacman.d/gnupg/ Targets : util-linux resolving dependencies... looking for conflicting packages... Packages (2) libutil-linux-2.35-1 util-linux-2.35-1 Total Download Size: 1.71 MiB Total Installed Size: 9.63 MiB :: Proceed with installation? [Y/n] :: Retrieving packages... downloading libutil-linux-2.35-1-x86_64.pkg.tar.xz... downloading util-linux-2.35-1-x86_64.pkg.tar.xz... checking keyring... checking package integrity... loading package files... checking for file conflicts... checking available disk space... :: Processing package changes... installing libutil-linux... installing util-linux... ```


### Update After seeing (https://github.com/actions/virtual-environments/pull/585 - Install MSYS2 to Windows), now I am using `set "PATH=%programfiles%\Git\usr\bin"` because sub-bash calls by bash could be using other bashes on the system PATH. ### Update 2021-10-22 It seems that now pacman uses the format zst: 1. `curl -O http://repo.msys2.org/msys/x86_64/pacman-mirrors-20210902-1-any.pkg.tar.zst` (https://www.msys2.org/news/#2020-06-29-new-packagers) 1. `tar -I zstd -xvf pacman-mirrors-20210902-1-any.pkg.tar.zst -C /` or `pacman -U pacman-mirrors-20210902-1-any.pkg.tar.zst` (https://stackoverflow.com/questions/45355277/how-can-i-decompress-an-archive-file-having-zst-or-tar-zst) Fix the error `error: libevent-devel: signature from "David Macek " is unknown trust` (https://github.com/msys2/MSYS2-packages/issues/2343#issuecomment-941815336) 1. `pacman -Syu` (and cancel upgrade with n) 1. `rm -rf /etc/packman.d/gnupg` 1. `pacman-key --init` 1. `pacman -S msys2-keyring` 1. `pacman-key --populate msys2` Installing tmux: ``` git clone https://github.com/msys2/MSYS2-packages/ cd MSYS2-packages/tmux vim PKGBUILD # and replace `_base_ver=3.2` by `master` # and replace the first line of `sha256sums=('29123123...'` # by the sha256 of the file https://github.com/tmux/tmux/archive/master.tar.gz makepkg pacman -U tmux-master-1-x86_64.pkg.tar.zst ``` Example of `tmux/PKGBUILD` ``` # Maintainer: Alexey Pavlov pkgname=tmux _base_ver=9ea971dc046ed1c5f241cf1f7b91b3a16e049225 _bugfix= pkgver=${_base_ver}${_bugfix} pkgrel=1 pkgdesc='A terminal multiplexer' url='https://tmux.github.io/' arch=('i686' 'x86_64') license=('BSD') conflict=('tmux-git') replaces=('tmux-git') depends=('ncurses' 'libevent') makedepends=('ncurses-devel' 'libevent-devel') source=(${pkgname}-${pkgver}.tar.gz::https://github.com/tmux/tmux/archive/${_base_ver}${_bugfix/./}.tar.gz 'msys-platform.patch' 'no-check-dirs-permission.patch' 'inherit-msystem-var.patch') sha256sums=('33edcc1523436ff9e0c24d1556b6fd31ff95f7fcf6501693b99c288d748604ec' 'cf7e0f642d43fc97f7c55be41c693cceab5c891f81fcee687e918075e55cd533' '8f1938c9bcb99fba5441e11379a193c17eee582a03c04f1bde8089d58a84f44f' 'aeaea034eeefe9598a56ebfabdf21cb991b2ac39d62dca9f857d24e5bc375366') prepare() { cd "${srcdir}/${pkgname}-${_base_ver}${_bugfix/./}" patch -p1 -i "${srcdir}"/msys-platform.patch patch -p0 -i "${srcdir}"/no-check-dirs-permission.patch patch -p0 -i "${srcdir}"/inherit-msystem-var.patch cp osdep-cygwin.c osdep-msys.c #msg2 "Running autogen.sh" ./autogen.sh } build() { cd "${srcdir}/${pkgname}-${_base_ver}${_bugfix/./}" ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ CPPFLAGS="${CPPFLAGS} -I/usr/include/ncursesw -U_XOPEN_SOURCE" make } package() { cd "${srcdir}/${pkgname}-${_base_ver}${_bugfix/./}" make DESTDIR="${pkgdir}" install install -d "${pkgdir}"/usr/share/licenses/tmux install -m 644 COPYING "${pkgdir}"/usr/share/licenses/tmux #install -d "${pkgdir}"/usr/share/tmux #install -m 644 examples/* "${pkgdir}"/usr/share/tmux #install -d "${pkgdir}"/usr/share/vim/vimfiles/syntax #install -m 644 examples/tmux.vim "${pkgdir}"/usr/share/vim/vimfiles/syntax #install -d "${pkgdir}"/usr/share/bash-completion/completions/tmux #mv "${pkgdir}"/usr/share/tmux/bash_completion_tmux.sh "${pkgdir}"/usr/share/bash-completion/completions/tmux } ```