Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault on CLR 36110 due to missing /dev/(root|boot) devices #248

Open
MartB opened this issue Mar 30, 2022 · 3 comments
Open

Segfault on CLR 36110 due to missing /dev/(root|boot) devices #248

MartB opened this issue Mar 30, 2022 · 3 comments

Comments

@MartB
Copy link

MartB commented Mar 30, 2022

Describe the bug
Segmentation fault due to missing /dev/(root|boot) devices, not sure if intended, i would expect a tool like clr-boot-manager to still work in this case, neither do i know why its not created anymore. Would it not be better to fallback to /dev/disk/by-label/(root|boot) if the /dev mapping isnt found?

To Reproduce
Run clr-bootmanager update

To temporarily fix / workaround

ln -s /dev/vda2 /dev/root
ln -s /dev/vda1 /dev/boot

Environment (please complete the following information):

  • Clear Linux OS Version: 36110
  • clr-boot-manager Version: 3.2.9
  • Platform: x86 legacy MBR VM (lts2020 kernel)

Block Devices:

  • List of Block Devices: [lsblk -a --json]
{
   "blockdevices": [
    // stripped loop devices 
    {
         "name": "vda",
         "maj:min": "253:0",
         "rm": false,
         "size": "25G",
         "ro": false,
         "type": "disk",
         "mountpoints": [
             null
         ],
         "children": [
            {
               "name": "vda1",
               "maj:min": "253:1",
               "rm": false,
               "size": "149M",
               "ro": false,
               "type": "part",
               "mountpoints": [
                   "/boot"
               ]
            },{
               "name": "vda2",
               "maj:min": "253:2",
               "rm": false,
               "size": "24,9G",
               "ro": false,
               "type": "part",
               "mountpoints": [
                   "/"
               ]
            }
         ]
      }
   ]
}

Additional context

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f84d86 in blkid_do_safeprobe (pr=0x0) at libblkid/src/probe.c:1561
1561	libblkid/src/probe.c: No such file or directory.
(gdb) bt
#0  0x00007ffff7f84d86 in blkid_do_safeprobe (pr=0x0) at libblkid/src/probe.c:1561
#1  0x00005555555616f6 in get_parent_disk_devno (diskdevno=<synthetic pointer>, path=0x555555577520 "/") at ../src/lib/files.c:166
#2  get_parent_disk (path=0x555555577520 "/") at ../src/lib/files.c:208
#3  0x00005555555619f3 in get_legacy_boot_device (path=path@entry=0x555555577520 "/") at ../src/lib/files.c:283
#4  0x000055555555f3d8 in cmb_inspect_root_native (realp=0x555555577520 "/", c=0x5555555786a0) at ../src/bootman/sysconfig.c:183
#5  cbm_inspect_root (path=path@entry=0x55555556e931 "/", image_mode=<optimized out>) at ../src/bootman/sysconfig.c:243
#6  0x000055555555b0c3 in boot_manager_set_prefix (self=self@entry=0x555555577e50, prefix=prefix@entry=0x55555556e931 "/") at ../src/bootman/bootman.c:184
#7  0x000055555555ae02 in cbm_command_update_do (manager=0x555555577e50, root=0x0, forced_image=<optimized out>) at ../src/cli/ops/update.c:77
#8  0x000055555555aedc in cbm_command_update (argc=<optimized out>, argv=<optimized out>) at ../src/cli/ops/update.c:44
#9  0x0000555555559772 in main (argc=0, argv=0x7fffffffc1b8) at ../src/cli/main.c:280
#0  0x00007ffff7f84d86 in blkid_do_safeprobe (pr=0x0) at libblkid/src/probe.c:1561
        i = <optimized out>
        count = 0
        rc = 0
        done = <optimized out>
        chn = <optimized out>
#1  0x00005555555616f6 in get_parent_disk_devno (diskdevno=<synthetic pointer>, path=0x555555577520 "/") at ../src/lib/files.c:166
        st = {st_dev = 64770, st_ino = 2, st_nlink = 19, st_mode = 16877, st_uid = 0, st_gid = 0, __pad0 = 0, st_rdev = 0, st_size = 4096, st_blksize = 4096, st_blocks = 8, st_atim = {tv_sec = 1648627074, tv_nsec = 555206050}, st_mtim = {tv_sec = 1627586797,
            tv_nsec = 819269620}, st_ctim = {tv_sec = 1627586797, tv_nsec = 819269620}, __glibc_reserved = {0, 0, 0}}
        dev_path = 0x0
        pr = 0x0
        st = <optimized out>
        dev_path = <optimized out>
        pr = <optimized out>
#2  get_parent_disk (path=0x555555577520 "/") at ../src/lib/files.c:208
        devt = <optimized out>
        node = 0x0
#3  0x00005555555619f3 in get_legacy_boot_device (path=path@entry=0x555555577520 "/") at ../src/lib/files.c:283
        probe = 0x0
        parts = 0x0
        part_count = 0
        ret = 0x0
        parent_disk = 0x0
        devfs = 0x55555556d09c "/dev"
#4  0x000055555555f3d8 in cmb_inspect_root_native (realp=0x555555577520 "/", c=0x5555555786a0) at ../src/bootman/sysconfig.c:183
        native_uefi = <optimized out>
        fw_path = 0x555555577500 "/sys/firmware/efi"
        boot = 0x0
        native_uefi = <optimized out>
        fw_path = <optimized out>
        boot = <optimized out>
#5  cbm_inspect_root (path=path@entry=0x55555556e931 "/", image_mode=<optimized out>) at ../src/bootman/sysconfig.c:243
        c = 0x5555555786a0
        realp = 0x555555577520 "/"
        rel = 0x0
        __func__ = "cbm_inspect_root"
#6  0x000055555555b0c3 in boot_manager_set_prefix (self=self@entry=0x555555577e50, prefix=prefix@entry=0x55555556e931 "/") at ../src/bootman/bootman.c:184
        __PRETTY_FUNCTION__ = "boot_manager_set_prefix"
        kernel_dir = 0x0
        initrd_dir = 0x0
        user_initrd_dir = 0x0
        config = 0x0
        __func__ = "boot_manager_set_prefix"
#7  0x000055555555a304 in cbm_command_list_kernels (argc=<optimized out>, argv=<optimized out>) at ../src/cli/ops/kernels.c:67
        root = 0x0
        manager = 0x555555577e50
        forced_image = false
        kernels = 0x0
        update_efi_vars = true
        __func__ = "cbm_command_list_kernels"

dev_path=0x0 and the resulting PR=0x0 is the reason i guess, but i dont know how thats possible for the '/' lookup, as the blkid command works fine.

@MartB MartB changed the title Segfault when running update on CLR 36110 Segfault when running on CLR 36110 Mar 30, 2022
@MartB MartB changed the title Segfault when running on CLR 36110 Segfault when running on CLR 36110 due to missing /dev/root device. Mar 30, 2022
@MartB MartB changed the title Segfault when running on CLR 36110 due to missing /dev/root device. Segfault on CLR 36110 due to missing /dev/(root|boot) devices Mar 30, 2022
@quizac-
Copy link

quizac- commented May 11, 2022

It actually starts segfaulting from release 36080. I was bisecting it from 35000(default on AWS market) til latest in order to find last stable release.

35000 ok
35800 ok
36000 ok
36050 ok
36060 ok
36070 ok
36080 clr-boot-manager update: segfault
36100 clr-boot-manager update: segfault
36280 clr-boot-manager update: segfault

@quizac-
Copy link

quizac- commented May 11, 2022

It seems that upgrade process from 36070 to 36080 removed /dev/root and more recent binaries cannot cope with it. I'm using AWS provided image so no extra /boot partition is needed hence creating /dev/root symlink was sufficient to mitigate the issue. From my perspective, it seems to be quite severe bc CL3 would be first choice for those who demand extra kick given by performance optimization and tuning kernel params is a common step to configure isolcpus, etc while this bug prevents CL3 from running at full potential. Thanks @MartB for workaround!

@quizac-
Copy link

quizac- commented May 12, 2022

Below you can find temporary solution which creates /dev/root at boot:
cat /etc/systemd/system/cbm_fix.service:
`[Unit]
Description=cbm_fix
After=local-fs.target

[Service]
ExecStart=/usr/sbin/cbm_fix
RemainAfterExit=yes
Type=oneshot
User=root
Group=root
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cbm_fix

[Install]
WantedBy=multi-user.target
`

/usr/sbin/cbm_fix:
`#!/bin/bash

root_dev=mount | grep -F ' on / type ' | awk '{ print $1 }'
[ -n "$root_dev" ] && ln -sf "$root_dev" /dev/root

exit 0
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants