ubuntu / ubuntu-make

Easy setup of common tools for developers on Ubuntu.
GNU General Public License v3.0
1.2k stars 189 forks source link

Getting "FileNotFoundError: [Errno 2] No such file or directory: 'adduser'" on Debian 11 while installing Arduino IDE #679

Closed N0rbert closed 1 year ago

N0rbert commented 1 year ago

Steps to reproduce:

  1. Have Debian 11 installed with MATE DE and SDDM

    sudo apt-get update -qq && sudo apt-get dist-upgrade -y sudo apt-get install task-mate-desktop sudo apt-get install sddm --no-install-recommends --no-install-suggests # select sddm instead of lightdm sudo reboot

    login to MATE session after reboot

  2. Install Ubuntu Make as Snap with

    sudo apt-get install -y snapd sudo snap install ubuntu-make --edge --classic

  3. Reboot and install Arduino IDE using umake:

    umake electronics arduino

Expected result - installation finished without errors.

Actual result - installation failed with below error:

Choose installation path: /home/d/.local/share/umake/electronics/arduino
Downloading and installing requirements                                                                                               |
100% |################################################################################################################################|
Installing Arduino
ERROR: Unhandled exception                                                                                                        #   |
concurrent.futures.process._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/snap/ubuntu-make/961/usr/lib/python3.8/concurrent/futures/process.py", line 239, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
  File "/snap/ubuntu-make/961/lib/python3.8/site-packages/umake/frameworks/electronics.py", line 48, in _add_to_group
    output = subprocess.check_output(["adduser", user, group])
  File "/snap/ubuntu-make/961/usr/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/snap/ubuntu-make/961/usr/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/snap/ubuntu-make/961/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/snap/ubuntu-make/961/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'adduser'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/snap/ubuntu-make/961/lib/python3.8/site-packages/umake/tools.py", line 159, in wrapper
    function(*args, **kwargs)
  File "/snap/ubuntu-make/961/lib/python3.8/site-packages/umake/frameworks/baseinstaller.py", line 497, in decompress_and_install_done
    self.post_install()
  File "/snap/ubuntu-make/961/lib/python3.8/site-packages/umake/frameworks/electronics.py", line 134, in post_install
    if not f.result():
  File "/snap/ubuntu-make/961/usr/lib/python3.8/concurrent/futures/_base.py", line 444, in result
    return self.__get_result()
  File "/snap/ubuntu-make/961/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
FileNotFoundError: [Errno 2] No such file or directory: 'adduser'
|#####################################################################################################################################|

Related old bug - https://github.com/ubuntu/ubuntu-make/issues/385 .

Additional info:

d@debian11:~$ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
d@debian11:~$ sudo grep -v ^# /etc/sudoers
Defaults    env_reset
Defaults    mail_badpass
Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

root    ALL=(ALL:ALL) ALL

%sudo   ALL=(ALL:ALL) ALL

@includedir /etc/sudoers.d

d@debian11:~$ groups 
d cdrom floppy sudo audio dip video plugdev netdev bluetooth
d@debian11:~$ id
uid=1000(d) gid=1000(d) groups=1000(d),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),108(netdev),110(bluetooth)
d@debian11:~$ which adduser
d@debian11:~$ dpkg -S bin/adduser
adduser: /usr/sbin/adduser
d@debian11:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin

d@debian11:~$ su -
Password: 
root@debian11:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
root@debian11:~# 

Some thoughts:

It seems that ubuntu-make grabs $PATH variable for normal user instead of sudoer. If it is possible, please apply some workaround into umake to prevent such unhandled exceptions while adding user to dialout group.

LyzardKing commented 1 year ago

I just pushed a change that should fix the debian case. It will also soon land in the edge snapcraft.

Please let me know if it works.

Remember that the Arduino v1 is now arduino-legacy The newer v2 is arduino

N0rbert commented 1 year ago

I'm not sure is it intended or not, but on Debian 11 it is still needed to use edge (976) version as follows:

snap refresh ubuntu-make --classic --edge
umake electronics arduino-legacy

When do you plan to copy edge to stable?

LyzardKing commented 1 year ago

I actually plan to automate it :wink: In any case I'll promote it now, so it should work soon.