OfficeDev / Office-Addin-Scripts

A set of scripts and packages that are consumed in Office add-ins projects.
MIT License
156 stars 99 forks source link

Unable to install the CA certificate. sudo: /usr/sbin/update-ca-certificates: command not found #765

Closed thoriqadillah closed 1 year ago

thoriqadillah commented 1 year ago

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

Expected behavior

Unable to start the dev server. Error: Unable to install the CA certificate. sudo: /usr/sbin/update-ca-certificates: command not found after executing npm run start:web -- --document {url}

Current behavior

After following the documentation for excel add in custom function, the error is happening after npm run start:web -- --document {url} that states Unable to start the dev server. Error: Unable to install the CA certificate. sudo: /usr/sbin/update-ca-certificates: command not found in Fedora 37. I have tried both in windows and linux. The windows setup is working fine, add in dev server is working and I can start coding and testing the add in. But in linux, it doesn't work. I have checked that I have ca-certificates package installed

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Generate the project
  2. Follow the documentation for getting started in developing custom function
  3. you get it...

Context

Failure Logs

Debugging is being started...
App type: web
The developer certificates have been generated in /home/thoriqadillah/.office-addin-dev-certs
Installing CA certificate "Developer CA for Microsoft Office Add-ins"...
[sudo] password for thoriqadillah: 
Unable to start the dev server. Error: Unable to install the CA certificate. sudo: /usr/sbin/update-ca-certificates: command not found

Sideloading the Office Add-in...
Launching excel via https://onedrive.live.com/edit.aspx?action=editnew&resid=3627B748A810A8C!1898&ithint=file%2cxlsx&action=editnew&ct=1678690455451&wdNewAndOpenCt=1678690455451&wdPreviousSession=6fce27c0-f22c-40a8-a5a3-432ed546abbe&wdOrigin=OFFICECOM-WEB.START.NEW&wdaddindevserverport=3000&wdaddinmanifestfile=manifest.xml&wdaddinmanifestguid=14d9b067-9582-40d9-93da-e641cf520d56
Debugging started.
parvathirajan commented 1 year ago

same error, while running the npm run dev-server. Any solution for this?

> office-addin-taskpane-react-js@0.0.1 dev-server
> webpack serve --mode development

The developer certificates have been generated in /home/par3836/.office-addin-dev-certs
Installing CA certificate "Developer CA for Microsoft Office Add-ins"...
[webpack-cli] Error: Unable to install the CA certificate. sudo: /usr/sbin/update-ca-certificates: command not found
millerds commented 1 year ago

The packages are attempting to run some commands to install the certificate needed to serve up the add-in content. I don't have a linux box to try this out, but the commands being run are:

sudo mkdir -p /usr/local/share/ca-certificates/office-addin-dev-certs sudo cp ${caCertificatePath} /usr/local/share/ca-certificates/office-addin-dev-certs sudo /usr/sbin/update-ca-certificates

The last one seems to be failing, but from what I can tell online it's still a valid command. You could try it manually (once the cert is installed you are good for a while). Is there a better command that should be used?

dorkster100 commented 1 year ago

The linux in question is probably not an Ubuntu, and the update-ca-certificates does not exist there. I have the same issue, and in my case I have Arch Linux, which uses update-ca-trust command for this.

SunSparc commented 10 months ago

This fails if sudo is not installed. Even if the script is being run as root (which does not need sudo). After install sudo, the script continues. Seems like the script could at least try or check for the need to use sudo before using it and then failing if the system does not have it installed.

vmo-cmeisner commented 10 months ago

This fails if sudo is not installed. Even if the script is being run as root (which does not need sudo). After install sudo, the script continues. Seems like the script could at least try or check for the need to use sudo before using it and then failing if the system does not have it installed.

This exactly. I don't really want/need to have sudo installed.

millerds commented 10 months ago

The code for the certificate management script is in packages/office-addin-dev-certs/scripts/*linux.sh of this repo. Feel free to submit a PR that does a better job at installing the necessary certs across the different flavors of linux (it will be faster than waiting for us).