You are not logged in.

#1 2018-04-20 22:56:53

kaifis
Member
Registered: 2016-12-22
Posts: 58

[SOLVED] I cannot install from aur while I'm chrooting.

Hi,
I'm installing arch and I couldn't use sudo because of

sudo: no tty present and no askpass program specified

I need sudo for installing packages from aur (You cannot run makepkg as root.)
I found few other threads about this and there was said that I should reinstall sudo - that didn't work.
Thanks for any suggestions.

Last edited by kaifis (2018-04-22 11:16:47)

Offline

#2 2018-04-20 23:27:32

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: [SOLVED] I cannot install from aur while I'm chrooting.

As this sounds like an X-Y problem.  What package do you need to install that prevents installation via the normal guide?  Does the following switch you to a none root user?

su - nobody -s /bin/bash

Offline

#3 2018-04-20 23:40:54

kaifis
Member
Registered: 2016-12-22
Posts: 58

Re: [SOLVED] I cannot install from aur while I'm chrooting.

I'm installing aurman (AUR helper). And I switched to non-root user without problems with:

 su username

You command doesn't work either. (It switches me to non-root user but I cannot use sudo)

Last edited by kaifis (2018-04-20 23:41:16)

Offline

#4 2018-04-20 23:45:32

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: [SOLVED] I cannot install from aur while I'm chrooting.

Why would you need an AUR helper before you have installed the system?

Offline

#5 2018-04-20 23:53:22

kaifis
Member
Registered: 2016-12-22
Posts: 58

Re: [SOLVED] I cannot install from aur while I'm chrooting.

Well the system is already installed I just wanted to install most of packeges from my other system using chroot.
And it's strange that I couldn't use sudo in chroot so I wanted to make sure there is nothing broken in my system.

I installed aurman by disabling sudo password for that user. (Temporarily) But still don't know what causes this behavior.

Offline

#6 2018-04-20 23:56:47

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: [SOLVED] I cannot install from aur while I'm chrooting.

To install packages you use pacman.

Offline

#7 2018-04-20 23:58:57

kaifis
Member
Registered: 2016-12-22
Posts: 58

Re: [SOLVED] I cannot install from aur while I'm chrooting.

Know that ?
Idk I didn't needed AUR helper that much I was just worried about that. Broken sudo command.

Offline

#8 2018-04-21 00:10:10

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: [SOLVED] I cannot install from aur while I'm chrooting.

sudo can not find a tty because arch-chroot mounts a separate devpts instance for the chroot.

Offline

#9 2018-04-21 00:20:44

kaifis
Member
Registered: 2016-12-22
Posts: 58

Re: [SOLVED] I cannot install from aur while I'm chrooting.

Thanks

Offline

#10 2018-04-21 00:25:17

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

Re: [SOLVED] I cannot install from aur while I'm chrooting.

kaifis wrote:

... It switches me to non-root user but I cannot use sudo

If you are logged in as a non-root user, then you don't need to use sudo.  You started this thread by saying you needed to sudo away from root to use makepkg.  If you can log in as a non-root user, just use makepkg, no need for sudo.  When you want to install the package, just log out of the user session (back into the root shell) and install the built package.

That said, installing an aur helper from the installation iso chroot is really just several layers of odd.


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

Offline

#11 2018-04-21 00:39:42

kaifis
Member
Registered: 2016-12-22
Posts: 58

Re: [SOLVED] I cannot install from aur while I'm chrooting.

Makepkg needs to be run as non-root however it calls sudo internaly.
And sorry I wasn't clear enough in the first question but I meant to ask how to get sudo working under non-root user.

Offline

#12 2018-04-21 01:43:03

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

Re: [SOLVED] I cannot install from aur while I'm chrooting.

kaifis wrote:

Makepkg needs to be run as non-root however it calls sudo internaly.

Not to build a package it doesn't.  It does optionally use sudo to call pacman to install the built package; don't specify that option.


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

Offline

#13 2018-04-21 15:26:36

SealsRock12
Member
Registered: 2018-04-03
Posts: 83

Re: [SOLVED] I cannot install from aur while I'm chrooting.

kaifis wrote:

I need sudo for installing packages from aur (You cannot run makepkg as root.)

Using sudo won't work, as it will still think that it is root since, with sudo, you are running a command as root.


-- SealsRock12

Offline

#14 2018-04-21 17:29:22

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

Re: [SOLVED] I cannot install from aur while I'm chrooting.

SealsRock, sudo can be used to run a command as any other user.  Previously archers could use `sudo -u nobody makepkg` which is what the OPs post suggested they were trying to do.  However, if you read the rest of the thread, they are infact running as a non-root user and - apparently - only need sudo to install the built package with pacman.  Hence my advice in post #10: build the package as a regular user, then log in as root and install it - there is no need for sudo at any stage of this.

That said this is all rather silly - there is absolutely no reason to do any of this from the chroot in the first place.


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

Offline

#15 2018-04-21 18:05:22

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: [SOLVED] I cannot install from aur while I'm chrooting.

I understood the intention to be

iso -> arch-chroot -> su (to none root user) -> makepkg -i (after enabling sudo without password for this user) -> install AUR helper -> use AUR helper to install packages instead of pacman

Offline

#16 2018-04-21 20:31:21

Cody Learner
Banned
Registered: 2017-12-06
Posts: 54
Website

Re: [SOLVED] I cannot install from aur while I'm chrooting.

Somewhat confused as to what you're trying to do... Seems Trilby's suggestion works best if I'm getting it right.

Installing packages on top of a fresh Arch install, from a completed install, or a script? Just boot into the new install. I've put 'post install' script into a new install, via install script (heredoc). Then run 'post install' from new install.

Optionally look into pacstrap or redirecting pacman to install from the os you're chrooting from.

Last edited by Cody Learner (2018-04-21 20:34:08)


Self designated Linux and Bash mechanic.....
I fix and build stuff hands on. I'm not opposed to creating a mess in obtaining a goal.

Offline

#17 2018-04-22 08:54:18

kaifis
Member
Registered: 2016-12-22
Posts: 58

Re: [SOLVED] I cannot install from aur while I'm chrooting.

Trilby wrote:

Hence my advice in post #10: build the package as a regular user, then log in as root and install it - there is no need for sudo at any stage of this.

Well Archwiki says that should make packages with makepkg but it won't run as root (it's some kind of security feature) and when I run it as nonroot it calls sudo in itself and sudo doesn't work in chroot without -S switch, hence I'm unable to build the package.

And I would install for example DE and Xorg (few packages are from AUR - like few greeters for lightdm) from chroot because I followed arch wiki (I cannot do that from shell and elinks is not my favourite internet browser)

Last edited by kaifis (2018-04-22 10:56:38)

Offline

#18 2018-04-22 08:55:39

kaifis
Member
Registered: 2016-12-22
Posts: 58

Re: [SOLVED] I cannot install from aur while I'm chrooting.

loqs wrote:

I understood the intention to be

iso -> arch-chroot -> su (to none root user) -> makepkg -i (after enabling sudo without password for this user) -> install AUR helper -> use AUR helper to install packages instead of pacman

You understood correctly except that sudo without password is workaround, not intesion. And I was installing arch from existing installation.

Last edited by kaifis (2018-04-22 08:56:47)

Offline

#19 2018-04-22 10:43:27

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

Re: [SOLVED] I cannot install from aur while I'm chrooting.

kaifis wrote:

when I run it as nonroot it calls sudo in itself and hence sudo doesn't work in chroot without -S switch I'm unable to run build the package.

Makepkg only calls sudo to *install* the package with pacman if and only if you include the -i flag.  There is, again, no need for sudo for makepkg to build a package.

(edit: trimmed some snarkiness after I had some of the morning coffee.)

Last edited by Trilby (2018-04-22 10:58:13)


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

Offline

#20 2018-04-22 10:54:56

kaifis
Member
Registered: 2016-12-22
Posts: 58

Re: [SOLVED] I cannot install from aur while I'm chrooting.

Well that makes sense. I just copypasted from wiki (forgot to look for meaning of switches) well anyway thanks for explanation.

Offline

#21 2018-04-22 11:07:32

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: [SOLVED] I cannot install from aur while I'm chrooting.

As the packages were already built on another system you could have just installed them with pacman -U and skipped makepkg but I would have left that until after I had tested the base system booted correctly.

Offline

#22 2018-11-11 11:38:06

darkbasic
Member
Registered: 2015-06-22
Posts: 31

Re: [SOLVED] I cannot install from aur while I'm chrooting.

makepkg also needs sudo to solve dependencies (makepkg -s). Am I supposed to solve all the build dependencies manually?
I *have* to use makepkg from the chroot because otherwise my system won't boot, not being able to properly use makepkg is so annoying.

Offline

#23 2018-11-11 12:01:37

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

Re: [SOLVED] I cannot install from aur while I'm chrooting.

Please don't necrobump, especially if you're just going to whine.

https://wiki.archlinux.org/index.php/Co … bumping.22

Closing.


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

Board footer

Powered by FluxBB