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

v3.50.2 Install fails for root on ubuntu 24.04.1 server #875

Open
cunneen opened this issue Nov 23, 2024 · 2 comments
Open

v3.50.2 Install fails for root on ubuntu 24.04.1 server #875

cunneen opened this issue Nov 23, 2024 · 2 comments
Labels
SDK Issue pertains to the SDK itself and not specific to any service

Comments

@cunneen
Copy link

cunneen commented Nov 23, 2024

I'm trying to install oci-cli (v3.50.2) on an ubuntu 24.04.1 server, as the root user.

I'm using the OCI Compute image with ID ocid1.image.oc1.ap-sydney-1.aaaaaaaabren6pndzvk3zx6yvsrlvuytl252gfffngbmdnnqiju2ns3n53mq (the November 20, 2024 image found here ).

I'm installing the install as part of cloud-init, which runs as the root user. The goal is for it to download some scripts from an object-store bucket, to bootstrap the system.

Interestingly, it installs without issue when I installed it manually as a non-root user.

As root user, running bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/refs/tags/v3.50.2/scripts/install/install.sh)" -- --accept-all-defaults:

  • Initially I ran into issue Error during installation #496 .

      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    
    basename: missing operand
    Try 'basename --help' for more information.
    WARNING: Some interactive prompts may not function correctly if this script is piped into bash (e.g. 'curl "https://
    raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh" | bash)'
    WARNING: Script should either be downloaded and invoked directly, or be run with the following command: bash -c "$(c
    url -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"
    Running with --accept-all-defaults
    Downloading Oracle Cloud Infrastructure CLI install script from https://raw.githubusercontent.com/oracle/oci-cli/v3.
    2.1/scripts/install/install.py to /tmp/oci_cli_install_tmp_PSjh.
    #=#=#                                                                          
    Running install script.
    python3 /tmp/oci_cli_install_tmp_PSjh  --accept-all-defaults
    /tmp/oci_cli_install_tmp_PSjh:524: SyntaxWarning: invalid escape sequence '\E'
      command = "powershell -Command \"[Environment]::SetEnvironmentVariable(\\\"PATH\\\", \\\"{};\\\" + (Get-ItemProper
    ty -Path 'Registry::HKEY_CURRENT_USER\Environment' -Name PATH).Path, \\\"User\\\")".format(exec_dir)  # noqa: W605
    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "/tmp/tmpyzrzgdme/virtualenv-20.6.0.pyz/__main__.py", line 168, in <module>
      File "/tmp/tmpyzrzgdme/virtualenv-20.6.0.pyz/__main__.py", line 164, in run
      File "/tmp/tmpyzrzgdme/virtualenv-20.6.0.pyz/virtualenv/__main__.py", line 18, in run
      File "/tmp/tmpyzrzgdme/virtualenv-20.6.0.pyz/virtualenv/run/__init__.py", line 32, in cli_run
      File "/tmp/tmpyzrzgdme/virtualenv-20.6.0.pyz/virtualenv/run/session.py", line 46, in run
      File "/tmp/tmpyzrzgdme/virtualenv-20.6.0.pyz/virtualenv/run/session.py", line 53, in _create
      File "/tmp/tmpyzrzgdme/virtualenv-20.6.0.pyz/virtualenv/create/creator.py", line 171, in run
      File "/tmp/tmpyzrzgdme/virtualenv-20.6.0.pyz/virtualenv/create/via_global_ref/builtin/via_global_self_do.py", line
     79, in create
      File "/tmp/tmpyzrzgdme/virtualenv-20.6.0.pyz/virtualenv/create/via_global_ref/builtin/via_global_self_do.py", line
     104, in ensure_directories
      File "/tmp/tmpyzrzgdme/virtualenv-20.6.0.pyz/virtualenv/create/describe.py", line 29, in bin_dir
      File "/tmp/tmpyzrzgdme/virtualenv-20.6.0.pyz/virtualenv/create/describe.py", line 33, in script_dir
      File "/tmp/tmpyzrzgdme/virtualenv-20.6.0.pyz/virtualenv/discovery/py_info.py", line 125, in install_path
    ValueError: too many values to unpack (expected 2)
    -- Verifying Python version.
    -- Python version 3.12.3 okay.
    -- Creating directory '/root/lib/oracle-cli'.
    -- We will install at '/root/lib/oracle-cli'.
    -- Creating directory '/root/bin'.
    -- The executable will be in '/root/bin'.
    -- Creating directory '/root/bin/oci-cli-scripts'.
    -- The scripts will be in '/root/bin/oci-cli-scripts'.
    -- The optional packages installed will be ''.
    -- Executing: ['', 'apt-get', 'update']
    -- System was unable to use venv, is going to download and create virtualenv.
    -- Downloading virtualenv package from https://github.com/pypa/get-virtualenv/blob/20.6.0/public/virtualenv.pyz?raw=
    true.
    -- Downloaded virtualenv package to /tmp/tmpyzrzgdme/virtualenv-20.6.0.pyz.
    -- Checksum of /tmp/tmpyzrzgdme/virtualenv-20.6.0.pyz OK.
    -- Executing: ['/usr/bin/python3', 'virtualenv-20.6.0.pyz', '/root/lib/oracle-cli']
    Traceback (most recent call last):
      File "/tmp/oci_cli_install_tmp_PSjh", line 257, in create_virtualenv
        install_python3_venv()
      File "/tmp/oci_cli_install_tmp_PSjh", line 204, in install_python3_venv
        exec_command(cmd)
      File "/tmp/oci_cli_install_tmp_PSjh", line 141, in exec_command
        subprocess.check_call(command_list, cwd=cwd, env=env)
      File "/usr/lib/python3.12/subprocess.py", line 408, in check_call
        retcode = call(*popenargs, **kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/subprocess.py", line 389, in call
        with Popen(*popenargs, **kwargs) as p:
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    PermissionError: [Errno 13] Permission denied: ''
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmp/oci_cli_install_tmp_PSjh", line 722, in <module>
        main()
      File "/tmp/oci_cli_install_tmp_PSjh", line 668, in main
        create_virtualenv(tmp_dir, install_dir)
      File "/tmp/oci_cli_install_tmp_PSjh", line 271, in create_virtualenv
        download_and_create_virtualenv(tmp_dir, install_dir)
      File "/tmp/oci_cli_install_tmp_PSjh", line 196, in download_and_create_virtualenv
        exec_command(cmd, cwd=working_dir)
      File "/tmp/oci_cli_install_tmp_PSjh", line 141, in exec_command
        subprocess.check_call(command_list, cwd=cwd, env=env)
      File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/usr/bin/python3', 'virtualenv-20.6.0.pyz', '/root/lib/oracle-cli']' retur
    ned non-zero exit status 1.
    
    
    • I progressed past this by installing python3-pip as described in that issue.
  • Then I ran into the issue below, whereby the script is looking in the wrong page for the pip executable:

    root@app1:~# bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/refs/tags/v3.50.2/scripts/install/install.sh)" -- --accept-all-defaults
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 16926  100 16926    0     0   390k      0 --:--:-- --:--:-- --:--:--  393k
    basename: missing operand
    Try 'basename --help' for more information.
    Running with --accept-all-defaults
    Downloading Oracle Cloud Infrastructure CLI install script from https://raw.githubusercontent.com/oracle/oci-cli/v3.2.1/scripts/install/install.py to /tmp/oci_cli_install_tmp_ZcWf.
    ############################################################################################################# 100.0%
    Running install script.
    python3 /tmp/oci_cli_install_tmp_ZcWf  --accept-all-defaults
    /tmp/oci_cli_install_tmp_ZcWf:524: SyntaxWarning: invalid escape sequence '\E'
      command = "powershell -Command \"[Environment]::SetEnvironmentVariable(\\\"PATH\\\", \\\"{};\\\" + (Get-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Environment' -Name PATH).Path, \\\"User\\\")".format(exec_dir)  # noqa: W605
    -- Verifying Python version.
    -- Python version 3.12.3 okay.
    -- Creating directory '/root/lib/oracle-cli'.
    -- We will install at '/root/lib/oracle-cli'.
    -- Creating directory '/root/bin'.
    -- The executable will be in '/root/bin'.
    -- Creating directory '/root/bin/oci-cli-scripts'.
    -- The scripts will be in '/root/bin/oci-cli-scripts'.
    -- The optional packages installed will be ''.
    -- Executing: ['', 'apt-get', 'update']
    -- System was unable to use venv, is going to download and create virtualenv.
    -- Downloading virtualenv package from https://github.com/pypa/get-virtualenv/blob/20.6.0/public/virtualenv.pyz?raw=true.
    -- Downloaded virtualenv package to /tmp/tmpulu8u8y_/virtualenv-20.6.0.pyz.
    -- Checksum of /tmp/tmpulu8u8y_/virtualenv-20.6.0.pyz OK.
    -- Executing: ['/usr/bin/python3', 'virtualenv-20.6.0.pyz', '/root/lib/oracle-cli']
    /usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
    !!
    
            ********************************************************************************
            Please avoid running ``setup.py`` directly.
            Instead, use pypa/build, pypa/installer or other
            standards-based tools.
    
            See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
            ********************************************************************************
    
    !!
      self.initialize_options()
    created virtual environment CPython3.12.3.final.0-64 in 143ms
      creator CPython3Posix(dest=/root/lib/oracle-cli, clear=False, no_vcs_ignore=False, global=False)
      seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
        added seed packages: pip==21.1.3, setuptools==57.1.0, wheel==0.36.2
      activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
    -- Executing: ['/root/lib/oracle-cli/bin/pip', 'install', '--cache-dir', '/tmp/tmpulu8u8y_', 'oci_cli', '--upgrade']
    Traceback (most recent call last):
      File "/tmp/oci_cli_install_tmp_ZcWf", line 722, in <module>
        main()
      File "/tmp/oci_cli_install_tmp_ZcWf", line 677, in main
        install_cli(install_dir, tmp_dir, cli_version, OPTIONAL_FEATURES)
      File "/tmp/oci_cli_install_tmp_ZcWf", line 319, in install_cli
        exec_command(cmd, env=env)
      File "/tmp/oci_cli_install_tmp_ZcWf", line 141, in exec_command
        subprocess.check_call(command_list, cwd=cwd, env=env)
      File "/usr/lib/python3.12/subprocess.py", line 408, in check_call
        retcode = call(*popenargs, **kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/subprocess.py", line 389, in call
        with Popen(*popenargs, **kwargs) as p:
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '/root/lib/oracle-cli/bin/pip'
    
    • local/ appears to be missing from the path:
      root@app1:~# ls -l /root/lib/oracle-cli/bin/pip
      ls: cannot access '/root/lib/oracle-cli/bin/pip': No such file or directory
      
      root@app1:~# ls -l /root/lib/oracle-cli/local/bin/pip
      -rwxr-xr-x 1 root root 242 Nov 23 09:20 /root/lib/oracle-cli/local/bin/pip
      
      root@app1:~# lsb_release -a
      No LSB modules are available.
      Distributor ID:	Ubuntu
      Description:	Ubuntu 24.04.1 LTS
      Release:	24.04
      Codename:	noble
      
@himanshudas75 himanshudas75 added the SDK Issue pertains to the SDK itself and not specific to any service label Nov 25, 2024
@himanshudas75
Copy link
Member

Investigating the issue

@skinkel
Copy link

skinkel commented Jan 6, 2025

Hello,

I hit the same issue using newest Ubuntu (with pip3 and python3 installed properly)

FileNotFoundError: [Errno 2] No such file or directory: '/root/lib/oracle-cli/bin/pip'

Now trying some quick and dirty tricks using venv pip or the global pip manually

pip install --cache-dir /tmp/tmp8x019e_7 oci_cli --upgrade
pip3 install --cache-dir /tmp/tmp8x019e_7 oci_cli --upgrade

and or setup the missing directory '/lib/oracle-cli/bin' manually before(!) the installation with all needed symlinks.

root@sge:/lib/oracle-cli/bin# ln -s /usr/bin/python3.12 python
root@sge:
/lib/oracle-cli/bin# ln -s python python3
root@sge:~/lib/oracle-cli/bin# ln -s python python3.12

but the install routine is not accepting N !

===> Remove this directory? (y/N): N
-- Deleted '/root/lib/oracle-cli'.
-- Creating directory '/root/lib/oracle-cli'.
-- We will install at '/root/lib/oracle-cli'.

Do you think it is fixble ?

Stefan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SDK Issue pertains to the SDK itself and not specific to any service
Projects
None yet
Development

No branches or pull requests

3 participants