You are not logged in.
Pages: 1
I am trying to put together a script to install and configure Arch automatically. Once the installation part is done and I log in as root I want to run a script to configure and install everything I will need. This includes building aurutils by running the following script (simplified to show the relevant parts):
username=user1
sudo -u $username -H bash << EOF
mkdir \$HOME/.builds
gpg --verbose --recv-keys DBE7D3DD8C81D58D0A13D0E76BC26A17B9B7018A
aurutils_url="https://aur.archlinux.org/cgit/aur.git/snapshot/aurutils.tar.gz"
curl \$aurutils_url | tar xvz --directory \$HOME/.builds
cd \$HOME/.builds/aurutils
# This is just to give some context
#############
echo "\$HOME"
whoami
groups
#############
makepkg -s
EOFAfter correctly creating the .builds/ directory and downloading and extracting the snapshot I get the following output:
/home/user1
user1
sudo
==> Making package: aurutils 2.3.3-1 (Sun 15 Dec 2019 14:49:38 GMT)
==> Checking runtime dependencies...
==> Installing missing dependencies...
resolving dependencies...
looking for conflicting packages...
Packages (7) oniguruma-6.9.4-1 diffstat-1.62-1 expac-10-1 jq-1.6-2 pacutils-0.9.0-1 parallel-20191122-1 wget-1.20.3-2
Total Download Size: 2.71 MiB
Total Installed Size: 8.06 MiB
:: Proceed with installation? [Y/n] ==> ERROR: 'pacman' failed to install missing dependencies.
==> Missing dependencies:
-> jq
-> expac
-> diffstat
-> pacutils
-> parallel
-> wget
==> Checking buildtime dependencies...
==> ERROR: Could not resolve all dependencies.The sudo group has root privilege:
grep %sudo /etc/sudoers
%sudo ALL=(ALL) ALLHowever, if I bring the makepkg -s outside the heredoc like so:
username=user1
sudo -u $username -H bash << EOF
mkdir \$HOME/.builds
gpg --verbose --recv-keys DBE7D3DD8C81D58D0A13D0E76BC26A17B9B7018A
aurutils_url="https://aur.archlinux.org/cgit/aur.git/snapshot/aurutils.tar.gz"
curl \$aurutils_url | tar xvz --directory \$HOME/.builds
cd \$HOME/.builds/aurutils
# This is just to give some context
#############
echo "\$HOME"
whoami
groups
#############
EOF
cd /home/$username/.builds/aurutils
sudo -u $username makepkg -sIt just works.
I could just use this version but I really wonder what is going on in the first script that prevents pacman from installing the packages,
All I could find related to this error is that it appears when you are building a package that requires AUR dependencies that are not installled but this is not the case here (all of them are form official repos).
Last edited by karb94 (2019-12-15 23:18:01)
Offline
You probably aren't going to get too many helpful hints, considering you are making a "install Arch without following the wiki" script.
Eenie meenie, chili beanie, the spirits are about to speak -- Bullwinkle J. Moose
It's a big club...and you ain't in it -- George Carlin
Registered Linux user #149839
perl -e 'print$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10); '
Offline
Not sure, but I seem to recall that makepkg will refuse to run as root.
And, as merlock points out, this is fine if this is for your own use -- but trying to make this into a tool intended for general use by others will be fruitless. There are just too many variables.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
You probably aren't going to get too many helpful hints, considering you are making a "install Arch without following the wiki" script.
The error will appear regardless of the installation method. The installation script and the "configuration" script are separate. Although I understand that everything that is not line by line commands is not "supported". This is only for my own use.
Not sure, but I seem to recall that makepkg will refuse to run as root.
sudo -u user should take care of this. As a matter of fact, if you run makepkg directly as root it will clearly state that you should not run makepkg as a root in the error message which is not the case here.
Last edited by karb94 (2019-12-15 16:13:18)
Offline
How do you intend for the password to be passed to pacman run from makepkg? You could add `pacman` to sudoers with NOPASSWD, but really just installing the dependencies first as root before running makepkg seems better to me.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
How do you intend for the password to be passed to pacman run from makepkg?
Well somehow sudo -u $username makepkg -s works on its own. I just don't understand the difference. Anyways, this is better than installing the dependencies with root and then building the packages since I don't need to update it if the dependencies change so I will stick to this for now. Thank you.
Offline
Makepkg uses fakeroot to install build things, this probably has nothing to do with your issue the interaction between sudo / bash / fakeroot.
If you want to know more, try posting the question to pacman-dev ML.
This thread caught the attention from pacman developers, so there's no more need to post there.
Edited to correct errors
Last edited by Lone_Wolf (2019-12-17 09:48:48)
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
Makepkg uses fakeroot to install things, this probably has to do with the interaction between sudo / bash / fakeroot.
No it does not.... It uses sudo.
Allan
Offline
this is better than installing the dependencies with root and then building the packages since I don't need to update it if the dependencies change so I will stick to this for now. Thank you.
I didn't say hardcode the dependencies in the script ... just install them first:
sed -n 's/.*depends = //p' .SRCINFO | pacman -S -"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Pages: 1