### Bug description

** THIS MIGHT BE RELATED TO ISSUE:**  https://github.com/quarto-dev/quarto-cli/issues/909#issue-1238560733

When attempting to preview or render a QMD file with a PDF format output, quarto attempts to update packages in TeX Live and fails to do it. The following is a minimal example that gives the error

I have checked with RStudio and I receive the same error (with a different QMD file of course). This is a bug on quarto

~~~
---
title: TLMGR Problems
format: pdf
---

**Hello World!**

```{python}
d="Hello World!"
```
~~~

```
% quarto preview minimaltest.qmd 

Starting python3 kernel...Done

Executing 'minimaltest.ipynb'
  Cell 1/1...Done

pandoc 
  to: latex
  output-file: minimaltest.tex
  standalone: true
  pdf-engine: xelatex
  variables:
    graphics: true
    tables: true
  default-image-extension: pdf
  
metadata
  documentclass: scrartcl
  classoption:
    - DIV=11
    - numbers=noendperiod
  papersize: letter
  header-includes:
    - '\KOMAoption{captions}{tableheading}'
  block-headings: true
  title: TLMGR Problems
  
running xelatex - 1
  This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode
  
updating tlmgr

updating existing packages

compilation failed- missing packages (automatic installation failed)
```

This behavior does not show up when the output is changed from PDF to HTML

```
quarto preview minimaltest.qmd

Starting python3 kernel...Done

Executing 'minimaltest.ipynb'
  Cell 1/1...Done

pandoc 
  to: html
  output-file: minimaltest.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png
  
metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en
  title: TLMGR Problems
  
Output created: minimaltest.html

Watching files for changes
Browse at http://localhost:4853/
```

My setup is as following:

OS: OS X 11.6.8
account: user has sudo privileges (but it is not the admin)
quarto: 1.0.37
conda: 4.13.0
python: 3.10.5
Julia: 1.7.3
jupyter:
- jupyter                   1.0.0           py310h2ec42d9_7    conda-forge
- notebook                  6.4.12             pyha770c72_0    conda-forge
- jupyter_client            7.3.4              pyhd8ed1ab_0    conda-forge
- jupyter_console           6.4.4              pyhd8ed1ab_0    conda-forge
- jupyter_core              4.11.1          py310h2ec42d9_0    conda-forge
- jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
- jupyterlab_widgets        1.1.1              pyhd8ed1ab_0    conda-forge

nbconvert:
- nbconvert                 6.5.0              pyhd8ed1ab_0    conda-forge
- nbconvert-core            6.5.0              pyhd8ed1ab_0    conda-forge
- nbconvert-pandoc          6.5.0              pyhd8ed1ab_0    conda-forge
- nbformat                  5.4.0              pyhd8ed1ab_0    conda-forge

tlmgr:
- tlmgr revision 63068 (2022-04-18 07:58:07 +0200)
- tlmgr using installation: /usr/local/texlive/2022
- TeX Live (https://tug.org/texlive) version 2022

tlmgr has been updated by using the utility provided by MacTeX 2022: TeX Live Utility.app, all packages has been updated.

The same behavior appear is instead of having the full MacTeX 2022 distribution (TeX Live) I have the tinyTeX.

Quarto has been installed locally and globally and in both cases the result is the same

To preview I have attempted to prepend the command with **sudo** but the result is the same. All of these has been run in a terminal. Finally I am attaching the output run with the **--verbose** option 

```
(quarto) heberto@kepler quarto % quarto preview minimaltest.qmd --verbose

Starting python3 kernel...Done

Executing 'minimaltest.ipynb'
  Cell 1/1...Done

pandoc --verbose
  to: latex
  output-file: minimaltest.tex
  standalone: true
  pdf-engine: xelatex
  variables:
    graphics: true
    tables: true
  default-image-extension: pdf
  
metadata
  documentclass: scrartcl
  classoption:
    - DIV=11
    - numbers=noendperiod
  papersize: letter
  header-includes:
    - '\KOMAoption{captions}{tableheading}'
  block-headings: true
  title: TLMGR Problems
  
[INFO] Loaded /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/template.patched from /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/template.patched
[INFO] Loaded /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/doc-class.tex from /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/doc-class.tex
[INFO] Loaded /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/pandoc.tex from /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/pandoc.tex
[INFO] Loaded /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/tightlist.tex from /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/tightlist.tex
[INFO] Loaded /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/tables.tex from /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/tables.tex
[INFO] Loaded /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/graphics.tex from /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/graphics.tex
[INFO] Loaded /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/citations.tex from /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/citations.tex
[INFO] Loaded /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/title.tex from /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/title.tex
[INFO] Loaded /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/before-body.tex from /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/before-body.tex
[INFO] Loaded /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/toc.tex from /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/toc.tex
[INFO] Loaded /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/before-bib.tex from /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/before-bib.tex
[INFO] Loaded /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/biblio.tex from /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/biblio.tex
[INFO] Loaded /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/after-body.tex from /var/folders/jm/ljt12vhj31ggqg5dmbfvk6lh0000gn/T/quarto-session373afdca/40df8cf6/e9f0efca/after-body.tex
[INFO] Running filter /Users/heberto/Applications/quarto/share/filters/quarto-init/quarto-init.lua
[INFO] Completed filter /Users/heberto/Applications/quarto/share/filters/quarto-init/quarto-init.lua in 9 ms
[INFO] Running filter /Users/heberto/Applications/quarto/share/filters/authors/authors.lua
[INFO] Completed filter /Users/heberto/Applications/quarto/share/filters/authors/authors.lua in 9 ms
[INFO] Running filter /Users/heberto/Applications/quarto/share/filters/quarto-pre/quarto-pre.lua
[INFO] Completed filter /Users/heberto/Applications/quarto/share/filters/quarto-pre/quarto-pre.lua in 12 ms
[INFO] Running filter /Users/heberto/Applications/quarto/share/filters/crossref/crossref.lua
[INFO] Completed filter /Users/heberto/Applications/quarto/share/filters/crossref/crossref.lua in 9 ms
[INFO] Running filter /Users/heberto/Applications/quarto/share/filters/layout/layout.lua
[INFO] Completed filter /Users/heberto/Applications/quarto/share/filters/layout/layout.lua in 25 ms
[INFO] Running filter /Users/heberto/Applications/quarto/share/filters/quarto-post/quarto-post.lua
[INFO] Completed filter /Users/heberto/Applications/quarto/share/filters/quarto-post/quarto-post.lua in 9 ms
[INFO] Running filter /Users/heberto/Applications/quarto/share/filters/quarto-finalize/quarto-finalize.lua
[INFO] Completed filter /Users/heberto/Applications/quarto/share/filters/quarto-finalize/quarto-finalize.lua in 7 ms
running xelatex - 1
  This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode
  
updating tlmgr

updating existing packages

compilation failed- missing packages (automatic installation failed)
```

### `quarto check` Output

```

[✓] Checking Quarto installation......OK
      Version: 1.0.37
      Path: /Users/heberto/Applications/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.10.5 (Conda)
      Path: /Users/heberto/opt/miniconda3/envs/quarto/bin/python
      Jupyter: 4.11.1
      Kernels: julia-1.7, python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.2.0
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.2/Resources/library
      rmarkdown: 2.14

[✓] Checking Knitr engine render......OK
```

### `quarto tools check` Output

```
Tool         Status            Installed     Latest  
chromium     Not installed     ---           869685  
tinytex      Not installed     ---           v2022.08
```

### Checklist

- [X] [formatted your issue](https://yihui.org/issue/#please-format-your-issue-correctly) so it is easier for us to read?
- [X] included a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] documented the quarto version you're running, by pasting the output from running `quarto check` in the "Quarto Check Output" text area?
- [X] documented the version of the quarto tools you're running, by providing the output from running `quarto tools check` in the "Quarto Tools Check Output" text area?
- [ ] documented the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] documented which operating system you're running? If on Linux, please provide the specific distribution as well.
- [ ] upgraded to the latest version, including your versions of R, the RStudio IDE, and relevant R packages?
dragonstyle
2022-08-03T12:00:53Z
hebertodelrio
bug
Future
open
Quarto trying to update tlmgr fails
https://github.com/quarto-dev/quarto-cli/issues/1659