User avatar
RDK
Posts: 303
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Viewing the Startup Log when running Headless

Mon Oct 26, 2015 6:14 am

I'm sure this has already been answered somewhere but I am not able to find the right set of unique keywords to find it, so...

I'm running my Pi's headless most of the time. However, there are times when it would be nice to see exactly what was displayed during the boot-up process. For example, corrupted partitions due to unscheduled power failure, problems with service's startup, etc.

How can I do that? Thanks....RDK

User avatar
dasmanul
Posts: 502
Joined: Wed Sep 30, 2015 10:20 am
Location: Frankfurt, Germany

Re: Viewing the Startup Log when running Headless

Mon Oct 26, 2015 6:32 am

Try 'dmesg'.

User avatar
DougieLawson
Posts: 38886
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Viewing the Startup Log when running Headless

Mon Oct 26, 2015 9:37 am

With a Jessie system additionally to using dmesg (or cat /var/log/dmesg) try using journalctl -k and journalctl --boot
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
RDK
Posts: 303
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Viewing the Startup Log when running Headless

Mon Oct 26, 2015 6:11 pm

OK, I'm not running Jessie and, for now, I have no plans to upgrade to it on any of my "currently happy" Pi's.

dmesg is almost useless, as it seems to show only the latest entries into the log. I'm most interested in the entries which were displayed on my console during boot up, when I was not running headless.
Oh well.....Thanks anyway....RDK

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Viewing the Startup Log when running Headless

Mon Oct 26, 2015 6:19 pm

A couple of things to try (try these and let me know how it works out - I'm actually curious about it):
  1. Take a look at /dev/vcs1 - that will show you some subset of what is currently displayed on tty1.
  2. Try booting with a serial console setup. You should see the same thing(s) as what are also displayed on tty1.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

DirkS
Posts: 10347
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Viewing the Startup Log when running Headless

Mon Oct 26, 2015 6:21 pm

RDK wrote:dmesg is almost useless, as it seems to show only the latest entries into the log. I'm most interested in the entries which were displayed on my console during boot up, when I was not running headless.
try 'less' (http://linux.about.com/library/cmd/blcmdl1_less.htm)

Code: Select all

less /var/log/syslog

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Viewing the Startup Log when running Headless

Mon Oct 26, 2015 7:52 pm

DirkS wrote:
RDK wrote:dmesg is almost useless, as it seems to show only the latest entries into the log. I'm most interested in the entries which were displayed on my console during boot up, when I was not running headless.
try 'less' (http://linux.about.com/library/cmd/blcmdl1_less.htm)

Code: Select all

less /var/log/syslog
Your post smarmily assumes that the OP's problem is not knowing about pagers. I'm pretty sure that is not the case.

Rather, the problem is that dmesg does indeed not show you everything that you would see if you were sitting at the console during bootup. I know this to be true, but I've never really taken the time to fully analyze and be able to say conclusively what does and does not get included into the dmesg output.

Note also that syslog is yet another piece of the puzzle, that tells you some things, but (usually) not what you are looking for...
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
DougieLawson
Posts: 38886
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Viewing the Startup Log when running Headless

Mon Oct 26, 2015 8:15 pm

There's a positive benefit with Jessie & systemd, you get all of those rapidly scrolling console messages from your daemons logged.

Raspbian Jessie complete with systemd is remarkably stable now that it's generally available.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
dasmanul
Posts: 502
Joined: Wed Sep 30, 2015 10:20 am
Location: Frankfurt, Germany

Re: Viewing the Startup Log when running Headless

Tue Oct 27, 2015 9:23 am

RDK wrote:OK, I'm not running Jessie and, for now, I have no plans to upgrade to it on any of my "currently happy" Pi's.

dmesg is almost useless, as it seems to show only the latest entries into the log. I'm most interested in the entries which were displayed on my console during boot up, when I was not running headless.
Oh well.....Thanks anyway....RDK
Interesting. On my model B running wheezy with an uptime of ~4 weeks, dmesg seems to report messages back to boot time:

Code: Select all

reiter@pi ~ $ dmesg |head
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.1.7+ (dc4@dc4-XPS13-9333) (gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03) ) #813 PREEMPT Mon Sep 14 19:14:42 BST 2015
[    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[    0.000000] Machine model: Raspberry Pi Model B Rev 2
[    0.000000] cma: Reserved 8 MiB at 0x1e800000
[    0.000000] Memory policy: Data cache writeback
reiter@pi ~ $ uptime
 10:18:25 up 28 days, 27 min,  1 user,  load average: 0,08, 0,14, 0,09
Have you looked at /var/log/dmesg as well? Since dmesg displays the "kernel ring buffer", I guess it might wrap around if the kernel outputs a lot of messages. I'd assume that the log file doesn't and should go all the way back to boot.

I've never had a display connected to either of my Pis so I don't know what else is shown during boot...

User avatar
RDK
Posts: 303
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Viewing the Startup Log when running Headless

Fri Nov 06, 2015 1:05 pm

Thanks guys. I've been away from this issue for a while. I'll checkout your ideas/comments and get back to you.....RDK

User avatar
RDK
Posts: 303
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Viewing the Startup Log when running Headless

Fri Nov 20, 2015 3:08 pm

OK, I tried out these suggestions. The most promising was

Code: Select all

sudo cat /dev/vcs1
but the screen format was all buggered up as it would appear that it was displaying buffer records which were rolling/extending off the screen. From what I could see, however, this looks almost like the info I would like to get to.

Code: Select all

dmesg
and

Code: Select all

cat  /var/log/dmesg
were formatted nicely but did not have the info I wanted.

Any ideas on how to display the /dev/vsc1 "file" in a usable format or how to copy it to a simple file?

Thanks...RDK

User avatar
dasmanul
Posts: 502
Joined: Wed Sep 30, 2015 10:20 am
Location: Frankfurt, Germany

Re: Viewing the Startup Log when running Headless

Mon Nov 23, 2015 5:17 pm

You could try getting the column width from the second byte of /dev/vcsa1 and the wrapping /dev/vcs1 at that width with 'fold -w <width> /dev/vcs1'. Not perfect, but when I tried it at least readable.

I'm still curious what info is missing from [/var/log/]dmesg, since on my system it seems to show everything.

User avatar
RDK
Posts: 303
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Viewing the Startup Log when running Headless

Mon Nov 23, 2015 6:14 pm

OK, I'll give it a try. Not sure exactly how to extract the width from the second byte, but I will work on it next weekend when I'm again near the Pi.

When I watch my console screen I see lots of messages relating to the status of my device, the USB memory devices and the SD card, as well as the startup lines for my services and finally the IP addresses for the Ethernet adapters and/or the Wi-Fi. Since it all seems to be in one place that is what I would like to access.

Thanks for your assistance....RDK

Return to “Beginners”