Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/01_bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ body:
attributes:
value: >
**Note**: Assuming you have network connectivity,
you can easily post the installation log using the following command:
`curl -F'file=@/var/log/archinstall/install.log' https://0x0.st`
you can easily upload the installation log and get a shareable URL by running:
`archinstall --share-log`

- type: textarea
id: freeform
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ If you come across any issues, kindly submit your issue here on GitHub or post y
When submitting an issue, please:
* Provide the stacktrace of the output if applicable
* Attach the `/var/log/archinstall/install.log` to the issue ticket. This helps us help you!
* To extract the log from the ISO image, one way is to use<br>
* To upload the log from the ISO image and get a shareable URL, run<br>
```shell
curl -F'file=@/var/log/archinstall/install.log' https://0x0.st
archinstall --share-log
```


Expand Down
7 changes: 7 additions & 0 deletions archinstall/lib/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Arguments:
skip_wifi_check: bool = False
advanced: bool = False
verbose: bool = False
share_log: bool = False


@dataclass
Expand Down Expand Up @@ -431,6 +432,12 @@ def _define_arguments(self) -> ArgumentParser:
default=False,
help='Enabled verbose options',
)
parser.add_argument(
'--share-log',
action='store_true',
default=False,
help='Upload /var/log/archinstall/install.log to paste.rs and print the URL, then exit',
)

return parser

Expand Down
71 changes: 71 additions & 0 deletions archinstall/lib/share_log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import sys

from archinstall.lib.command import SysCommand
from archinstall.lib.exceptions import SysCallError
from archinstall.lib.output import logger

# paste.rs is a minimal text pastebin with syntax highlighting by extension.
# 10 MiB is its documented upload limit.
_PASTE_URL = 'https://paste.rs'
_PASTE_MAX_SIZE = 10 * 1024 * 1024


def share_install_log() -> int:
"""Upload /var/log/archinstall/install.log to paste.rs and print the URL.

Intended for users to paste the URL into a GitHub issue when reporting a
bug. Always asks for explicit confirmation - the log may contain hostname,
mirror URLs, package list, partition layout and other system details which
become public on upload.

All diagnostic output goes to stderr instead of the standard log helpers,
so the file we are about to upload is not modified by this command.
"""
log_path = logger.path

if not log_path.exists():
print(f'Log file not found: {log_path}', file=sys.stderr)
return 1

size = log_path.stat().st_size
if size == 0:
print(f'Log file is empty: {log_path}', file=sys.stderr)
return 1

if size > _PASTE_MAX_SIZE:
print(
f'Log file is too large to share: {size} bytes (limit: {_PASTE_MAX_SIZE} bytes). Trim it or upload manually.',
file=sys.stderr,
)
return 1

print(f'About to upload {log_path} ({size} bytes) to {_PASTE_URL}', file=sys.stderr)
print(
'The log may contain hostname, mirror URLs, package list and partition layout. The uploaded paste is public.',
file=sys.stderr,
)

try:
answer = input('Continue? [y/N]: ').strip().lower()
except EOFError, KeyboardInterrupt:
print(file=sys.stderr)
return 1

if answer not in ('y', 'yes'):
print('Cancelled.', file=sys.stderr)
return 1

try:
result = SysCommand(f'curl -sS --data-binary @{log_path} {_PASTE_URL}')
except SysCallError as e:
print(f'Upload failed: {e}', file=sys.stderr)
return 1

url = result.decode().strip()

if not url.startswith('http'):
print(f'Unexpected response from {_PASTE_URL}: {url[:200]!r}', file=sys.stderr)
return 1

print(url)
return 0
8 changes: 6 additions & 2 deletions archinstall/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from archinstall.lib.output import debug, error, info, warn
from archinstall.lib.packages.util import check_version_upgrade
from archinstall.lib.pacman.pacman import Pacman
from archinstall.lib.share_log import share_install_log
from archinstall.lib.translationhandler import tr, translation_handler
from archinstall.lib.utils.util import running_from_iso
from archinstall.tui.ui.components import tui
Expand Down Expand Up @@ -95,6 +96,9 @@ def run() -> int:
print(tr('Archinstall requires root privileges to run. See --help for more.'))
return 1

if arch_config_handler.args.share_log:
return share_install_log()

translation_handler.save_console_font()

_log_sys_info()
Expand Down Expand Up @@ -141,8 +145,8 @@ def _error_message(exc: Exception) -> None:
Archinstall experienced the above error. If you think this is a bug, please report it to
https://github.com/archlinux/archinstall and include the log file "/var/log/archinstall/install.log".

Hint: To extract the log from a live ISO
curl -F 'file=@/var/log/archinstall/install.log' https://0x0.st
Hint: To upload the log and get a shareable URL, run
archinstall --share-log
"""
)
warn(text)
Expand Down
2 changes: 1 addition & 1 deletion docs/help/report_bug.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ When submitting a help ticket, please include the :code:`/var/log/archinstall/in
It can be found both on the live ISO but also in the installed filesystem if the base packages were strapped in.

.. tip::
| An easy way to submit logs is ``curl -F 'file=@/var/log/archinstall/install.log' https://0x0.st``.
| An easy way to submit logs is ``archinstall --share-log``, which uploads ``install.log`` to paste.rs and prints a shareable URL.
| Use caution when submitting other log files, but ``archinstall`` pledges to keep ``install.log`` safe for posting publicly!
There are additional log files under ``/var/log/archinstall/`` that can be useful:
Expand Down
Loading