You are not logged in.

#1 2021-04-18 20:00:16

gwpl
Member
From: Warsaw, Poland
Registered: 2010-07-10
Posts: 28

Docker+AUR with pacaur ?

Hi!

I wanted to install aur packages in Docker images of Archlinux.

I tried to use pacaur with failure. When I tried to install dependencies my install failes on step

WORKDIR /home/packager/
RUN git clone https://aur.archlinux.org/pod2man.git
WORKDIR /home/packager/pod2man/
RUN makepkg -i --noconfirm

Resulting in

Step 13/28 : RUN git clone https://aur.archlinux.org/pod2man.git
 ---> Running in 2fe5f29d797a
Cloning into 'pod2man'...
Removing intermediate container 2fe5f29d797a
 ---> 02164f87fbd2
Step 14/28 : WORKDIR /home/packager/pod2man/
 ---> Running in 66a8248f75f7
Removing intermediate container 66a8248f75f7
 ---> 205543cf9f95
Step 15/28 : RUN makepkg -i --noconfirm
 ---> Running in 29ba2fd6e158
==> Making package: pod2man 5.30.2-1 (Sun 18 Apr 2021 07:54:18 PM UTC)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
==> Extracting sources...
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
  -> Removing libtool files...
  -> Purging unwanted files...
  -> Removing static library files...
  -> Stripping unneeded symbols from binaries and libraries...
  -> Compressing man and info pages...
==> Checking for packaging issues...
==> Creating package "pod2man"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: pod2man 5.30.2-1 (Sun 18 Apr 2021 07:54:19 PM UTC)
==> Installing package pod2man with pacman -U...

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
==> WARNING: Failed to install built package(s).
The command '/bin/sh -c makepkg -i --noconfirm' returned a non-zero code: 14

Here is code of full Dockerfile:

FROM archlinux:latest
RUN pacman -Syyu --noconfirm
RUN pacman -S --noconfirm git 
RUN pacman -S --noconfirm vim screen
RUN pacman -S --noconfirm base-devel
RUN pacman -S --noconfirm go go-tools
RUN pacman -S --noconfirm wget aria2 mc cmatrix htop vim
RUN git clone https://aur.archlinux.org/pacaur.git

#RUN set -x ; mkdir /home/nobody && chown -v nobody:nobody /home/nobody && cd /home/nobody/ && sudo -u nobody git clone https://aur.archlinux.org/pacaur.git && cd pacaur/ && sudo -u nobody makepkg -si

# set up the packager user
RUN useradd --create-home packager
#COPY bashrc.sh /home/packager/.bashrc
#COPY packager-actions /etc/sudoers.d/

RUN pacman -S --noconfirm meson gtest gmock
#RUN pacman -S --noconfirm

USER packager

WORKDIR /home/packager/
RUN git clone https://aur.archlinux.org/pod2man.git
WORKDIR /home/packager/pod2man/
RUN makepkg -i --noconfirm

WORKDIR /home/packager/
RUN git clone https://aur.archlinux.org/auracle-git.git
WORKDIR /home/packager/auracle-git/
RUN makepkg -i --noconfirm

WORKDIR /home/packager/
RUN git clone https://aur.archlinux.org/pacaur.git
WORKDIR /home/packager/pacaur/
RUN makepkg -i --noconfirm

WORKDIR /home/packager/
RUN pacaur -S --noconfirm gotty   # https://aur.archlinux.org/packages/gotty/

USER root


EXPOSE 8080
EXPOSE 8123

I commented out some lines after experimentation or that I saw in other tutorials. I hope it's good, as it's "WIP" "Work in Progress" dirty version, so please ignore lines starting with "#" .

and link here: https://gist.github.com/gwpl/be860b7d62 … 94a12b91cf

Last edited by gwpl (2021-04-18 20:32:08)

Offline

#2 2021-04-18 20:24:57

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Docker+AUR with pacaur ?

#COPY packager-actions /etc/sudoers.d/

Was this supposed to do something?


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2021-04-18 21:15:04

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,772

Re: Docker+AUR with pacaur ?

gwpl wrote:

Hi! Thanks for pointing out. I've added clarification, that I've left commented lines ( starting with "#" ) as it's "WIP"/"Work in progress" and may be useful/inspiration or just to be trashed. I hope it's ok and easy to ignore, otherwise I can provide also cleaned up snipped, but I didn't want to make post too long (it's already long).

I think you meant to hit "Reply", not "Report"


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#4 2021-04-18 21:22:43

gwpl
Member
From: Warsaw, Poland
Registered: 2010-07-10
Posts: 28

Re: Docker+AUR with pacaur ?

ewaller wrote:
gwpl wrote:

Hi! Thanks for pointing out. I've added clarification, that I've left commented lines ( starting with "#" ) as it's "WIP"/"Work in progress" and may be useful/inspiration or just to be trashed. I hope it's ok and easy to ignore, otherwise I can provide also cleaned up snipped, but I didn't want to make post too long (it's already long).

I think you meant to hit "Reply", not "Report"

Yes! Thank you! I haven't used phpbb/fluxbb since so long time, and now at the end of weekend clicked things in hurry.

Offline

#5 2021-04-18 21:26:44

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Docker+AUR with pacaur ?

Erm, my point here is that makepkg worked fine, utterly fine, but you have sudo problems.

And you also have commented out code that looks like it was intended to make your makepkg user be permitted to run sudo without a password prompt screwing everything up. What else were you intending to install as a sudoers.d/ drop-in file?

Therefore, my diagnosis on helping you fix your reported problem is "try completing that bit there".

Last edited by eschwartz (2021-04-18 21:27:40)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2021-04-18 21:32:55

gwpl
Member
From: Warsaw, Poland
Registered: 2010-07-10
Posts: 28

Re: Docker+AUR with pacaur ?

Thank you for hint!

Basically My problem is that I don't know what's the "easy" way of installing apps from "AUR" inside Docker containers. And maybe my approach is completely wrong.

Last edited by gwpl (2021-04-18 21:34:29)

Offline

#7 2021-04-18 21:47:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Docker+AUR with pacaur ?

I don't use docker ... at all.  But just inferring from the syntax that is there, I'd suggest dropping the '-i' flag from makepkg so you only *build* the package.  Then after "USER root" and after rerunning "WORKDIR /home/packager/" if necessary, "RUN pacman -U */*.pkg.tar.zst" and forget about sudo all together.  It looks like docker gives you a means with which to run commands as root, so sudo serves no purpose.

Last edited by Trilby (2021-04-18 21:49:45)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2021-04-18 22:26:38

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,845
Website

Re: Docker+AUR with pacaur ?

Mod note: Not an installation issue, moving to AUR Issues.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#9 2021-04-19 20:20:09

gwpl
Member
From: Warsaw, Poland
Registered: 2010-07-10
Posts: 28

Re: Docker+AUR with pacaur ?

Thank you, I agree that it's more AUR issue and how to use `pacaur` inside Dockerfile  at this point.

Offline

#10 2021-04-19 20:22:40

gwpl
Member
From: Warsaw, Poland
Registered: 2010-07-10
Posts: 28

Re: Docker+AUR with pacaur ?

FROM archlinux:latest
RUN pacman -Syyu --noconfirm
RUN pacman -S --noconfirm git 
RUN pacman -S --noconfirm vim screen
RUN pacman -S --noconfirm base-devel
RUN pacman -S --noconfirm go go-tools
RUN pacman -S --noconfirm wget aria2 mc cmatrix htop vim
RUN git clone https://aur.archlinux.org/pacaur.git

#RUN set -x ; mkdir /home/nobody && chown -v nobody:nobody /home/nobody && cd /home/nobody/ && sudo -u nobody git clone https://aur.archlinux.org/pacaur.git && cd pacaur/ && sudo -u nobody makepkg -si

# set up the packager user
RUN useradd --create-home packager
#COPY bashrc.sh /home/packager/.bashrc
#COPY packager-actions /etc/sudoers.d/

RUN pacman -S --noconfirm meson gtest gmock expac jq
#RUN pacman -S --noconfirm

USER packager
WORKDIR /home/packager/
RUN git clone https://aur.archlinux.org/pod2man.git
WORKDIR /home/packager/pod2man/
RUN makepkg --noconfirm
USER root
WORKDIR /home/packager/
RUN pacman --noconfirm -U */*.pkg.tar.zst


USER packager
WORKDIR /home/packager/
RUN git clone https://aur.archlinux.org/auracle-git.git
WORKDIR /home/packager/auracle-git/
RUN makepkg --noconfirm
USER root
WORKDIR /home/packager/
RUN pacman --noconfirm -U */*.pkg.tar.zst


USER packager
WORKDIR /home/packager/
RUN git clone https://aur.archlinux.org/pacaur.git
WORKDIR /home/packager/pacaur/
RUN makepkg --noconfirm
USER root
WORKDIR /home/packager/
RUN pacman --noconfirm -U */*.pkg.tar.zst


USER root
WORKDIR /home/packager/
RUN pacman --noconfirm -U */*.pkg.tar.zst

USER packager
WORKDIR /home/packager/
RUN pacaur -S --noconfirm --noedit gotty
 

EXPOSE 8080
EXPOSE 8123

(also here https://gist.github.com/gwpl/be860b7d62 … 94a12b91cf )


And current output

$ docker build .
<---.... cut ...---->
Step 40/42 : RUN pacaur -S --noconfirm --noedit gotty
 ---> Running in 120c3474732b
:: $VISUAL and $EDITOR environment variables not set or defined editor not found
The command '/bin/sh -c pacaur -S --noconfirm --noedit gotty' returned a non-zero code: 1

I guess I am missing something about using `pacaur` in non interactive way at this point.

Offline

#11 2021-04-19 20:49:30

gwpl
Member
From: Warsaw, Poland
Registered: 2010-07-10
Posts: 28

Re: Docker+AUR with pacaur ?

btw. I've made PR against pacaur with Dockerfile that installs `pacaur` succesfully: https://github.com/E5ten/pacaur/pull/28

and reported issue also in `pacaur` repo https://github.com/E5ten/pacaur/issues/27

Last edited by gwpl (2021-04-19 20:50:30)

Offline

#12 2021-04-19 21:14:42

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Docker+AUR with pacaur ?

So wait - you are building with makepkg and installing with pacman just fine - why are you also trying to use pacaur?

Note, that if you install built packages one at a time, there's no need for the */*.pkg.tar.zst, just specify the packagefile directly.  I just assumed you'd build them all first then install them all in one go.  If any of your AUR packages depend on other AUR packages then you would have to ensure the dependencies were built and installed first.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#13 2021-04-19 22:09:53

gwpl
Member
From: Warsaw, Poland
Registered: 2010-07-10
Posts: 28

Re: Docker+AUR with pacaur ?

Regarding " */*.pkg.tar.zst" -> I want to make this Dockerfile working, not perfect. I would consider optimising this at this point "premature optimisation" as it does not slow down process much to reinstall already build packages in previous stages again.

Packages that I build manually with makepkg I build only because without them `pacaur` does not install - they seem to be dependencies.

Why I want to use packaur ? Becuase I would like later to install more packages, not manually with gitclone+makepkg+pacman multiple stage process, for each dependency, but to have a tool that will download and install all dependencies from arch repos (community,etc..)  and AUR  that are required.
(Maybe I am using wrong tool for the job for Dockerfile container.)

Basically, I am looking for Dockerfile template that will allow me to install AUR packages with convenience (i.e. automatically fetching all dependencies and accepting in non interactive way -> yes, I can later run such thing inside extra layers of isolation for security ).

Have I missed sth in my approach?

Last edited by gwpl (2021-04-19 22:14:44)

Offline

#14 2021-04-20 10:07:50

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: Docker+AUR with pacaur ?

Is that docker templates meant for private use of for use by 3rd parties ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#15 2021-04-22 04:32:40

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Docker+AUR with pacaur ?

If you want to use an AUR helper to build dependencies, install them, then build other packages and install those too...

... the you need to let the AUR helper do its job and install them in the right order, by giving it the ability to run 'sudo pacman' without password prompts.

And thus we return to my original post #2


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB