You are not logged in.

#1 2014-07-24 11:32:00

bdantas
Member
Registered: 2014-05-13
Posts: 94

How to copy contents of console's scrollback buffer to a file?

I already know about

cat /dev/vcs1 > /path/to/some_file

and

setterm -dump 1 -file /path/to/some_file

but these only work for what is actually on tty1's screen when the command is run (i.e., lines in the scrollback buffer do not get written to the file). I have "fbcon=scrollback:512" in grub2's kernel line, in case it matters.

(I am trying to recreate the old /var/log/boot but, since even in quiet mode grub2 prints [FAIL] and all the [OK] messages that follow, if the [FAIL] occurs early enough it scrolls off the screen. See here:  https://bbs.archlinux.org/viewtopic.php … 1#p1439361)

EDIT: Link fixed. Thanks for the heads up, karol.

Last edited by bdantas (2014-07-24 20:31:46)

Offline

#2 2014-07-24 11:45:29

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: How to copy contents of console's scrollback buffer to a file?

Please fix the link, it should be https://bbs.archlinux.org/viewtopic.php … 1#p1439361

Last edited by karol (2014-07-24 11:49:39)

Offline

#3 2014-07-30 13:25:52

bdantas
Member
Registered: 2014-05-13
Posts: 94

Re: How to copy contents of console's scrollback buffer to a file?

Is it impossible to copy the contents of the scrollback buffer of a virtual console (e.g., tty1) to a file?

Offline

#4 2014-08-01 03:53:00

amanual
Member
Registered: 2014-08-01
Posts: 2

Re: How to copy contents of console's scrollback buffer to a file?

in theory you could dump the contents of the scrollback, this is the pointer to it https://git.kernel.org/cgit/linux/kerne … 6-rc7#n185
you could dump that before the console gets switched*, right before here: https://git.kernel.org/cgit/linux/kerne … 6-rc7#n846

* e.g. when X gets started and is about to get graphical

Offline

#5 2014-08-01 04:47:52

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: How to copy contents of console's scrollback buffer to a file?

bdantas wrote:

Is it impossible to copy the contents of the scrollback buffer of a virtual console (e.g., tty1) to a file?

No


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2014-08-01 23:20:26

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: How to copy contents of console's scrollback buffer to a file?

I use 'systemd.show_status=0' along with 'quiet' to keep systemd from printing stuff I don't need.

Isn't systemd's journal enough to figure out what went wrong?

Offline

#7 2014-08-02 03:16:00

bdantas
Member
Registered: 2014-05-13
Posts: 94

Re: How to copy contents of console's scrollback buffer to a file?

Yes, "sudo journalctl -b -p err" shows me exactly what went wrong, so I think there is no need to pursue this further.

Offline

#8 2014-08-02 22:53:20

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: How to copy contents of console's scrollback buffer to a file?

Please remember to mark the thread as solved https://bbs.archlinux.org/viewtopic.php?id=130309

Offline

#9 2014-08-02 23:09:15

bdantas
Member
Registered: 2014-05-13
Posts: 94

Re: How to copy contents of console's scrollback buffer to a file?

I favor that it isn't solved because what I asked is not possible. Fortunately, the journal obviates the need for a solution. Is it customary to mark as "solved" when a workaround is found?

Last edited by bdantas (2014-08-02 23:35:20)

Offline

#10 2014-08-02 23:33:33

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: How to copy contents of console's scrollback buffer to a file?

Ah, OK.

Have you tried to keep the messages in the tty and start X from another tty, if needed?
You can then copy the messages by hand.

Offline

#11 2014-08-02 23:39:06

bdantas
Member
Registered: 2014-05-13
Posts: 94

Re: How to copy contents of console's scrollback buffer to a file?

Exactly. Either that or, if X starts automatically in tty1 due to autologin enabled in DM, using "sudo journalctl -b -p err" to get equivalent information.

Offline

Board footer

Powered by FluxBB