Pamac feature request: option output to log file

I would like to have an option for pamac CLI to send output from pamac upgrade to a text file while keep showing progress and prompts on screen. I want to examine the output to catch pacnew and other warnings after the upgrade has completed.

When I upgrade Manjaro, I log out and switch to a tty and run

pamac upgrade --no-confirm  2>&1 | tee $HOME/pamac_upgrade.log

Then I run

sed 's/[\r].*//' $HOME/pamac_upgrade.log  | uniq > $HOME/pamac_upgrade.txt

to remove all the updating that shows progress for each package being downloaded and upgraded. The resulting text is far more legible than the raw output.

Using tee has the disadvantage that the output to screen is buffered, so sometimes it looks like the upgrade is stuck. Sometimes this is due to pamac waiting for my input, but the prompting is not shown on screen because of tee’s buffer.

Please make an option for pamac to create a log file, e.g. like

pamac upgrade --logfile /path/to/textfile

with the output from the upgrade process.

A similar question came up some time ago, but I can’t remember when or in what context - can’t find that thread right now.

The solution to the problem was to use the “script” command
as, for instance, described here.

Be careful - it will capture all input - passwords in clear text as well …

All is in log !

grep 'pacnew' /var/log/pacman.log
grep -E '2024-05.*warning' /var/log/pacman.log
...
grep 'removed' /var/log/pacman.log
2 Likes

Manjaro already has tools that can search for .pacnew files and load them into a comparison GUI tool for user to merge configuration

But I still use an older BASH script - gist.githb.com/nik-gnomic/pacnew-merge

For anyone who is not into the whole GUI thing - man pacdiff

1 Like

ok, without logs

for check permissions, we have pacman :

sudo pacman -Qkk 1>/dev/null

if error, with pacutils package, we have pacrepairfile command and other

Thank you for all the suggestions. To me /var/log/pacman.log is a rather noisy read, so I made this script:

#!/bin/sh
if test $# -gt 0 ; then pattern="$@"
else pattern="`date '+%y-%m-%d'`T"
fi
grep $pattern /var/log/pacman.log |
 awk 'BEGIN {IGNORECASE=1} /upgraded|downgraded|installed|removed|pacnew|warning/ {for(i=3;i<=NF;i++){printf "%s ", $i} ; printf "\n"}'

https://www.shellcheck.net/

Line 2:
if test $# -gt 0 ; then pattern="$@"
                                ^-- SC2124 (warning): Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.
 
Line 3:
else pattern="`date '+%y-%m-%d'`T"
              ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`.

Did you mean: (apply this, apply all SC2006)
else pattern="$(date '+%y-%m-%d')T"
 
Line 5:
grep $pattern /var/log/pacman.log |
     ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: (apply this, apply all SC2086)
grep "$pattern" /var/log/pacman.log |

And pamac gui can display this log :wink:
menu : display history (only search and not filter :sob:)


And, exists good ( but qt5 ) gui app : Pacman Log Viewer (in extra) (no display warnings !)

2 Likes

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.