Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sudo and pty migration issues #729

Closed
duelle opened this issue Jul 13, 2023 · 40 comments
Closed

sudo and pty migration issues #729

duelle opened this issue Jul 13, 2023 · 40 comments

Comments

@duelle
Copy link

duelle commented Jul 13, 2023

% pikaur -Vq

Pikaur v1.15.3
Pacman v6.0.2 - libalpm v13.0.2 - pyalpm v0.10.6
Description:

When running pikaur -Syu the output after "Starting full AUR upgrade..." is shifted heavily, probably due to wrong insertion of spaces or tabs, making it very hard to read/understand what is happening: Screenshot.

When choosing the "m" option, the package list is cleanly shown and it is possible to install the packages. Sometimes (although not always reproducable) the final confirmation question before installing seems to block the progress and hangs without further output.

Attached log:
% pikaur -Syu

:: Synchronizing package databases...
 core is up to date
 extra is up to date
 multilib is up to date

:: Starting full AUR upgrade...
                               Reading repository package databases...
                                                                      Reading local package database...
                                                                                                       Reading AUR packages info...
                                                                                                                                   Resolving AUR dependencies...
                                                                                                                                                                
                                                                                                                                                                :: Repository packages will be installed:
                            cuda                                  11.2.2-2             -> 12.2.0-1            1487.66 MiB
                                                                                                                          cuda-tools                            11.2.2-2             -> 12.2.0-1            1121.43 MiB
                                          cudnn                                 8.1.1.33-1           -> 8.9.2.26-1          884.79 MiB
                                                                                                                                       linux                                 6.4.2.arch1-1        -> 6.4.3.arch1-1       125.41 MiB
                                                      linux-headers                         6.4.2.arch1-1        -> 6.4.3.arch1-1       29.38 MiB
                                                                                                                                                  acpi_call                             1.2.2-138            -> 1.2.2-139           0.01 MiB
                                                               nvidia                                535.54.03-7          -> 535.54.03-8         43.53 MiB
                                                                                                                                                           tp_smapi                              0.43+r3+g35be4ab-4   -> 0.43+r3+g35be4ab-5  0.03 MiB
                                                                       
                                                                       :: New dependencies will be installed from repository:
                                                                                                                              gcc12 (for cuda)                                           -> 12.3.0-2            38.24 MiB
                                            gcc12-libs (for gcc12)                                     -> 12.3.0-2            13.39 MiB
                                                                                                                                       
                                                                                                                                       :: AUR packages will be installed:
                                                                                                                                                                          dataspell                             2023.1.3-1           -> 2023.1.4-1
                                                                     dataspell-jre                         2023.1.3-1           -> 2023.1.4-1
                                                                                                                                             
                                                                                                                                             Total Download Size:   3743.85 MiB
 Total Installed Size:  9847.66 MiB
                                   
                                   :: Proceed with installation? [Y/n] 
:: [v]iew package details   [m]anually select packages
>> 
% pikaur -Syu --verbose --pikaur-debug

:: debug: main: Setting stdout to utf-8...
:: debug: main: already set - nothing to do
:: debug: main: Setting stderr to utf-8...
:: debug: main: already set - nothing to do
:: debug: main: Pikaur operation found for args ['/usr/bin/pikaur', '-Syu', '--verbose', '--pikaur-debug']: cli_install_packages
:: debug: news: init
:: debug: news: fetch_latest
=> GET https://www.archlinux.org/feeds/news/
=> sudo pacman --color=always --sync --refresh
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 multilib is up to date
:: debug: pacman: Discarding repo cache...
                                          
                                          :: Starting full AUR upgrade...
                                                                         :: debug: install_info_fetcher: 
                                                                                                         Gonna fetch install info for:
                                                                                                                                          install_package_names=[]
                                                                                                                                                                      not_found_repo_pkgs_names=[]
                        pkgbuilds_packagelists={}
                                                     manually_excluded_packages_names=[]
                                                                                        
                                                                                        Reading repository package databases...
                                                                                                                               Reading local package database...
                                                                                                                                                                :: debug: install_info_fetcher: Gonna get repo pkgs install info...
                                                     => pacman --color=always --sync --sysupgrade --print-format %r/%n
                                                                                                                      :: debug: install_info_fetcher: gonna get AUR pkgs install info for:
                aur_packages_versionmatchers=[]
                                                   self.aur_updates_install_info=[]
                                                                                       aur_packages_names_to_versions={}
                                                                                                                        :: debug: install_info_fetcher: found AUR pkgs:
                                                                                                                                                                           aur_pkg_list=[]
            not found AUR pkgs:
                                   not_found_aur_pkgs=[]
                                                        Reading AUR packages info...
                                                                                    => GET https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=archlinux-java-run&arg[]=bluez-utils-compat&arg[]=brother-hl2030&arg[]=cpulimit&arg[]=dataspell&arg[]=dataspell-jre&arg[]=dia&arg[]=dot-editor&arg[]=eclipse-java&arg[]=electron19&arg[]=espeak&arg[]=evince-no-gnome&arg[]=firewarden&arg[]=google-chrome&arg[]=gtk-gnutella&arg[]=imlib2-heic&arg[]=infnoise&arg[]=jabref&arg[]=jmeter&arg[]=jmt&arg[]=k6&arg[]=libnvidia-container&arg[]=libnvidia-container-tools&arg[]=light-git&arg[]=lyrebird&arg[]=masterpdfeditor-free&arg[]=metis&arg[]=notion-app-enhanced&arg[]=nvidia-container-runtime&arg[]=nvidia-container-toolkit&arg[]=pikaur&arg[]=portfolio-performance-bin&arg[]=py3status-cpu-governor&arg[]=py3status-modules&arg[]=pycharm-professional&arg[]=python-fangfrisch&arg[]=python-grip&arg[]=python-i3-py&arg[]=python-path-and-address&arg[]=python-py3nvml&arg[]=python-pylxd&arg[]=python-ws4py&arg[]=qpdfview&arg[]=quickswitch-i3&arg[]=rememberthemilk&arg[]=rstudio-desktop-bin&arg[]=skypeforlinux-stable-bin&arg[]=slack-desktop&arg[]=social-engineer-toolkit&arg[]=spotify&arg[]=srm&arg[]=systemd-boot-pacman-hook&arg[]=teams&arg[]=teamviewer&arg[]=tlpui&arg[]=todotxt&arg[]=tor-browser&arg[]=ttf-ms-fonts&arg[]=ttf-wps-fonts&arg[]=uxplay&arg[]=ventoy-bin&arg[]=webex-bin&arg[]=weylus-bin&arg[]=wps-office-fonts&arg[]=wps-office-mime&arg[]=xkcdpass&arg[]=yed&arg[]=zoom
                                                                :: debug: install_info_fetcher: got AUR pkgs install info: [<AURInstallInfo "dataspell" 2023.1.3-1 -> 2023.1.4-1>, <AURInstallInfo "dataspell-jre" 2023.1.3-1 -> 2023.1.4-1>]
                                                               Resolving AUR dependencies...
                                                                                            => pacman --color=always --deptest glib2 python
                                                                                                                                           => pacman --color=always --deptest glib2 python
            => pacman --color=always --query --upgrades --quiet
                                                               => pacman --color=always --sync acpi_call cuda cuda-tools cudnn linux linux-headers nvidia tp_smapi --print-format %r/%n
         :: debug: install_cli: self.install_info.all_install_info_containers=([<RepoInstallInfo "linux" 6.4.2.arch1-1 -> 6.4.3.arch1-1>, <RepoInstallInfo "acpi_call" 1.2.2-138 -> 1.2.2-139>, <RepoInstallInfo "cuda" 11.2.2-2 -> 12.2.0-1>, <RepoInstallInfo "cuda-tools" 11.2.2-2 -> 12.2.0-1>, <RepoInstallInfo "cudnn" 8.1.1.33-1 -> 8.9.2.26-1>, <RepoInstallInfo "linux-headers" 6.4.2.arch1-1 -> 6.4.3.arch1-1>, <RepoInstallInfo "nvidia" 535.54.03-7 -> 535.54.03-8>, <RepoInstallInfo "tp_smapi" 0.43+r3+g35be4ab-4 -> 0.43+r3+g35be4ab-5>], [<RepoInstallInfo "gcc12-libs"  -> 12.3.0-2>, <RepoInstallInfo "gcc12"  -> 12.3.0-2>], [], [], [], [], [<AURInstallInfo "dataspell" 2023.1.3-1 -> 2023.1.4-1>, <AURInstallInfo "dataspell-jre" 2023.1.3-1 -> 2023.1.4-1>], [])
                                                               :: debug: news: print
                                                                                    :: debug: news: loading date from /home/duelle/.cache/pikaur/last_seen_news.dat
                                                                                                                                                                   :: debug: news: data: Sun, 18 Jun 2023 09:14:37 +0000, parsed: 2023-06-18 09:14:37+00:00
                                                                             :: debug: news: Arch News Date: 2023-06-18 09:14:37+00:00, Last-seen date: 2023-06-18 09:14:37+00:00
   
   :: Repository packages will be installed:
                                             cuda                                  11.2.2-2             -> 12.2.0-1            1487.66 MiB
                                                                                                                                           cuda-tools                            11.2.2-2             -> 12.2.0-1            1121.43 MiB
                                                           cudnn                                 8.1.1.33-1           -> 8.9.2.26-1          884.79 MiB
                                                                                                                                                        linux                                 6.4.2.arch1-1        -> 6.4.3.arch1-1       125.41 MiB
                                                                       linux-headers                         6.4.2.arch1-1        -> 6.4.3.arch1-1       29.38 MiB
                                                                                                                                                                   acpi_call                             1.2.2-138            -> 1.2.2-139           0.01 MiB
                                                                                nvidia                                535.54.03-7          -> 535.54.03-8         43.53 MiB
                                                                                                                                                                            tp_smapi                              0.43+r3+g35be4ab-4   -> 0.43+r3+g35be4ab-5  0.03 MiB
                                                                                        
                                                                                        :: New dependencies will be installed from repository:
                                                                                                                                               gcc12 (for cuda)                                           -> 12.3.0-2            38.24 MiB
                                                             gcc12-libs (for gcc12)                                     -> 12.3.0-2            13.39 MiB
                                                                                                                                                        
                                                                                                                                                        :: AUR packages will be installed:
             dataspell                             2023.1.3-1           -> 2023.1.4-1
                                                                                      dataspell-jre                         2023.1.3-1           -> 2023.1.4-1
                                                                                                                                                              
                                                                                                                                                              Total Download Size:   3743.85 MiB
                  Total Installed Size:  9847.66 MiB
                                                    
                                                    :: debug: prompt: Gonna get input from user...
                                                                                                  :: debug: FileLock: Acquiring /tmp/pikaur_prompt_89732.lock...
                                                                                                                                                                :: debug: FileLock: Acquired /tmp/pikaur_prompt_89732.lock
                                            :: debug: prompt_nolock: Restoring TTY...
                                                                                     :: debug: prompt_nolock: Using standard input reader...
:: Proceed with installation? [Y/n] 
:: [v]iew package details   [m]anually select packages
>> 

Seems to work as intended:

% pikaur -S dataspell --verbose --pikaur-debug

Reading repository package databases...
Reading local package database...
Resolving AUR dependencies...

:: AUR package will be installed:
 dataspell                             2023.1.3-1           -> 2023.1.4-1

Total Download Size:       0.0 MiB
Total Installed Size:      0.0 MiB

:: Proceed with installation? [Y/n] 
:: [v]iew package details   [m]anually select packages
>> 

If there is any further information you may require, please let me know.

Thanks a lot for your support!

@bitwave
Copy link

bitwave commented Jul 13, 2023

Have the same problem, but it occurs only when using gnome-terminal

@adolfgatonegro
Copy link

Can confirm the same issue. I ran pikaur -Syu last night and it was OK, so I was thinking maybe one of the updates is causing the issue. The only Python packages that were updated were python-numpy, python-platformdirs, and python-trove-classifiers, no idea if they could have something to do with this.

% pikaur -Vq
Pikaur v1.15.3
Pacman v6.0.2 - libalpm v13.0.2 - pyalpm v0.10.6

% pikaur -Syu
:: Synchronising package databases...
 core is up to date
 extra is up to date
 multilib is up to date

:: Starting full AUR upgrade...
                               Reading repository package databases...
                                                                      Reading local package database...
                                                                                                       Reading AUR packages info...

                 :: Starting full system upgrade...
                                                   warning: ignoring package replacement (otf-cascadia-code-nerd-2.3.3-3 => ttf-cascadia-code-nerd-3.0.2-1)
                                          there is nothing to do
                                                                %

Thanks, and do let me know if there's anything else I can do to help troubleshoot this.

@duelle
Copy link
Author

duelle commented Jul 13, 2023

Have the same problem, but it occurs only when using gnome-terminal

The terminal I use is "urxvt"

@ppascher
Copy link

Also happens with "foot" terminal.

λ pikaur -Syu --verbose --pikaur-debug
:: debug: main: Setting stdout to utf-8...
:: debug: main: already set - nothing to do
:: debug: main: Setting stderr to utf-8...
:: debug: main: already set - nothing to do
:: debug: main: Pikaur operation found for args ['/usr/bin/pikaur', '-Syu', '--verbose', '--pikaur-debug']: cli_install_packages
:: debug: news: init
:: debug: news: fetch_latest
=> GET https://www.archlinux.org/feeds/news/
=> sudo pacman --color=always --sync --refresh
:: Synchronizing package databases...
 cachyos-v3 is up to date
 cachyos is up to date
 cachyos-core-v3 is up to date
 cachyos-extra-v3 is up to date
 core is up to date
 extra is up to date
 multilib is up to date
:: debug: pacman: Discarding repo cache...

                                          :: Starting full AUR upgrade...
                                                                         :: debug: install_info_fetcher:
                                                                                                         Gonna fetch install info for:
                                                                                                                                          install_package_names=[]
            not_found_repo_pkgs_names=[]
                                            pkgbuilds_packagelists={}
                                                                         manually_excluded_packages_names=[]

                                                                                                            Reading repository package databases...
                                                                                                                                                   Reading local package database...
                          :: debug: install_info_fetcher: Gonna get repo pkgs install info...
                                                                                             => pacman --color=always --sync --sysupgrade --print-format %r/%n
    :: debug: install_info_fetcher: gonna get AUR pkgs install info for:
                                                                            aur_packages_versionmatchers=[]
                                                                                                               self.aur_updates_install_info=[]
                                                                                                                                                   aur_packages_names_to_versions={}
                          :: debug: install_info_fetcher: found AUR pkgs:
                                                                             aur_pkg_list=[]
                                                                                            not found AUR pkgs:
                                                                                                                   not_found_aur_pkgs=[]
                                                                                                                                        Reading AUR packages info...
          => GET https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=amdgpu-clocks-git&arg[]=brother-mfc-l2700dn&arg[]=brscan4&arg[]=btrfs-du&arg[]=ccrtp&arg[]=certmonger&arg[]=clang-libs-minimal-git&arg[]=clang-minimal-git&arg[]=cmst&arg[]=hsa-runtime-git&arg[]=jmtpfs&arg[]=jstest-gtk-git&arg[]=lib32-llvm-libs-minimal-git&arg[]=lib32-llvm-minimal-git&arg[]=lib32-mesa-minimal-git&arg[]=libclc-minimal-git&arg[]=libstrangle&arg[]=libzrtpcpp&arg[]=linux516-tkg-cfs&arg[]=linux516-tkg-cfs-headers&arg[]=linux517-tkg-cfs&arg[]=linux517-tkg-cfs-headers&arg[]=linux518-tkg-cfs&arg[]=linux518-tkg-cfs-headers&arg[]=linux519-tkg-cfs&arg[]=linux519-tkg-cfs-headers&arg[]=linux60-tkg-cfs&arg[]=linux60-tkg-cfs-headers&arg[]=linux61-tkg-bore&arg[]=linux61-tkg-bore-headers&arg[]=linux61-tkg-cfs&arg[]=linux61-tkg-cfs-headers&arg[]=linux62-tkg-bore&arg[]=linux62-tkg-bore-headers&arg[]=llvm-libs-minimal-git&arg[]=llvm-minimal-git&arg[]=mesa-minimal-git&arg[]=mkinitcpio-numlock&arg[]=nemo-compare&arg[]=nfs4-acl-tools&arg[]=nordic-theme&arg[]=nordzy-cursors&arg[]=obs-cli&arg[]=obs-pipewire-audio-capture-bin&arg[]=oddjob&arg[]=openrazer-daemon&arg[]=openrazer-driver-dkms&arg[]=openrazer-meta&arg[]=openrgb&arg[]=phoronix-test-suite&arg[]=pikaur&arg[]=polychromatic&arg[]=powerline-console-fonts-git&arg[]=protontricks&arg[]=python-openrazer&arg[]=qt5-styleplugins&arg[]=rasdaemon&arg[]=renderdoc-bin&arg[]=rusticl-mesa-minimal-git&arg[]=sc-controller&arg[]=snapborg&arg[]=spirv-headers-git&arg[]=spirv-llvm-translator-minimal-git&arg[]=spirv-tools-git&arg[]=stressapptest&arg[]=systemd-numlockontty&arg[]=teams&arg[]=teamviewer&arg[]=ttf-ms-win11&arg[]=twinkle&arg[]=ucommon&arg[]=update-grub&arg[]=urlview&arg[]=vkbasalt&arg[]=vmware-keymaps&arg[]=vmware-workstation&arg[]=wl-mirror&arg[]=wol-systemd&arg[]=xdg-desktop-portal-wlr-git&arg[]=y-cruncher&arg[]=yp-tools&arg[]=yt-dlp-drop-in&arg[]=zenpower3-dkms
                                                     :: debug: install_info_fetcher: got AUR pkgs install info: []
                                                                                                                  => pacman --color=always --query --upgrades --quiet
           => pacman --color=always --sync groff --print-format %r/%n
                                                                     :: Ignoring package update clang-libs-minimal-git (17.0.0_r466710.7cea22c0be95-1 => devel) (ignored in Pacman config)
                                :: Ignoring package update clang-minimal-git (17.0.0_r466710.7cea22c0be95-1 => devel) (ignored in Pacman config)
                                                                                                                                                :: Ignoring package update lib32-llvm-libs-minimal-git (17.0.0_r466713.5b666cf11e7a-1 => devel) (ignored in Pacman config)
                                                                                                                :: Ignoring package update lib32-llvm-minimal-git (17.0.0_r466713.5b666cf11e7a-1 => devel) (ignored in Pacman config)
                                                                           :: Ignoring package update lib32-mesa-minimal-git (23.2.0_devel.174082.ad980dc699e-1 => devel) (ignored in Pacman config)
                                          :: Ignoring package update libclc-minimal-git (17.0.0_r466710.7cea22c0be95-1 => devel) (ignored in Pacman config)
 :: Ignoring package update llvm-libs-minimal-git (17.0.0_r466710.7cea22c0be95-1 => devel) (ignored in Pacman config)
                                                                                                                     :: Ignoring package update llvm-minimal-git (17.0.0_r466710.7cea22c0be95-1 => devel) (ignored in Pacman config)
                                                                          :: Ignoring package update mesa-minimal-git (23.2.0_devel.174082.ad980dc699e-1 => devel) (ignored in Pacman config)
                                   :: Ignoring package update rusticl-mesa-minimal-git (23.2.0_devel.174082.ad980dc699e-1 => devel) (ignored in Pacman config)
    :: Ignoring package update spirv-headers-git (1:1.3.250.0.r20.gd0006a3-1 => devel) (ignored in Pacman config)
                                                                                                                 :: Ignoring package update spirv-llvm-translator-minimal-git (1:r1812.2cea844-1 => devel) (ignored in Pacman config)
                                                                           :: Ignoring package update spirv-tools-git (1:r3720.870fd1e-1 => devel) (ignored in Pacman config)
                   :: debug: install_cli: self.install_info.all_install_info_containers=([], [], [], [<RepoInstallInfo "groff" 1.23.0-1.1 -> 1.23.0-2.1>], [], [], [], [])
                :: debug: news: print
                                     :: debug: news: loading date from /home/username/.cache/pikaur/last_seen_news.dat
                                                                                                                     :: debug: news: data: Sun, 18 Jun 2023 09:14:37 +0000, parsed: 2023-06-18 09:14:37+00:00
                                                   :: debug: news: Arch News Date: 2023-06-18 09:14:37+00:00, Last-seen date: 2023-06-18 09:14:37+00:00

                                                                                                                                                       :: Third-party repository package will be installed:
                                                  cachyos-core-v3/groff                 1.23.0-1.1           -> 1.23.0-2.1          2.45 MiB

                                                                                                                                            Total Download Size:      2.45 MiB
                    Total Installed Size:    10.04 MiB

                                                      :: debug: prompt: Gonna get input from user...
                                                                                                    :: debug: FileLock: Acquiring /tmp/pikaur_prompt_54678.lock...
        :: debug: FileLock: Acquired /tmp/pikaur_prompt_54678.lock
                                                                  :: debug: prompt_nolock: Restoring TTY...
                                                                                                           :: debug: prompt_nolock: Using standard input reader...
:: Proceed with installation? [Y/n]
:: [v]iew package details   [m]anually select packages
>>
:: debug: prompt_nolock: Reverting to prev TTY state...
:: debug: FileLock: Releasing /tmp/pikaur_prompt_54678.lock
                                                           :: debug: FileLock: Released /tmp/pikaur_prompt_54678.lock
                                                                                                                     :: debug: prompt: No answer provided - using "Y".

            pikspect => sudo pacman --color=always --sync --verbose --sysupgrade
                                                                                :: debug: pikspect: Opening virtual terminal...
                                                                                                                               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
                                                                                                  :: Starting full system upgrade...
                                                                                                                                    warning: grub: local (2:2.06.r591.g6425c12cd-1.1) is newer than cachyos-v3 (2:2.06.r499.ge67a551a4-1)
                                                                               warning: llvm-libs: local (15.0.7-3.1) is newer than extra (15.0.7-3)
                                                                                                                                                    warning: tree: local (2.1.1-1) is newer than cachyos-extra-v3 (2.1.0-1.1)
                                                                   resolving dependencies...
                                                                                            looking for conflicting packages...

                                                                                                                               Packages (1) groff-1.23.0-2.1

  Total Installed Size:  10,04 MiB
                                  Net Upgrade Size:       0,00 MiB

                                                                  :: Proceed with installation? [Y/n]

And terminal is stuck after asking a second time to "Proceed with installation".

@cg00001
Copy link

cg00001 commented Jul 13, 2023

I got the same using kitty, I press Enter to confirm, then Enter again to reinstall failed package, then it works.
#728

@jibarofoss
Copy link

Same is happening to me on Konsole.

@pezz
Copy link

pezz commented Jul 13, 2023

This might sound a bit off-topic, but has anyone noticed that colours have stopped working in the pager "most" as well?

Just thought I'd ask in case there's something deeper wrong with Arch's environment now (and this issue is not pikaur actually doing something wrong).

Cheers.

@pezz
Copy link

pezz commented Jul 13, 2023

Found out what's up with pikaur anyway, it's to do with the new version of sudo.

Downgrading from 1.9.14.p1-1 back to 1.9.13.p3-1 and there's no display issue.

@pezz
Copy link

pezz commented Jul 13, 2023

Fix here:

https://bugs.archlinux.org/task/79088

Defaults !use_pty

@actionless
Copy link
Owner

Thanks for reporting!
You can check with pikaur-git AUR package if it works for you now.

@actionless
Copy link
Owner

actionless commented Jul 14, 2023

Found out what's up with pikaur anyway, it's to do with the new version of sudo.

now it should work normally with default sudo config, without unsafe modifications

@pezz
Copy link

pezz commented Jul 14, 2023

1.16-1 seems to be broken.

It runs sudo unnecessarily now and you can't hit enter on the sudo prompt.

@cg00001
Copy link

cg00001 commented Jul 14, 2023

1.16-1 seems to be broken.

It runs sudo unnecessarily now and you can't hit enter on the sudo prompt.

Latest pikaur runs fine here with current sudo -without the fix.

~►pikaur -Syu  gnome-tweaks                                                 0.127s
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
 home_metakcahura_kernel_Arch_Extra_standard is up to date
 rumpowered is up to date
 chaotic-aur is up to date

:: Starting full AUR upgrade...
Reading repository package databases...
Reading local package database...
Reading AUR packages info...

:: Repository package will be installed:
 gnome-tweaks                 42beta+r14+g2d9d76c-3  -> 42beta+r14+g2d9d76c-3 0.27 MiB

Total Download Size:      0.27 MiB
Total Installed Size:     1.18 MiB

:: Proceed with installation? [Y/n] 
:: [v]iew package details   [m]anually select packages
>>  y

warning: gnome-tweaks-42beta+r14+g2d9d76c-3 is up to date -- reinstalling
:: Starting full system upgrade...
warning: mcomix-git: local (2.2.1.r12.g906b417-1) is newer than chaotic-aur (r1681.6bb3069-1)
warning: python-httpcore: local (0.17.3-1) is newer than extra (0.17.2-1)
resolving dependencies...
looking for conflicting packages...

warning: insufficient columns available for table display
Packages (1) gnome-tweaks-42beta+r14+g2d9d76c-3

Total Download Size:   0.27 MiB
Total Installed Size:  1.18 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n] Y
:: Retrieving packages...
 gnome-tweaks-42b...   278.2 KiB   740 KiB/s 00:00 [--------------] 100%
(1/1) checking keys in keyring                     [--------------] 100%
(1/1) checking package integrity                   [--------------] 100%
(1/1) loading package files                        [--------------] 100%
(1/1) checking for file conflicts                  [--------------] 100%
(1/1) checking available disk space                [--------------] 100%
:: Processing package changes...
(1/1) reinstalling gnome-tweaks                    [--------------] 100%
:: Running post-transaction hooks...
(1/5) Arming ConditionNeedsUpdate...
(2/5) Compiling GSettings XML schema files...
(3/5) Updating icon theme caches...
(4/5) Checking which packages need to be rebuilt
(5/5) Updating the desktop file MIME type cache...

@pezz
Copy link

pezz commented Jul 14, 2023

Hmm, not for me.. Latest sudo and pikaur without the pty workaround:

% pikaur -Syu
[sudo] password for pezz: 
:: Synchronizing package databases...
 core is up to date
 extra is up to date

:: Starting full AUR upgrade...
Reading repository package databases...
Reading local package database...
Reading AUR packages info...

[sudo] password for pezz: 
sudo: a password is required
Command 'sudo pacman --color=always --sync --sysupgrade' failed to execute.
Do you want to retry? [Y/n] 

Canceled by user (SIGINT)

It prompts correctly for sudo on the first go, but then prompts again and the input isn't handled properly, have to ^C to get out of it.

@pezz
Copy link

pezz commented Jul 14, 2023

@cg00001 I'm guessing you have a config that allows your user or group to sudo without a password?

I do not see the issue if I configure sudo to allow me with NOPASSWD.

@duelle
Copy link
Author

duelle commented Jul 14, 2023

With the latest version (1.16) the output is not distorted anymore, but the sudo prompt seems to block.

:: Repository packages will be installed:
 fakeroot                              1.32-1               -> 1.32.1-1            0.07 MiB
 scribus                               1.5.8-19             -> 1.5.8-20            50.16 MiB

Total Download Size:     50.23 MiB
Total Installed Size:   131.81 MiB

:: Proceed with installation? [Y/n] 
:: [v]iew package details   [m]anually select packages
>> 

[sudo] password for duelle:

Then it seems to be blocked. Return does not have any effect. Need to Ctrl+C to get out of it.

@actionless
Copy link
Owner

thanks for more info - i'll check it further today

@actionless actionless reopened this Jul 14, 2023
@actionless actionless changed the title Shifted output during '-Syu' upgrade sudo and pty migration Jul 14, 2023
@actionless actionless changed the title sudo and pty migration sudo and pty migration issues Jul 14, 2023
@pezz
Copy link

pezz commented Jul 14, 2023

As a quick, hacky workaround until this is fixed, you can temporarily set NOPASSWD for your user or group and do updates.

@duelle
Copy link
Author

duelle commented Jul 14, 2023

thanks for more info - i'll check it further today

Thank you so much for your efforts!

@pezz
Copy link

pezz commented Jul 14, 2023

Tested latest git master, this lets you enter at the prompt now, but if I've already sudo'ed recently I still get prompted for a password the second time.

Is this pikaur or sudo causing this?

Edit: this has to be pikaur, I can repeatedly run sudo commands after an initial password entry.

% pikaur -Syu
:: Synchronizing package databases...
 core is up to date
 extra is up to date

:: Starting full AUR upgrade...
Reading repository package databases...
Reading local package database...
Reading AUR packages info...

[sudo] password for pezz:               <--- Why the second prompt? It's already run pacman with sudo
:: Starting full system upgrade...
 there is nothing to do

@actionless
Copy link
Owner

yeah, it seems to be a side-effect of new pty-based design of pikspect module - each pacman command is running inside its own virtual terminal - so it's basically behaving like if you'd be running pacman commands in separate terminals - this require designing new SudoLoop, which would be acting as sudo-ed process which would be spawing all next processes from itself without sudo-ing

@actionless actionless reopened this Jul 14, 2023
@pezz
Copy link

pezz commented Jul 14, 2023

Many thanks for re-opening this, yet again, in order to solve this.

Love your work, pikaur is the best AUR helper out there.

@cg00001
Copy link

cg00001 commented Jul 14, 2023

@cg00001 I'm guessing you have a config that allows your user or group to sudo without a password?

I do not see the issue if I configure sudo to allow me with NOPASSWD.

Yes.

@actionless
Copy link
Owner

i myself have nopasswd for pacman executable configured - so i didn't noticed the problem at first place

@pezz
Copy link

pezz commented Jul 14, 2023

NOPASSWD just on pacman is an ok workaround for this actually.

But the old behaviour is more desirable (sudo with password if you need to, then everything else follows).

@cg00001
Copy link

cg00001 commented Jul 14, 2023

@actionless

use_pty
If set, and sudo is running in a terminal, the command will be run in a new
pseudo-terminal. If the sudo process is not attached to a terminal, use_pty has
no effect. A malicious program run under sudo may be capable of injecting
commands into the user's terminal or running a background process that retains
access to the user's terminal device even after the main program has finished
executing. By running the command in a separate pseudo-terminal, this attack is
no longer possible. This flag is on by default for sudo 1.9.14 and above.If set,
and sudo is running in a terminal, the command will be run in a new
pseudo-terminal. If the sudo process is not attached to a terminal, use_pty has
no effect. A malicious program run under sudo may be capable of injecting
commands into the user's terminal or running a background process that retains
access to the user's terminal device even after the main program has finished
executing. By running the command in a separate pseudo-terminal, this attack is
no longer possible. This flag is on by default for sudo 1.9.14 and above.

https://man.archlinux.org/man/sudoers.5#SUDOERS_OPTIONS

@switit
Copy link

switit commented Jul 15, 2023

With the latest version (1.16) the output is not distorted anymore, but the sudo prompt seems to block.

:: Repository packages will be installed:
 fakeroot                              1.32-1               -> 1.32.1-1            0.07 MiB
 scribus                               1.5.8-19             -> 1.5.8-20            50.16 MiB

Total Download Size:     50.23 MiB
Total Installed Size:   131.81 MiB

:: Proceed with installation? [Y/n] 
:: [v]iew package details   [m]anually select packages
>> 

[sudo] password for duelle:

Then it seems to be blocked. Return does not have any effect. Need to Ctrl+C to get out of it.

Re-installing pikaur from scratch solved the problem for me.

@actionless
Copy link
Owner

also, instead of implementing new sort of sudo loop
i've got alternative idea - to use mechanism similar to existing DynamicUsers - but instead of using dynamic users - just use the current user, ie the algo will be as follow:

  1. when pikaur invoked - record user id
  2. re-exec pikaur with sudo
  3. run commands needed to be run as user (ie makepkg) - as user id recorded in pt.1

the good thing about going with this solution - that it would require the minimal amount of code (and potential new bugs) - since it will be mostly re-using existing code for systemd DynamicUsers support

@actionless
Copy link
Owner

also, for network requests, i think might be useful to spawn a thread running with os.setuid to that original user id as well

not like urgent but would be nice to have

@actionless
Copy link
Owner

actionless commented Jul 15, 2023

pass user-id and config-path as arguments when sudo-ing pikaur, as a bonus that would make those cli flags available to use manually as well, for example to have specific user dedicated to only run pikaur

(and to add user-id option to config as well)

@actionless
Copy link
Owner

please do some testing before i'll do the release

@actionless
Copy link
Owner

actionless commented Jul 15, 2023

warning - if you had pacman set for nopasswd in sudo config - that would stop working in pikaur, as now it's elevating privilege as pikaur, not as pacman

@actionless
Copy link
Owner

warning - if you had pacman set for nopasswd in sudo config - that would stop working in pikaur, as now it's elevating privilege as pikaur, not as pacman

now i also [optionally] returned that behavior with the new config option:
https://github.com/actionless/pikaur#privilegeescalationtarget-default-pikaur

@pezz
Copy link

pezz commented Jul 15, 2023

Tested latest master here, and everything is working as it did before.

Using latest sudo, no changes to my pikaur config and no !pty workaround.

One thing to keep an eye on which was mentioned in the Arch bug, is that sudo made a fix as well, so not sure how this will affect pikaur once the new version comes out, will have to wait and see.

sudo-project/sudo#258 (comment)

Thanks again @actionless

@pezz
Copy link

pezz commented Jul 16, 2023

Found an additional issue now, something to do with running as root.

Unable to build because of how directories are being created (this is using latest master):

% pikaur -S oolite
Reading repository package databases...
Reading local package database...
Resolving AUR dependencies...

:: New dependencies will be installed from repository:
 core/gcc-objc (for oolite)                                 -> 13.1.1-1            23.11 MiB
 extra/gnustep-base (for oolite)                            -> 1.29.0-2            2.13 MiB
 extra/gnustep-make (for oolite)                            -> 2.9.1-1             0.17 MiB
 extra/libmikmod (for sdl_mixer)                            -> 3.3.11.1-6          0.20 MiB
 extra/sdl_image (for oolite)                               -> 1.2.12-8            0.03 MiB
 extra/sdl_mixer (for oolite)                               -> 1.2.12-12           0.07 MiB

:: AUR package will be installed:
 oolite                                                     -> 1.90-4

:: New dependency will be installed from AUR:
 espeak (for oolite)                                        -> 1:1.48.04-4

Total Download Size:     25.71 MiB
Total Installed Size:    87.34 MiB

:: Proceed with installation? [Y/n] 
:: [v]iew package details   [m]anually select packages
>> 
Can't clone 'espeak' in '/home/pezz/.local/share/pikaur/aur_repos/espeak' from AUR:

fatal: destination path '/home/pezz/.local/share/pikaur/aur_repos/espeak' already exists and is not an empty directory.

:: Try recovering?
[T] try again
[c] git checkout -- '*'
[r] remove dir and clone again
[p] git stash && ... && git stash pop
[s] skip this package
[a] abort
> 

Canceled by user (SIGINT)

% ll /home/pezz/.local/share/pikaur/aur_repos        
total 16
drwx------ 4 pezz pezz 4096 Jul 16 12:55 .
drwx------ 3 pezz pezz 4096 Jul 16 12:54 ..
drwx------ 2 root root 4096 Jul 16 12:55 espeak
drwx------ 2 root root 4096 Jul 16 12:55 oolite

@actionless
Copy link
Owner

thanks @pezz , i'll look into it now

@actionless
Copy link
Owner

please check if it works for you

@actionless
Copy link
Owner

(you'll have to remove or chown those directories which got created with wrong permissions)

@pezz
Copy link

pezz commented Jul 16, 2023

Using 1.17 as released on the AUR and things are looking good.

@switit
Copy link

switit commented Jul 17, 2023

1.17 works provided that sudo has been upgraded to the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants