Bug 25879 - Banana Pro: Empty entries in /boot/extlinux/extlinux.conf crashes uboot.
Summary: Banana Pro: Empty entries in /boot/extlinux/extlinux.conf crashes uboot.
Status: RESOLVED OLD
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 7
Hardware: arm Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Thierry Vignaud
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-14 22:40 CET by Jybz
Modified: 2021-09-07 14:09 CEST (History)
1 user (show)

See Also:
Source RPM: drakxtools-18.21-1.mga7.src.rpm
CVE:
Status comment:


Attachments

Description Jybz 2019-12-14 22:40:50 CET
Hello !

I just try to update the kernel on the Banana Pro where I port Mageia onto.

First, I note that the update created for the first time the /boot/extlinux/extlinux.conf file which I didn't wrote the the build image (as few months ago I didn't know what it was for, later I manage without).

Since, when the SBC starts, it tries automatically to use /boot/extlinux/extlinux.conf , well, why not !
But it crashes :
> Scanning mmc 0:1...
> Found /boot/extlinux/extlinux.conf
> Retrieving file: /boot/extlinux/extlinux.conf
> 468 bytes read in 6 ms (76.2 KiB/s)
> Expected string literal:  
> 
> Expected label name:  
> 
> Error parsing config file
> SCRIPT FAILED: continuing...

The file content is :
> # File generated by DrakX/drakboot
> timeout 30
> menu title Boot Menu
> 
> label 
>   kernel 
> 
> label linux
>   kernel /boot/vmlinuz
>   initrd /boot/initrd.img
>   fdtdir /usr/lib/linux-5.4.2-desktop-1.mga7
>   append root=UUID=03c0235b-ec27-4b41-ba5c-bd7a80999374
> 
> label desktop 5.4.2-1.mga7
>   kernel /boot/vmlinuz-5.4.2-desktop-1.mga7
>   initrd /boot/initrd-5.4.2-desktop-1.mga7.img
>   fdtdir /usr/lib/linux-5.4.2-desktop-1.mga7
>   append root=UUID=03c0235b-ec27-4b41-ba5c-bd7a80999374

When I commented the lines with empty entries :
> # label 
> #   kernel 

Uboot starts Mageia using that file. Which is a good point ! I like it !

Furthermore, what is the command to generate automaticaly this file ? I would like to implement it into the script to build Mageia images.
Comment 1 Jybz 2019-12-14 22:58:02 CET
Ops... How is it possible ?

The tool drakboot is NOT installed in the SBC. But the file mention "generated by drakboot", files that wasn't existing before the update.

So, what generate that file actually ?

(10 min later, I forget to post that comment, but ...)

I found it !
The file was generated by : /usr/lib/libDrakX/bootloader.pm

How to use that script ?
Comment 2 Jybz 2019-12-15 11:49:58 CET
> $ urpmf "/usr/lib/libDrakX/bootloader.pm"
> drakxtools-backend:/usr/lib/libDrakX/bootloader.pm

There is no drakxtools-backend in the maintdb.txt, but for drakxtools :
> $ curl -s pkgsubmit.mageia.org/data/maintdb.txt | grep "drakxtools"
> drakxtools tv

--

Later, Ankh on #mageia-dev helped me,
we found that the bootloader.pm was called by bootloader-config (installed) which is called by /sbin/installkernel . This file is executed by the RPM receipt http://svnweb.mageia.org/packages/updates/7/kernel/current/SPECS/kernel.spec?view=markup&sortby=date#l1399 line 1399, a post_install generated on the fly.

I'm currently building an image to check if the first generated file contains, of not, empty entry in /boot/extlinux/extlinux.conf
Comment 3 Jybz 2019-12-15 19:23:53 CET
Well,

I tried to build an image of Mageia for Banana Pro.

I can read :

> + echo -e '\nTrying to generate extlinux script\n'
> 
> Trying to generate extlinux script
> 
> ++ rpm -q kernel-desktop-latest
> ++ sed -e 's/kernel-\([[:alnum:]]*\)-latest-\([\.[:digit:]]*\)-\([\.[:alnum:]]*\).*$/\2-\1-\3/'
> + K_INST_VERSION=5.4.2-desktop-1.mga7
> + bash -x /sbin/installkernel 5.4.2-desktop-1.mga7
> + NOLINK=
> + NOENTRY=
> + INITRDOPTS=
> + NOLAUNCH=
> + action=add-kernel
> + no_initrd=
> + '[' -f /etc/sysconfig/installkernel ']'
> + source /etc/sysconfig/installkernel
> ++ NOLINK=
> ++ NOENTRY=
> ++ INITRDOPTS=
> + export PATH=/usr/local/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/usr/lib64/qt5/bin:/usr/lib64/qt4/bin:/sbin:/usr/sbin
> + PATH=/usr/local/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/usr/lib64/qt5/bin:/usr/lib64/qt4/bin:/sbin:/usr/sbin
> + getopts algyNdnRsSCiLch opt
> + shift 0
> + version=5.4.2-desktop-1.mga7
> + '[' 1 = 3 -o 1 = 4 ']'
> + '[' 1 '!=' 1 ']'
> + '[' '' = no ']'
> + [[ 5.4.2-desktop-1.mga7 == *BOOT ]]
> + '[' -z '' ']'
> + '[' add-kernel = remove-kernel ']'
> + options='--action add-kernel'
> + '[' -z '' ']'
> + '[' -z '' ']'
> + '[' -z '' ']'
> + '[' -z '' ']'
> + '[' -x /usr/sbin/bootloader-config ']'
> + bootloader-config --kernel-version 5.4.2-desktop-1.mga7 --initrd-options '' --action add-kernel
> Unsupported ioctl: cmd=0x5331
> Running in chroot, ignoring request.
> Unsupported ioctl: cmd=0x5331
> Running in chroot, ignoring request.
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> cannot find root partition in /etc/fstab
> cannot find root partition
> + echo -e '\nEnd trying to generate extlinux script with errcode 255\n'
> 
> End trying to generate extlinux script with errcode 255 
> 

I see that the errors are in the perl script bootloader-config. But I don't perl...
Is someone able to debug the perl in a chroot ?
Specialy that two lines :
>     my $root_part = fs::get::root_([ fs::get::fstab($all_hds) ]) or warn "cannot find root partition in /etc/fstab\n";
>     $root_part ||= fs::get::root_from_mounted() or die "cannot find root partition\n";
What should I do in order to take the FSTAB from my chrooted directory in this PERL script ? (the FSTAB exists before the chroot).
What can I do ?
Comment 4 Jybz 2019-12-15 20:34:47 CET
For info, script debuging mode, with the command "perl -d /usr/sbin/bootloader-config [args]"
> 
> Loading DB routines from perl5db.pl version 1.53
> Editor support available.
> 
> Enter h or 'h h' for help, or 'man perldebug' for more help.
> 
> main::(/usr/sbin/bootloader-config:9):
> 9:      $::isStandalone = 1; #- not using standalone which messes with @ARGV and usage
>   DB<1> n
> main::(/usr/sbin/bootloader-config:10):
> 10:     c::openlog('bootloader-config' . "[$$]");
>   DB<1> n
> main::(/usr/sbin/bootloader-config:12):
> 12:     $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";
>   DB<1> n
> main::(/usr/sbin/bootloader-config:14):
> 14:     my %options = (
> 15:                    'action=s' => \ (my $action),
>   DB<1> n
> main::(/usr/sbin/bootloader-config:31):
> 31:     GetOptions(%options) && $action or die <<'EOF';
> 32:     usage: bootloader-config --action add-kernel (--image <vmlinuz> | --kernel-version <2.6.xxx>) [--label <...>] [--no-short-name] [--initrd-options <options>]
> 33:            bootloader-config --action remove-kernel (--image <vmlinuz> | --kernel-version <2.6.xxx>)
>   DB<1> n
> main::(/usr/sbin/bootloader-config:44):
> 44:     my @known_actions = qw(add-kernel remove-kernel update-splash remove-splash rebuild-initrds migrate-to-uuids detectloader add-entry remove-entry add-resume2);
>   DB<1> n
> main::(/usr/sbin/bootloader-config:45):
> 45:     $action && member($action, @known_actions) or die "<action> must be one of " . join(' ', @known_actions) . "\n";
>   DB<1> n
> main::(/usr/sbin/bootloader-config:47):
> 47:     if ($image) {
>   DB<1> n
> main::(/usr/sbin/bootloader-config:57):
> 57:         $image = find { -e $_ } map { "/boot/$_-$kernel_version" } qw(vmlinux uImage vmlinuz);
>   DB<1> n
> main::(/usr/sbin/bootloader-config:57):
> 57:         $image = find { -e $_ } map { "/boot/$_-$kernel_version" } qw(vmlinux uImage vmlinuz);
>   DB<1> n
> main::(/usr/sbin/bootloader-config:57):
> 57:         $image = find { -e $_ } map { "/boot/$_-$kernel_version" } qw(vmlinux uImage vmlinuz);
>   DB<1> n
> main::(/usr/sbin/bootloader-config:57):
> 57:         $image = find { -e $_ } map { "/boot/$_-$kernel_version" } qw(vmlinux uImage vmlinuz);
>   DB<1> n
> main::(/usr/sbin/bootloader-config:61):
> 61:     my $all_hds = fsedit::get_hds();
>   DB<1> n
> Unsupported ioctl: cmd=0x5331
> Running in chroot, ignoring request.
> Unsupported ioctl: cmd=0x5331
> Running in chroot, ignoring request.
> main::(/usr/sbin/bootloader-config:62):
> 62:     fs::get_info_from_fstab($all_hds);
>   DB<1> n
> main::(/usr/sbin/bootloader-config:64):
> 64:     my $bootloader = bootloader::read($all_hds);
>   DB<1> n
> main::(/usr/sbin/bootloader-config:65):
> 65:     if (!$bootloader) {
>   DB<1> n
> main::(/usr/sbin/bootloader-config:76):
> 76:     $action =~ s/-/_/g;
>   DB<1> n
> main::(/usr/sbin/bootloader-config:77):
> 77:     $::{$action}->();
>   DB<1> n
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> Unsupported ioctl: cmd=0xffffffff80604521
> ioctl EVIOCGBIT failed: Function not implemented
> cannot find root partition in /etc/fstab
>  at /usr/sbin/bootloader-config line 159.
>         main::add_kernel() called at /usr/sbin/bootloader-config line 77
> cannot find root partition
>  at /usr/sbin/bootloader-config line 160.
>         main::add_kernel() called at /usr/sbin/bootloader-config line 77
> Debugged program terminated.  Use q to quit or R to restart,
> use o inhibit_exit to avoid stopping after program termination,
> h q, h R or h o to get additional info.
>   DB<1> q
>
Comment 5 Lewis Smith 2019-12-17 15:39:48 CET
Sorry to be slow replying.
To start at the beginning... It seems you are trying to port Mageia to Banana Pro.
The Description summarises the bug: a kernel update introduced a faulty file:
/boot/extlinux/extlinux.conf       [not on my system]
 which contained two blank entries:
label 
  kernel
and you found that:
> When I commented the lines with empty entries :
> # label 
> #   kernel 
> Uboot starts Mageia using that file.
Well done. *This* seems to be the bug. And thank you for reporting it, with the good initial evidence.
-----
What follows gets out of hand, and ends up with "cannot find root partition" errors far removed from the original error. It is more suited to a forum or IRC: you already used #mageia-dev. Are you are hoping to use a script out of context?

I could not pin down any Mageia fault in comments 2 onwards.

Assigning to tv for drakxtools; CC tmb for his wisdom, and having committed the SRPM relatively recently.

Summary: Empty entry in extlinux generated by drakboot crashes uboot. => Banana Pro: Empty entries in /boot/extlinux/extlinux.conf crashes uboot.
Assignee: bugsquad => thierry.vignaud
CC: (none) => tmb
Source RPM: drakboot => drakxtools-18.21-1.mga7.src.rpm

Comment 6 Jybz 2019-12-28 16:09:26 CET
(sorry I was busy, I will answer soon.
Just to let you know, the new kernel update modify well the /boot/extlinux/extlinux.conf file :

> [root@bananaPro ~]# cat /boot/extlinux/extlinux.conf
> # File generated by DrakX/drakboot
> default linux
> timeout 30
> menu title Boot Menu
> 
> label linux
>   kernel /boot/vmlinuz
>   initrd /boot/initrd.img
>   fdtdir /usr/lib/linux-5.4.6-desktop-2.mga7
>   append root=UUID=03c0235b-ec27-4b41-ba5c-bd7a80999374 root=UUID=03c0235b-ec27-4b41-ba5c-bd7a80999374
> 
> label desktop 5.4.2-1.mga7
>   kernel /boot/vmlinuz-5.4.2-desktop-1.mga7
>   initrd /boot/initrd-5.4.2-desktop-1.mga7.img
>   fdtdir /usr/lib/linux-5.4.2-desktop-1.mga7
>   append root=UUID=03c0235b-ec27-4b41-ba5c-bd7a80999374
> 
> label desktop 5.4.6-2.mga7
>   kernel /boot/vmlinuz-5.4.6-desktop-2.mga7
>   initrd /boot/initrd-5.4.6-desktop-2.mga7.img
>   fdtdir /usr/lib/linux-5.4.6-desktop-2.mga7
>   append root=UUID=03c0235b-ec27-4b41-ba5c-bd7a80999374 root=UUID=03c0235b-ec27-4b41-ba5c-bd7a80999374
> [root@bananaPro ~]# reboot

And it reboots well also.

The problem is for the first kernel update
or the installation of the kernel in chroot.
Comment 7 Jybz 2020-01-04 22:28:14 CET
The script /usr/sbin/installkernel which starts /usr/sbin/bootloader-config works with aarch64 in chroot on x86_64 (but not with armv7hl).
Comment 8 Aurelien Oudelet 2021-07-06 13:17:36 CEST
Mageia 7 is EOL since July 1st 2021.
There will not have any further bugfix for this release.

You are encouraged to upgrade to Mageia 8 as soon as possible.

@reporter, if this bug still apply with Mageia 8, please let us know it.

@packager, if you work on the Mageia 7 version of your package, please check the Mageia 8 package if issue is also present. In this case, please fix the Mageia 8 version instead.

This bug report will be closed OLD if there is no further notice within 1st September 2021.
Comment 9 Marja Van Waes 2021-09-07 14:09:40 CEST
Hi bug reporter and hi assignee and others involved,

Please reopen this bug report if it is still valid for Mageia 8 or 9(cauldron), and change "Version:" in the upper left of this report accordingly.

This report is being closed as OLD because it was filed against Mageia 7, for which  support ended on June 30th 2021.

Thanks,
Marja

Status: NEW => RESOLVED
Resolution: (none) => OLD


Note You need to log in before you can comment on or make changes to this bug.