You are not logged in.

#1 2012-10-19 23:16:00

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

devtools update causes problems with sudo when used in a script?

I'm a little confused by this one, but I'm not convinced that it's a bug.. yet.

Long story short, I compile packages using the ABS via a script/wrapper which uses devtools. The script is available here: https://github.com/WorMzy/compilepackage

Now, this script is far from perfect, but has worked perfectly well (in various states of completeness) for the past year or so. However, with the recent update of devtools (20120720-1 => 20121013-1), my script fails to execute correctly. After entering the password when prompted (by sudo, at this line: https://github.com/WorMzy/compilepackag … tions#L107), the script terminates unexpectedly.

Downgrading devtools "fixes" this problem, but I'm not sure if this is a bug in devtools, sudo, zsh, my script, or something else.

Here is the full output from the compilation of "arch-install-scripts":

build@sakura[pts/10]:~/builds/devtools$ . ~/.scripts/compilepackage arch-install-scripts
==> Downloading sources
==> arch-install-scripts directory already exist. Replace ? [Y/n] 
==> Download arch-install-scripts sources
receiving file list ... done
./

sent 28 bytes  received 70 bytes  39.20 bytes/sec
total size is 656  speedup is 6.69
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
:: Starting full system upgrade...
 there is nothing to do
==> Building in chroot for [extra] (x86_64)...
==> Creating clean working copy...done
==> Making package: arch-install-scripts 8-1 (Fri Oct 19 23:45:52 BST 2012)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving Sources...
  -> Found arch-install-scripts-8.tar.gz
  -> Found arch-install-scripts-8.tar.gz.sig
==> Validating source files with md5sums...
    arch-install-scripts-8.tar.gz ... Passed
    arch-install-scripts-8.tar.gz.sig ... Passed
==> Verifying source file signatures with gpg...
    arch-install-scripts-8.tar.gz ... FAILED (unknown public key 1EB2638FF56C0C53)
==> WARNING: Warnings have occurred while verifying the signatures.
    Please make sure you really trust them.
==> Extracting Sources...
  -> Extracting arch-install-scripts-8.tar.gz with bsdtar
==> Starting build()...
make: Entering directory `/build/src/arch-install-scripts-8'
  GEN      arch-chroot
  GEN      genfstab
  GEN      pacstrap
make: Leaving directory `/build/src/arch-install-scripts-8'
==> Entering fakeroot environment...
==> Starting package()...
make: Entering directory `/build/src/arch-install-scripts-8'
install -dm755 /build/pkg/usr/bin
install -m755 arch-chroot genfstab pacstrap /build/pkg/usr/bin
install -Dm644 zsh-completion /build/pkg/usr/share/zsh/site-functions/_archinstallscripts
make: Leaving directory `/build/src/arch-install-scripts-8'
==> Tidying install...
  -> Purging unwanted files...
  -> Compressing man and info pages...
  -> Stripping unneeded symbols from binaries and libraries...
==> Creating package...
  -> Generating .PKGINFO file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: arch-install-scripts 8-1 (Fri Oct 19 23:45:54 BST 2012)
==> Installing package arch-install-scripts with pacman -U...
loading packages...
resolving dependencies...
looking for inter-conflicts...

Targets (1): arch-install-scripts-8-1

Total Installed Size:   0.03 MiB

Proceed with installation? [Y/n] 
(1/1) checking package integrity                                                                                    [######################################################################] 100%
(1/1) loading package files                                                                                         [######################################################################] 100%
(1/1) checking for file conflicts                                                                                   [######################################################################] 100%
(1/1) installing arch-install-scripts                                                                               [######################################################################] 100%
resolving dependencies...
looking for inter-conflicts...

Targets (5): elfutils-0.155-1  pyalpm-0.5.3-2  python-3.3.0-1  python-pyelftools-0.20-2  namcap-3.2.4-2

Total Installed Size:   99.58 MiB

Proceed with installation? [Y/n] 
(5/5) checking package integrity                                                                                    [######################################################################] 100%
(5/5) loading package files                                                                                         [######################################################################] 100%
(5/5) checking for file conflicts                                                                                   [######################################################################] 100%
(1/5) installing python                                                                                             [######################################################################] 100%
Optional dependencies for python
    tk: for tkinter
    sqlite
(2/5) installing pyalpm                                                                                             [######################################################################] 100%
(3/5) installing elfutils                                                                                           [######################################################################] 100%
(4/5) installing python-pyelftools                                                                                  [######################################################################] 100%
(5/5) installing namcap                                                                                             [######################################################################] 100%
Checking PKGBUILD
Checking arch-install-scripts-8-1-any.pkg.tar.xz
arch-install-scripts W: Dependency bash included but already satisfied
arch-install-scripts W: Dependency included and not needed ('coreutils')
arch-install-scripts W: Dependency included and not needed ('pacman')
arch-install-scripts W: Dependency included and not needed ('util-linux')
==> Compilation complete, installing...
Password: 
loading packages...
warning: arch-install-scripts-8-1 is up to date -- reinstalling
resolving dependencies...
looking for inter-conflicts...

Targets (1): arch-install-scripts-8-1

Total Installed Size:   0.03 MiB
Net Upgrade Size:       0.00 MiB

Proceed with installation? [Y/n] %                                                                                                                                                               build@sakura[pts/10]:~/builds/arch-install-scripts$ 

That "%" is inverted, just like what you get when you run

echo -n "text"

in zsh. Incidentally, here is my .zshrc: https://github.com/WorMzy/Config-files/ … ter/.zshrc, however, the problem persists with a new user with an unconfigured zsh.

Here is my sudoers too:

## sudoers file.
##
## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.
##
## See the sudoers man page for the details on how to write a sudoers file.
##

##
## Host alias specification
##
## Groups of machines. These may include host names (optionally with wildcards),
## IP addresses, network numbers or netgroups.
# Host_Alias	WEBSERVERS = www1, www2, www3

##
## User alias specification
##
## Groups of users.  These may consist of user names, uids, Unix groups,
## or netgroups.
# User_Alias	ADMINS = millert, dowdy, mikef

##
## Cmnd alias specification
##
## Groups of commands.  Often used to group related commands together.
# Cmnd_Alias	PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
# 			    /usr/bin/pkill, /usr/bin/top

##
## Defaults specification
##
## You may wish to keep some of the following environment variables
## when running commands via sudo.
##
## Locale settings
# Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
##
## Run X applications through sudo; HOME is used to find the
## .Xauthority file.  Note that other programs use HOME to find   
## configuration files and this may lead to privilege escalation!
# Defaults env_keep += "HOME"
##
## X11 resource path settings
# Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
##
## Desktop path settings
# Defaults env_keep += "QTDIR KDEDIR"
##
## Allow sudo-run commands to inherit the callers' ConsoleKit session
# Defaults env_keep += "XDG_SESSION_COOKIE"
##
## Uncomment to enable special input methods.  Care should be taken as
## this may allow users to subvert the command being run via sudo.
# Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
##
## Uncomment to enable logging of a command's output, except for
## sudoreplay and reboot.  Use sudoreplay to play back logged sessions.
# Defaults log_output
# Defaults!/usr/bin/sudoreplay !log_output
# Defaults!/usr/local/bin/sudoreplay !log_output
# Defaults!/sbin/reboot !log_output
Defaults timestamp_timeout=0,passwd_timeout=0,passprompt="Password:",badpass_message="Incorrect password",editor=/usr/bin/vim:/usr/bin/vi,targetpw

##
## Runas alias specification
##

##
## User privilege specification
##
root ALL=(ALL) ALL
build sakura=/usr/bin/pacman-color -U *,/usr/bin/pacman-color -Sy,/usr/bin/pacman-color -Syy
build sakura=/usr/bin/pacman -U *
build sakura=NOPASSWD: /usr/bin/extra-x86_64-build,/usr/bin/multilib-build,/usr/sbin/makechrootpkg

## Uncomment to allow members of group wheel to execute any command
%wheel sakura=(ALL) ALL 

## Same thing without a password
#%wheel ALL=(ALL) NOPASSWD: /sbin/sdshutdown, /sbin/sdreboot

## Uncomment to allow members of group sudo to execute any command
# %sudo	ALL=(ALL) ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d

Further information will be provided on request. Suggestions for improving the script will also be appreciated.

Thanks.


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

#2 2012-10-23 13:30:36

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

Re: devtools update causes problems with sudo when used in a script?

Update: It appears that the cause is systemd's nspawn. Disabling it in mkarchroot (have_nspawn=0) resolves the problem.

However, I don't understand why it's causing this behaviour. User input works fine for the sudo password prompt, but then fails for the pacman user prompt? Do they use different input buffers or something? Does that question even make sense?


Anyway, I'll open a bug report on flyspray and upstream about this when I get the chance.


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

#3 2013-04-17 20:13:10

zuargo
Member
From: Concepción, Chile
Registered: 2009-08-20
Posts: 116

Re: devtools update causes problems with sudo when used in a script?

Hello, I am having a very similar issue, see in the following link, for further information: https://bbs.archlinux.org/viewtopic.php?id=159518

Can you be more specific about to disable systemd's nspawn in mkarchroot? I mean, in which line of the file must I add have_nspawn=0?

Did you open a bug report? What is the link?

Thanks in advance

Offline

#4 2013-04-17 20:56:14

AD28
Member
Registered: 2008-09-16
Posts: 161

Re: devtools update causes problems with sudo when used in a script?

zuargo wrote:

Hello, I am having a very similar issue, see in the following link, for further information: https://bbs.archlinux.org/viewtopic.php?id=159518

Umm to me, these don't look similar at all.... but who knows

Offline

Board footer

Powered by FluxBB