Bug 1121253

Summary: journalctl -b not working (--list-boots absent in manpage but -b is present)
Product: Red Hat Enterprise Linux 7 Reporter: Reartes Guillermo <greartes>
Component: systemdAssignee: systemd-maint
Status: CLOSED ERRATA QA Contact: Branislav Blaškovič <bblaskov>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.0CC: diego.ml, jchaloup, jscotka, jsynacek, lnykryn, rhack, systemd-maint-list
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: systemd-219-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 14:57:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Reartes Guillermo 2014-07-18 19:02:37 UTC
Description of problem:

On RHEL 7.0, the command 'journalctl'  with the paramter '-b' issues an error.

The info that '-b' needs cannot be obtained from '--list-boots' since that parameter is not present neither in journalctl nor in its manpage.

Maybe if the parameter --list-boots is absent, -b should also be absent from the manpage too (or the opposite).


Version-Release number of selected component (if applicable):

Affected system:

# yum list systemd
Complementos cargados:langpacks, product-id, subscription-manager
[Errno -2] Nombre o servicio desconocido
Paquetes instalados
systemd.x86_64    208-11.el7  @anaconda/7.0

Example system:

# yum list systemd
Complementos cargados:fastestmirror, langpacks, refresh-packagekit
Loading mirror speeds from cached hostfile
 * fedora: fedora.c3sl.ufpr.br
 * rpmfusion-free: ftp.nluug.nl
 * rpmfusion-free-updates: ftp.nluug.nl
 * rpmfusion-nonfree: ftp.nluug.nl
 * rpmfusion-nonfree-updates: ftp.nluug.nl
 * updates: fedora.c3sl.ufpr.br
Paquetes instalados
systemd.x86_64   208-19.fc20   @updates

How reproducible:

Always

Steps to Reproduce:

RHEL System:

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.0 (Maipo)

# journalctl --list-boots
journalctl: opción no reconocida '--list-boots'

# journalctl -b -1 -l -n 10
Failed to look up boot -1: No se puede asignar la dirección solicitada

Actual results:
For journalctl, the parameter '-b' (which is in the manpage) is not working.

Expected results:

It looks to me that this command should be working on RHEL7:
# journalctl -b -1 -l -n 10


Additional info:

F20 Example System:

# journalctl --list-boots
-28 c8e6815b85424a3997ae81f159ac925c lun 2014-04-28 02:28:18 ART—lun 2014-04-28 07:13:09 ART
-27 673620fc0c1f42a48eae58e8cf926bd1 lun 2014-04-28 07:13:22 ART—lun 2014-04-28 07:39:56 ART
-26 47b32fe040f9438493af9f5daed3c8c6 lun 2014-04-28 07:40:09 ART—lun 2014-04-28 11:07:25 ART
-25 3226a70938a0465cb407ceb08d6dcbe3 lun 2014-04-28 11:07:42 ART—mié 2014-04-30 17:51:40 ART
-24 b6c3f5f81fd64c358c98bba182ae7ff9 mié 2014-04-30 17:51:53 ART—sáb 2014-05-03 11:55:17 ART
-23 b5cb78fec5ec437e900c82d3129375c8 sáb 2014-05-03 11:55:30 ART—mié 2014-05-07 10:16:25 ART
-22 2f486c0dd53e4912aa8b18f8e252f581 mié 2014-05-07 10:16:38 ART—lun 2014-05-12 07:40:53 ART
-21 34f30802936b428180699198b383ac36 lun 2014-05-12 07:41:12 ART—vie 2014-05-16 09:56:18 ART
-20 c4abc59a611f4f8eba5e43ad88037190 vie 2014-05-16 09:56:36 ART—lun 2014-05-19 11:18:07 ART
-19 578f8d1b8518422c829e77a831ec0b3c lun 2014-05-19 11:18:24 ART—lun 2014-05-26 16:06:24 ART
-18 630bd32931e8458287dc7627a3b75b6e lun 2014-05-26 16:06:37 ART—mar 2014-05-27 09:48:08 ART
-17 122b23f9c9cb4c72a4f5cdf7ee228033 mar 2014-05-27 09:50:24 ART—jue 2014-05-29 12:59:33 ART
-16 0e27e760da5c46e8a3818ac673d035c0 jue 2014-05-29 12:59:48 ART—jue 2014-05-29 16:21:35 ART
-15 41e877a31d154937ac17b30ccfbb500a vie 2014-05-30 09:37:13 ART—dom 2014-06-01 21:44:50 ART
-14 f32576503c5f4de4a2e4f89df4ca297b dom 2014-06-01 21:45:07 ART—dom 2014-06-01 22:02:10 ART
-13 f7b2fa59290c4af4b8291e52a0eca030 dom 2014-06-01 22:02:24 ART—mar 2014-06-03 11:42:00 ART
-12 dbd8b370e76b4ddfa247a2c3c5c2ca70 mar 2014-06-03 11:42:16 ART—vie 2014-06-06 14:44:32 ART
-11 f6ff99f5814f48489396abe456fe9eaa vie 2014-06-06 14:44:45 ART—dom 2014-06-08 17:17:22 ART
-10 26e7e1d175bc47ec873bd88f05165c4b dom 2014-06-08 17:17:39 ART—jue 2014-06-12 22:13:26 ART
 -9 0e221eb75e11462d9972c16d77e90c6e jue 2014-06-12 22:13:44 ART—vie 2014-06-13 14:49:11 ART
 -8 6e856c770b094baeadeb2a101f03c67c vie 2014-06-13 14:49:25 ART—lun 2014-06-16 09:51:25 ART
 -7 dadc81e52b5140a7b3a5a25f5c6903f0 lun 2014-06-16 09:51:49 ART—dom 2014-06-22 22:06:30 ART
 -6 062f29b974524d23ba6d7cdba74c665a dom 2014-06-22 22:06:52 ART—vie 2014-06-27 10:25:14 ART
 -5 e665493624f14e36a6ad321e108d5299 mar 2014-07-01 09:59:53 ART—mié 2014-07-02 05:01:01 ART
 -4 9c3bf02f2fe64a75a085974d0a8bc105 mié 2014-07-02 10:28:14 ART—vie 2014-07-04 11:20:49 ART
 -3 060ddcdf59904ecdac7d0396f83410f0 vie 2014-07-04 11:21:06 ART—mié 2014-07-09 10:31:44 ART
 -2 cb01413fe386473e9101a79663ed87c3 mié 2014-07-09 10:32:00 ART—mié 2014-07-09 22:36:35 ART
 -1 c3b8176258154b5095a69d138ea6bf37 mié 2014-07-09 22:36:47 ART—jue 2014-07-17 17:55:15 ART
  0 ae68d61f0949409da21121fc257633bd jue 2014-07-17 17:55:32 ART—vie 2014-07-18 15:26:54 ART

# journalctl -b -1 -l -n 10
-- Logs begin at lun 2014-04-28 02:28:18 ART, end at vie 2014-07-18 15:30:02 ART. --
jul 17 17:55:15 grimjow.espada systemd[1]: Stopped Replay Read-Ahead Data.
jul 17 17:55:15 grimjow.espada systemd[1]: Stopping Collect Read-Ahead Data...
jul 17 17:55:15 grimjow.espada systemd[1]: Stopped Collect Read-Ahead Data.
jul 17 17:55:15 grimjow.espada systemd[1]: Starting Shutdown.
jul 17 17:55:15 grimjow.espada systemd[1]: Reached target Shutdown.
jul 17 17:55:15 grimjow.espada systemd[1]: Starting Final Step.
jul 17 17:55:15 grimjow.espada systemd[1]: Reached target Final Step.
jul 17 17:55:15 grimjow.espada systemd[1]: Starting Reboot...
jul 17 17:55:15 grimjow.espada systemd[1]: Shutting down.
jul 17 17:55:15 grimjow.espada systemd-journal[689]: Journal stopped


Additional info #2:

Man Page of Journalctl (F20):

--list-boots
           Show a tabular list of boot numbers (relative to current boot), their IDs, and the timestamps of the first and last message pertaining to the boot.

           
-b [ID][±offset], --boot=[ID][±offset]
           Show messages from a specific boot. This will add a match for "_BOOT_ID=".

           The argument may be empty, in which case logs for the current boot will be shown.

           If the boot ID is omitted, a positive offset will look up the boots starting from the beginning of the journal, and a equal-or-less-than zero offset
           will look up boots starting from the end of the journal. Thus, 1 means the first boot found in the journal in the chronological order, 2 the second and
           so on; while -0 is the last boot, -1 the boot before that, and so on. An empty offset is equivalent to specifying -0, except when the current boot is
           not the last boot (e.g. because --directory was specified to look at logs from a different machine).

           If the 32 character ID is specified, it may optionally be followed by offset which identifies the boot relative to the one given by boot ID. Negative
           values mean earlier boots and a positive values mean later boots. If offset is not specified, a value of zero is assumed and the logs for the boot given
           by ID are shown.
           
On F20 both -b and --list-boots parameters are present and working.


Man Page of Journalctl (RHEL7):

-b [ID][±offset], --boot=[ID][±offset]
           Show messages from a specific boot. This will add a match for "_BOOT_ID=".

           The argument may be empty, in which case logs for the current boot will be shown.

           If the boot ID is omitted, a positive offset will look up the boots starting from the beginning of the journal, and a equal-or-less-than zero offset
           will look up boots starting from the end of the journal. Thus, 1 means the first boot found in the journal in the chronological order, 2 the second and
           so on; while -0 is the last boot, -1 the boot before that, and so on. An empty offset is equivalent to specifying -0, except when the current boot is
           not the last boot (e.g. because --directory was specified to look at logs from a different machine).

           If the 32 character ID is specified, it may optionally be followed by offset which identifies the boot relative to the one given by boot ID. Negative
           values mean earlier boots and a positive values mean later boots. If offset is not specified, a value of zero is assumed and the logs for the boot given
           by ID are shown.

On RHEL7 only -b parameter is mentioned in the man page and it does not work.

Comment 2 Reartes Guillermo 2014-07-18 19:59:19 UTC
It seems this looks like not a bug as far as systemd is concerned.  A simple strace revealed that, it was simply lacking the journal directory. (since we default to 'auto').

Can the manpage be updated to reflect that the directory '/var/log/journal' should exist? for the -b parameter to work.

Also the manpage also mentions boot_id, but that will not be avaiable due to the --list-boots parameter not being avaiable.

Finally, can the error "Failed to look up boot -1: No se puede asignar la dirección solicitada" be changed somehow? 

If the os was booted only 10 times with storage auto and the directory  '/var/log/journal' is present and i request the logs for the boot -1000, i can understand the previous error. Because there is no such boot.

But, if Storage is 'auto' and the directory '/var/log/journal' is absent, can journalctl report that it is not configured to report per boot logs instead?
It is not collecting the information necesary for '-b' to work in the first place.

"Failed to look up boot -1: functionality not enabled" or something similar.

Comment 3 Diego 2015-03-05 11:34:43 UTC
I'm too experiencing this exact same bug with CentOS 7.0:
# cat /etc/redhat-release 
CentOS Linux release 7.0.1406 (Core)

Comment 6 Lukáš Nykrýn 2015-06-30 07:49:14 UTC
I am not sure if this is fixed completely. It would be nice to have a hint that you have only volatile storage, but for now this is best we can do.

Comment 9 errata-xmlrpc 2015-11-19 14:57:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2092.html