Debugging boot performance issues in grub / before kernel logging starts

Clash Royale CLAN TAG#URR8PPP
My PC takes a long time booting. I have reason to believe it is caused by delays after grub, but before kernel logging starts (booting takes 30 seconds, but dmesg messages have time stamps between 0.00000 - 9.34223, details in this post).
Are there any ways to debug what's going on? In particular:
- Is there a way to make grub itself more verbose, or keep logs?
- Are there any other processes between grub and the kernel logging that could be taking time? How do I debug those?
I believe the question is not specific to my setup. But just in case, I'm running Ubuntu 16.10 and grub(2)
EDIT:
Following a suggestion by @TooTea, I set the debug=all environment variables which produced a lot of messages a la script/script.c:50 malloc 0x7a9a2ca0 that should not be a problem. Then there is one block of messages that coincide with a 8 seconds delay delay:
kern/dl.c:56 Detecting ext2...
lib/relocator.c:1397 chunks = 0x7a7e0ae0
lib/relocator.c:434 trying to allocate in ...-... aligned ... size ...
lib/relocator.c:1198 allocated: ...+...
lib/relocator.c:1409 allocated .../...
lib/relocator.c:1410 chunks = 0x7a7e0ae0
boot grub performance boot-loader debugging
add a comment |
My PC takes a long time booting. I have reason to believe it is caused by delays after grub, but before kernel logging starts (booting takes 30 seconds, but dmesg messages have time stamps between 0.00000 - 9.34223, details in this post).
Are there any ways to debug what's going on? In particular:
- Is there a way to make grub itself more verbose, or keep logs?
- Are there any other processes between grub and the kernel logging that could be taking time? How do I debug those?
I believe the question is not specific to my setup. But just in case, I'm running Ubuntu 16.10 and grub(2)
EDIT:
Following a suggestion by @TooTea, I set the debug=all environment variables which produced a lot of messages a la script/script.c:50 malloc 0x7a9a2ca0 that should not be a problem. Then there is one block of messages that coincide with a 8 seconds delay delay:
kern/dl.c:56 Detecting ext2...
lib/relocator.c:1397 chunks = 0x7a7e0ae0
lib/relocator.c:434 trying to allocate in ...-... aligned ... size ...
lib/relocator.c:1198 allocated: ...+...
lib/relocator.c:1409 allocated .../...
lib/relocator.c:1410 chunks = 0x7a7e0ae0
boot grub performance boot-loader debugging
add a comment |
My PC takes a long time booting. I have reason to believe it is caused by delays after grub, but before kernel logging starts (booting takes 30 seconds, but dmesg messages have time stamps between 0.00000 - 9.34223, details in this post).
Are there any ways to debug what's going on? In particular:
- Is there a way to make grub itself more verbose, or keep logs?
- Are there any other processes between grub and the kernel logging that could be taking time? How do I debug those?
I believe the question is not specific to my setup. But just in case, I'm running Ubuntu 16.10 and grub(2)
EDIT:
Following a suggestion by @TooTea, I set the debug=all environment variables which produced a lot of messages a la script/script.c:50 malloc 0x7a9a2ca0 that should not be a problem. Then there is one block of messages that coincide with a 8 seconds delay delay:
kern/dl.c:56 Detecting ext2...
lib/relocator.c:1397 chunks = 0x7a7e0ae0
lib/relocator.c:434 trying to allocate in ...-... aligned ... size ...
lib/relocator.c:1198 allocated: ...+...
lib/relocator.c:1409 allocated .../...
lib/relocator.c:1410 chunks = 0x7a7e0ae0
boot grub performance boot-loader debugging
My PC takes a long time booting. I have reason to believe it is caused by delays after grub, but before kernel logging starts (booting takes 30 seconds, but dmesg messages have time stamps between 0.00000 - 9.34223, details in this post).
Are there any ways to debug what's going on? In particular:
- Is there a way to make grub itself more verbose, or keep logs?
- Are there any other processes between grub and the kernel logging that could be taking time? How do I debug those?
I believe the question is not specific to my setup. But just in case, I'm running Ubuntu 16.10 and grub(2)
EDIT:
Following a suggestion by @TooTea, I set the debug=all environment variables which produced a lot of messages a la script/script.c:50 malloc 0x7a9a2ca0 that should not be a problem. Then there is one block of messages that coincide with a 8 seconds delay delay:
kern/dl.c:56 Detecting ext2...
lib/relocator.c:1397 chunks = 0x7a7e0ae0
lib/relocator.c:434 trying to allocate in ...-... aligned ... size ...
lib/relocator.c:1198 allocated: ...+...
lib/relocator.c:1409 allocated .../...
lib/relocator.c:1410 chunks = 0x7a7e0ae0
boot grub performance boot-loader debugging
boot grub performance boot-loader debugging
edited Feb 28 at 14:47
sheß
asked Feb 25 at 16:16
sheßsheß
1065
1065
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
As you can probably imagine, the handover between GRUB and Linux involves some really intricate low-level steps, so there's no room for advanced tracing or logging. Fortunately, that shouldn't be a problem as there's also no room for any extended stalls in that code. You can get a really detailed trace of all the preparatory steps in GRUB by setting the debug environment variable.
It is, however, more likely that whatever delays you see happen after the control is transferred to the Linux kernel. Normally, you can't see the log messages before the console is initialized. Also, as you have noted, all the timestamps are zero until the timekeeping subsystem is initialized, so it is impossible to figure out the timing later.
Fortunately, you can use the earlyprintk boot option to make the kernel actually print the log messages somewhere, so that you can follow them in real time and see where the delay occurs. earlyprintk can be directed to various destinations, but the most relevant for usual (physical) machines will be serial, vga (old-school console), or efi. Make sure that your kernel is built with the appropriate config options (CONFIG_EARLY_PRINTK*).
thanks! is there another useful specification fordebugthandebug=allif gives me a lot of messages that seem to be not problematic, but make it harder to see what's causing the delay, even/espacially withpager=1
– sheß
Feb 28 at 14:29
1
@sheßlinuxmay be the most relevant (OS-specific interface/handover bits), see the GRUB source for others
– TooTea
Feb 28 at 14:54
add a comment |
This is certainly not a full answer to my own question but might be useful for others landing here while investigating similar issues.
The GRUB manual suggests to use the debug environment variable, either with debug=all or with a comma/whitespace list of facility names. It then says:
Consult source for more details.
I was not able to find a list of potential names online.
So for future reference I pulled a list of those names from the current github repository coreos/grub, hoping that this might be useful for me and others in the future. Of course, without further investigating the source this is of limited use, but still might be a good starting point.
name frequency in source
acpi |||||
affs |
ahci ||
appleload |
arcdisk ||
archelp ||
ata ||
atkeyb ||
biosdisk ||
bsd ||||
btrfs ||
cache ||
cbfs |
chain |||
crypt ||
cryptodisk ||
datetime |
devalias ||
disk |||||
diskfilter ||
dl ||||||||
dns ||
drivemap ||
efi ||
efidisk ||
efiemu ||||||||||||||
ehci ||
elf ||
exfat |
expand ||
fat |
fb ||
fdt |
fixvideo ||
font ||
fs ||
geli ||
gpt ||||
hostdisk |||||
init |||||
jpeg |
keystatus ||
lexer |
linux |||||||||||||
loader |||||||
luks ||
memdisk ||
mm ||
mmap |||||
modules ||
multiboot_loader |||||
nativedisk ||
net ||||||||||
ohci ||
partition ||||||
pata ||
play ||
reiserfs_tree ||
relocator |||
scripting ||
scsi ||
serial ||
smbios ||
syslinux ||
tftp ||
tga ||
ubootdisk ||
uhci ||
usb ||||||
usb_keyboard ||
usbms ||
video |||||||
xen |||||||||
xen_loader ||
xfs ||
xnu ||||||
zfs |||||
So for example you can write
set debug=linux,video,fs
into your /boot/grub/grub.cfg to reduce the debug verbosity of GRUB and only show debug messages for those facilities
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502931%2fdebugging-boot-performance-issues-in-grub-before-kernel-logging-starts%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
As you can probably imagine, the handover between GRUB and Linux involves some really intricate low-level steps, so there's no room for advanced tracing or logging. Fortunately, that shouldn't be a problem as there's also no room for any extended stalls in that code. You can get a really detailed trace of all the preparatory steps in GRUB by setting the debug environment variable.
It is, however, more likely that whatever delays you see happen after the control is transferred to the Linux kernel. Normally, you can't see the log messages before the console is initialized. Also, as you have noted, all the timestamps are zero until the timekeeping subsystem is initialized, so it is impossible to figure out the timing later.
Fortunately, you can use the earlyprintk boot option to make the kernel actually print the log messages somewhere, so that you can follow them in real time and see where the delay occurs. earlyprintk can be directed to various destinations, but the most relevant for usual (physical) machines will be serial, vga (old-school console), or efi. Make sure that your kernel is built with the appropriate config options (CONFIG_EARLY_PRINTK*).
thanks! is there another useful specification fordebugthandebug=allif gives me a lot of messages that seem to be not problematic, but make it harder to see what's causing the delay, even/espacially withpager=1
– sheß
Feb 28 at 14:29
1
@sheßlinuxmay be the most relevant (OS-specific interface/handover bits), see the GRUB source for others
– TooTea
Feb 28 at 14:54
add a comment |
As you can probably imagine, the handover between GRUB and Linux involves some really intricate low-level steps, so there's no room for advanced tracing or logging. Fortunately, that shouldn't be a problem as there's also no room for any extended stalls in that code. You can get a really detailed trace of all the preparatory steps in GRUB by setting the debug environment variable.
It is, however, more likely that whatever delays you see happen after the control is transferred to the Linux kernel. Normally, you can't see the log messages before the console is initialized. Also, as you have noted, all the timestamps are zero until the timekeeping subsystem is initialized, so it is impossible to figure out the timing later.
Fortunately, you can use the earlyprintk boot option to make the kernel actually print the log messages somewhere, so that you can follow them in real time and see where the delay occurs. earlyprintk can be directed to various destinations, but the most relevant for usual (physical) machines will be serial, vga (old-school console), or efi. Make sure that your kernel is built with the appropriate config options (CONFIG_EARLY_PRINTK*).
thanks! is there another useful specification fordebugthandebug=allif gives me a lot of messages that seem to be not problematic, but make it harder to see what's causing the delay, even/espacially withpager=1
– sheß
Feb 28 at 14:29
1
@sheßlinuxmay be the most relevant (OS-specific interface/handover bits), see the GRUB source for others
– TooTea
Feb 28 at 14:54
add a comment |
As you can probably imagine, the handover between GRUB and Linux involves some really intricate low-level steps, so there's no room for advanced tracing or logging. Fortunately, that shouldn't be a problem as there's also no room for any extended stalls in that code. You can get a really detailed trace of all the preparatory steps in GRUB by setting the debug environment variable.
It is, however, more likely that whatever delays you see happen after the control is transferred to the Linux kernel. Normally, you can't see the log messages before the console is initialized. Also, as you have noted, all the timestamps are zero until the timekeeping subsystem is initialized, so it is impossible to figure out the timing later.
Fortunately, you can use the earlyprintk boot option to make the kernel actually print the log messages somewhere, so that you can follow them in real time and see where the delay occurs. earlyprintk can be directed to various destinations, but the most relevant for usual (physical) machines will be serial, vga (old-school console), or efi. Make sure that your kernel is built with the appropriate config options (CONFIG_EARLY_PRINTK*).
As you can probably imagine, the handover between GRUB and Linux involves some really intricate low-level steps, so there's no room for advanced tracing or logging. Fortunately, that shouldn't be a problem as there's also no room for any extended stalls in that code. You can get a really detailed trace of all the preparatory steps in GRUB by setting the debug environment variable.
It is, however, more likely that whatever delays you see happen after the control is transferred to the Linux kernel. Normally, you can't see the log messages before the console is initialized. Also, as you have noted, all the timestamps are zero until the timekeeping subsystem is initialized, so it is impossible to figure out the timing later.
Fortunately, you can use the earlyprintk boot option to make the kernel actually print the log messages somewhere, so that you can follow them in real time and see where the delay occurs. earlyprintk can be directed to various destinations, but the most relevant for usual (physical) machines will be serial, vga (old-school console), or efi. Make sure that your kernel is built with the appropriate config options (CONFIG_EARLY_PRINTK*).
answered Feb 27 at 13:48
TooTeaTooTea
784211
784211
thanks! is there another useful specification fordebugthandebug=allif gives me a lot of messages that seem to be not problematic, but make it harder to see what's causing the delay, even/espacially withpager=1
– sheß
Feb 28 at 14:29
1
@sheßlinuxmay be the most relevant (OS-specific interface/handover bits), see the GRUB source for others
– TooTea
Feb 28 at 14:54
add a comment |
thanks! is there another useful specification fordebugthandebug=allif gives me a lot of messages that seem to be not problematic, but make it harder to see what's causing the delay, even/espacially withpager=1
– sheß
Feb 28 at 14:29
1
@sheßlinuxmay be the most relevant (OS-specific interface/handover bits), see the GRUB source for others
– TooTea
Feb 28 at 14:54
thanks! is there another useful specification for
debug than debug=all if gives me a lot of messages that seem to be not problematic, but make it harder to see what's causing the delay, even/espacially with pager=1– sheß
Feb 28 at 14:29
thanks! is there another useful specification for
debug than debug=all if gives me a lot of messages that seem to be not problematic, but make it harder to see what's causing the delay, even/espacially with pager=1– sheß
Feb 28 at 14:29
1
1
@sheß
linux may be the most relevant (OS-specific interface/handover bits), see the GRUB source for others– TooTea
Feb 28 at 14:54
@sheß
linux may be the most relevant (OS-specific interface/handover bits), see the GRUB source for others– TooTea
Feb 28 at 14:54
add a comment |
This is certainly not a full answer to my own question but might be useful for others landing here while investigating similar issues.
The GRUB manual suggests to use the debug environment variable, either with debug=all or with a comma/whitespace list of facility names. It then says:
Consult source for more details.
I was not able to find a list of potential names online.
So for future reference I pulled a list of those names from the current github repository coreos/grub, hoping that this might be useful for me and others in the future. Of course, without further investigating the source this is of limited use, but still might be a good starting point.
name frequency in source
acpi |||||
affs |
ahci ||
appleload |
arcdisk ||
archelp ||
ata ||
atkeyb ||
biosdisk ||
bsd ||||
btrfs ||
cache ||
cbfs |
chain |||
crypt ||
cryptodisk ||
datetime |
devalias ||
disk |||||
diskfilter ||
dl ||||||||
dns ||
drivemap ||
efi ||
efidisk ||
efiemu ||||||||||||||
ehci ||
elf ||
exfat |
expand ||
fat |
fb ||
fdt |
fixvideo ||
font ||
fs ||
geli ||
gpt ||||
hostdisk |||||
init |||||
jpeg |
keystatus ||
lexer |
linux |||||||||||||
loader |||||||
luks ||
memdisk ||
mm ||
mmap |||||
modules ||
multiboot_loader |||||
nativedisk ||
net ||||||||||
ohci ||
partition ||||||
pata ||
play ||
reiserfs_tree ||
relocator |||
scripting ||
scsi ||
serial ||
smbios ||
syslinux ||
tftp ||
tga ||
ubootdisk ||
uhci ||
usb ||||||
usb_keyboard ||
usbms ||
video |||||||
xen |||||||||
xen_loader ||
xfs ||
xnu ||||||
zfs |||||
So for example you can write
set debug=linux,video,fs
into your /boot/grub/grub.cfg to reduce the debug verbosity of GRUB and only show debug messages for those facilities
add a comment |
This is certainly not a full answer to my own question but might be useful for others landing here while investigating similar issues.
The GRUB manual suggests to use the debug environment variable, either with debug=all or with a comma/whitespace list of facility names. It then says:
Consult source for more details.
I was not able to find a list of potential names online.
So for future reference I pulled a list of those names from the current github repository coreos/grub, hoping that this might be useful for me and others in the future. Of course, without further investigating the source this is of limited use, but still might be a good starting point.
name frequency in source
acpi |||||
affs |
ahci ||
appleload |
arcdisk ||
archelp ||
ata ||
atkeyb ||
biosdisk ||
bsd ||||
btrfs ||
cache ||
cbfs |
chain |||
crypt ||
cryptodisk ||
datetime |
devalias ||
disk |||||
diskfilter ||
dl ||||||||
dns ||
drivemap ||
efi ||
efidisk ||
efiemu ||||||||||||||
ehci ||
elf ||
exfat |
expand ||
fat |
fb ||
fdt |
fixvideo ||
font ||
fs ||
geli ||
gpt ||||
hostdisk |||||
init |||||
jpeg |
keystatus ||
lexer |
linux |||||||||||||
loader |||||||
luks ||
memdisk ||
mm ||
mmap |||||
modules ||
multiboot_loader |||||
nativedisk ||
net ||||||||||
ohci ||
partition ||||||
pata ||
play ||
reiserfs_tree ||
relocator |||
scripting ||
scsi ||
serial ||
smbios ||
syslinux ||
tftp ||
tga ||
ubootdisk ||
uhci ||
usb ||||||
usb_keyboard ||
usbms ||
video |||||||
xen |||||||||
xen_loader ||
xfs ||
xnu ||||||
zfs |||||
So for example you can write
set debug=linux,video,fs
into your /boot/grub/grub.cfg to reduce the debug verbosity of GRUB and only show debug messages for those facilities
add a comment |
This is certainly not a full answer to my own question but might be useful for others landing here while investigating similar issues.
The GRUB manual suggests to use the debug environment variable, either with debug=all or with a comma/whitespace list of facility names. It then says:
Consult source for more details.
I was not able to find a list of potential names online.
So for future reference I pulled a list of those names from the current github repository coreos/grub, hoping that this might be useful for me and others in the future. Of course, without further investigating the source this is of limited use, but still might be a good starting point.
name frequency in source
acpi |||||
affs |
ahci ||
appleload |
arcdisk ||
archelp ||
ata ||
atkeyb ||
biosdisk ||
bsd ||||
btrfs ||
cache ||
cbfs |
chain |||
crypt ||
cryptodisk ||
datetime |
devalias ||
disk |||||
diskfilter ||
dl ||||||||
dns ||
drivemap ||
efi ||
efidisk ||
efiemu ||||||||||||||
ehci ||
elf ||
exfat |
expand ||
fat |
fb ||
fdt |
fixvideo ||
font ||
fs ||
geli ||
gpt ||||
hostdisk |||||
init |||||
jpeg |
keystatus ||
lexer |
linux |||||||||||||
loader |||||||
luks ||
memdisk ||
mm ||
mmap |||||
modules ||
multiboot_loader |||||
nativedisk ||
net ||||||||||
ohci ||
partition ||||||
pata ||
play ||
reiserfs_tree ||
relocator |||
scripting ||
scsi ||
serial ||
smbios ||
syslinux ||
tftp ||
tga ||
ubootdisk ||
uhci ||
usb ||||||
usb_keyboard ||
usbms ||
video |||||||
xen |||||||||
xen_loader ||
xfs ||
xnu ||||||
zfs |||||
So for example you can write
set debug=linux,video,fs
into your /boot/grub/grub.cfg to reduce the debug verbosity of GRUB and only show debug messages for those facilities
This is certainly not a full answer to my own question but might be useful for others landing here while investigating similar issues.
The GRUB manual suggests to use the debug environment variable, either with debug=all or with a comma/whitespace list of facility names. It then says:
Consult source for more details.
I was not able to find a list of potential names online.
So for future reference I pulled a list of those names from the current github repository coreos/grub, hoping that this might be useful for me and others in the future. Of course, without further investigating the source this is of limited use, but still might be a good starting point.
name frequency in source
acpi |||||
affs |
ahci ||
appleload |
arcdisk ||
archelp ||
ata ||
atkeyb ||
biosdisk ||
bsd ||||
btrfs ||
cache ||
cbfs |
chain |||
crypt ||
cryptodisk ||
datetime |
devalias ||
disk |||||
diskfilter ||
dl ||||||||
dns ||
drivemap ||
efi ||
efidisk ||
efiemu ||||||||||||||
ehci ||
elf ||
exfat |
expand ||
fat |
fb ||
fdt |
fixvideo ||
font ||
fs ||
geli ||
gpt ||||
hostdisk |||||
init |||||
jpeg |
keystatus ||
lexer |
linux |||||||||||||
loader |||||||
luks ||
memdisk ||
mm ||
mmap |||||
modules ||
multiboot_loader |||||
nativedisk ||
net ||||||||||
ohci ||
partition ||||||
pata ||
play ||
reiserfs_tree ||
relocator |||
scripting ||
scsi ||
serial ||
smbios ||
syslinux ||
tftp ||
tga ||
ubootdisk ||
uhci ||
usb ||||||
usb_keyboard ||
usbms ||
video |||||||
xen |||||||||
xen_loader ||
xfs ||
xnu ||||||
zfs |||||
So for example you can write
set debug=linux,video,fs
into your /boot/grub/grub.cfg to reduce the debug verbosity of GRUB and only show debug messages for those facilities
answered Mar 1 at 10:36
sheßsheß
1065
1065
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502931%2fdebugging-boot-performance-issues-in-grub-before-kernel-logging-starts%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown