But when Yay is running, it whizzes hundreds of lines of code past, including more than one ‘Warning…’, yet none of these seem to appear in either pacman logs nor any makepkg logs (at least not that I can find).
So where would I look to find what those warnings were all about, they zoom by so quickly we can’t possibly be expected to read them, not to mention the paranoid part of me wanting to just have a record of all that activity (installing an AUR package really does seem to download half the internet before it can compile!)
I’m aware that this has sort of been asked before at How to read yay update log?, but the thread meandered off into finding dependencies so never actually ended up with anyone talking about where all that script went…
Warnings are usually just that: a warning, a notice that there is the possibility of something amiss. Usually you don’t need to worry. An error on the other hand, might need more information, stat,
If you want to inspect what happened at a more leisurely pace, you can use:
tac /var/log/pacman.log | less
If you want to look at all warnings in the log:
grep --ignore-case warning /var/log/pacman.log | sort --reverse | less
If you want to check for all errors in the log:
grep --ignore-case error /var/log/pacman.log | sort --reverse | less
You should be able to redirect the output to a file:
yay -S something > /path/to/file
# or append to an existing file
yay -S something >> /path/to/file
# or perhaps better yet, output to file and stdout (terminal)
yay -S something | tee /path/to/file
# or append to an existing file
yay -S something | tee -a /path/to/file
Cool. I’ve had a look at the pacman logs after installing an aur package, and it gives me a few lines (basically saying everything went OK), so I assume your first comment was the case here - nothing to worry about.
Thanks, but I don’t see an option to return to default in the help. If I don’t know where the log-file currently is, I’m concerned about not being able to ever reset it to it’s normal place… Am I missing something?
#!/usr/bin/bash
# DESC: Install an AUR package using yay and redirect
# output to a log file. Takes a single package name.
logdir="~/.cache/yay/logs" # change if you want
mkdir -p "$logdir" # ok if exists
yay -S $1 | tee "$logdir"/$1.log # outputs to terminal and logfile
Save the script to ~/.local/bin as yayt (or yay-install, whatever), and make it executable:
chmod +x ~/.local/bin/yayt # or whatever you called it
Oh well. I suppose it can’t log everything. Seems weird to think it’s flashing all these messages up on screen for no-one to ever read… Who is it talking to…?
Mmm. Back to the beginning then. If it’s for me to read, why isn’t is saved somewhere or paused by a prompt at the end of each page saying ‘Have you read this yes (Y/n)?’
Seems odd to have a load of text for me to read but then pay no attention to whether it’s presented in a format (or at a speed) that is actually readable. We’re not all spring chickens…
It’s rather easy - use makepkg and you compile one package at a time.
Then you have easy access to the build logs - and, as was already said
you can simply scroll back up to read …
If you use a helper tool like yay - it becomes a bit more complex to preserve the output
of it building multiple packages at once.
You can still scroll back though.
It is designed to do the job - not to preserve console output.
I just tried the script that @dmt suggested - but got no output from it.
Here is my take.
It captures all kinds of color codes and the output is ugly - but it also captures the relevant information.
script -B ~/logfile -c "yay -S package_to_build"
then read the ~/logfile
The actual example I tried this with was this: script -B ~/logfile -c "yay -S canon-pixma-ip7200-printer"
(it fetches a few dependencies and then builds the package)
remove with: sudo pacman -Rns canon-pixma-ip7200-printer
because it was just an example …
You usually only want to read the output if there are errors and the process failed because of it.
Then the error message usually is near the last lines of output and you can, again, simply scroll back up to read.
The quotes were messing things up…but we still miss a lot of the output.
#!/usr/bin/bash
# DESC: Install an AUR package using yay and redirect
# output to a log file. Takes a single package name.
logdir=~/.cache/yay/logs # change if you want
mkdir -p $logdir # ok if exists
yay -S $1 | tee $logdir/$1.log # outputs to terminal and logfile
Very nice. I didn’t know about script, thanks.
Looks good if you use less or cat (colour codes work), but the colour codes can be stripped out using a regex.
cat ~/logfile displays it flawlessly, but … no pager
same as your sed expression
but: less -R ~/logfile
looks almost clean
it looks identical (to me) as when I pipe your sed expression through less, to have a pager
so this: script -B ~/logfile -c "yay -S package_to_build" less -R ~/logfile
would definitely be good enough for me
if I was actually interested in it like the OP seems to be
less -R ~/logfile and less ~/logfile produce identical output for me, both have working colour codes and still have some annoying chars eg. ^O.
The sed command will strip colour codes out and leave the rest, so it looks better in a text editor. Unlike less and less -R on their own, there isn’t any colour, but otherwise yes it looks identical.
I just noticed script saves your password in clear text.
EDIT:
less ~/logfile would do for me too, I like colour.