dell / libsmbios

library for interacting with Dell SMBIOS tables
Other
192 stars 39 forks source link

Segmentation Fault - Dell Precision T1700 #57

Closed dannyd4er closed 5 years ago

dannyd4er commented 6 years ago

Hi, I'm experiencing an issue trying to set an asset tag on some Precision T1700s running Ubuntu 18.04. I also tried on 16.04 with the same issue. I am able to do this fine on other models using the normal syntax so I guess this could be something model specific. The only error message i receive is "Segmentation fault". Would you be able to help at all to resolve or debug this? Originally I had some errors which I assumed related to the line #88 in file /usr/lib/python3/dist-packages/libsmbios_c/system_info.py not including .encode() after newtag After adding this to line I no longer receive the error message - just segmentation fault.


root@computer:~# smbios-sys-info
Libsmbios version:      2.4.1
Product Name:           Precision T1700
Vendor:                 Dell Inc.
BIOS Version:           A25
System ID:              0x05A6
Service Tag:            BKW9LJ1
Express Service Code:   25208125823
Asset Tag:              Not Specified
Property Ownership Tag:```

```root@computer:~# smbios-sys-info --asset-tag --set=B080666
Current tag value:
Asset Tag: Not Specified

Setting new tag value: B080666
Segmentation fault```

```root@computer:~# uname -r
4.15.0-23-generic
root@computer:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04 LTS
Release:    18.04
Codename:   bionic```

without the .encode() in file /usr/lib/python3/dist-packages/libsmbios_c/system_info.py line #88  (Just incase)

```root@computer:~# smbios-sys-info --asset-tag --set=B080666
Current tag value:
Asset Tag: Not Specified

Setting new tag value: B080666
Traceback (most recent call last):
  File "/usr/sbin/smbios-sys-info", line 132, in <module>
    sys.exit( main() )
  File "/usr/sbin/smbios-sys-info", line 120, in main
    fn(options.set, options.password_ascii, options.password_scancode)
  File "/usr/lib/python3/dist-packages/libsmbios_c/trace_decorator.py", line 103, in trace
    result = func(*args, **kw)
  File "/usr/lib/python3/dist-packages/libsmbios_c/system_info.py", line 88, in set_asset_tag
    return DLL.sysinfo_set_asset_tag(newtag, pass_ascii, pass_scancode)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type```

Many thanks.
superm1 commented 6 years ago

There's a bunch of things to unpack here to figure out where the root of the problem is.

  1. When you say that it's the same issue on 16.04, do you mean with libsmbios 2.4.1 on 16.04 or the libsmbios that was in the Ubuntu repositories?
  2. When testing on 16.04 which kernel were you using? 4.15? 4.4?
  3. With 2.4.1 we switched to python3 and there have been some python problems found in the conversion still. It's entirely possible there is a bug in the source file for that missing .encode(), but there is another issue as well.
  4. When you say that this works on other models, do you mean libsmbios 2.4.1 on Ubuntu 18.04 on another model, or is it a different combination of software?
dannyd4er commented 6 years ago

Thanks for your reply and advice. I will retest on a 16.04 with the default libsmbios (2.3.0) and I will also test with the 2.4.1 and let you know. I will confirm kernel versions also and see if this changes anything.

In regards to question 4, I tested on a Precision 3620, libsmbios version 2.4.1 on Ubuntu 18.04 kernel 4.15.0-22-generic and the tag set fine - no issues.

superm1 commented 6 years ago

In regards to question 4, I tested on a Precision 3620, libsmbios version 2.4.1 on Ubuntu 18.04 kernel 4.15.0-22-generic and the tag set fine - no issues.

Huh? Well that's pretty surprising to me. I think the one difference that's notable is that I doubt the T1700 supports the WMI interface, but I don't think that will matter in this instance. It could possibly be a BIOS bug on the T1700 or a bug with handling on the older machines. I guess let's see what your results are from the other testing.

dannyd4er commented 6 years ago

So I went back and retested, I tried to minimize variables to give it a fair test. Running Ubuntu 16.04 with Kernel 4.15.18-041518-generic. I install from the default repo and the tag sets fine:

Libsmbios version:      2.3.0
Product Name:           Precision T1700
Vendor:                 Dell Inc.
BIOS Version:           A25
System ID:              0x05A6
Service Tag:            GRB6P02
Express Service Code:   36479892242
Asset Tag:              B111111
Property Ownership Tag: 
root@computer:~# uname -r
4.15.18-041518-generic
root@computer:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:    16.04
Codename:   xenial

I then build libsmbios 2.4.2 and run to confirm its the updated version:


Libsmbios version:      2.4.2
Product Name:           Precision T1700
Vendor:                 Dell Inc.
BIOS Version:           A25
System ID:              0x05A6
Service Tag:            GRB6P02
Express Service Code:   36479892242
Asset Tag:              B111111
Property Ownership Tag: 

I get the same error which again I believe relates to the encode() missing. I rectify and get:

smbios-sys-info --asset-tag --set=B333333
Current tag value:
Asset Tag: B111111

Setting new tag value: B333333
Segmentation fault (core dumped)

Anything else I can try to give you some more info? Cheers

dannyd4er commented 6 years ago

A bit more info, On the Ubuntu 18.04 Machine, I tried to set the tag using an older version of libsmbios. I tried with both 2.4.0 and 2.3.3

4.15.0-23-generic
root@computer:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04 LTS
Release:    18.04
Codename:   bionic
Libsmbios version:      2.4.0
Product Name:           Precision T1700
Vendor:                 Dell Inc.
BIOS Version:           A25
System ID:              0x05A6
Service Tag:            F62KD22
Express Service Code:   33018841370
Asset Tag:              Not Specified
Property Ownership Tag: 

smbios-sys-info --asset-tag --set=B333333
Current tag value:
Asset Tag: Not Specified

Setting new tag value: B333333
Segmentation fault

I build version 2.3.3 and do the same:

Libsmbios version:      2.3.3
Product Name:           Precision T1700
Vendor:                 Dell Inc.
BIOS Version:           A25
System ID:              0x05A6
Service Tag:            F62KD22
Express Service Code:   33018841370
Asset Tag:              B111111
Property Ownership Tag: 

smbios-sys-info --asset-tag --set=B333333
Current tag value:
Asset Tag: B111111

Setting new tag value: B333333

As you can see 2.3.3 sucessfully sets the tag. What is interesting is that 2.3.3 actually sees there is an exsiting tag where as 2.4.0 didnt,

I try again with 2.4.1 and I get the same behaviour - no asset tag detected.

Libsmbios version:      2.4.1
Product Name:           Precision T1700
Vendor:                 Dell Inc.
BIOS Version:           A25
System ID:              0x05A6
Service Tag:            F62KD22
Express Service Code:   33018841370
Asset Tag:              Not Specified
Property Ownership Tag:

Hopefully this will help in some way? Thanks

Mazo commented 5 years ago

I have the exact same error as @isaquemelo on a Dell R320 using version 2.4.2 BIOS.

pivaldi commented 5 years ago

The same problem here with this two computers

superm1 commented 5 years ago

@pivaldi I wouldn't expect this tool to work properly on non-Dell machines. Segfaults are of course less optimal though. can you provide a backtrace with gdb? Also are you able to use other features?

pivaldi commented 5 years ago

Sorry I see now this tool is for Dell machines only but it works properly reading sys infos on various computers. Here the gdb output :

gdb -ex r --args python /usr/sbin/smbios-sys-info --service-tag --set=XXXXXXX
GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...(no debugging symbols found)...done.
Starting program: /usr/bin/python /usr/sbin/smbios-sys-info --service-tag --set=XXXXXXX
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Current tag value:
Service Tag: R90N9D4P

Setting new tag value: XXXXXXX

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5c2c5d5 in ?? () from /usr/lib/libsmbios_c.so.2
(gdb)
superm1 commented 5 years ago

Any chance you can install debug symbols and then run the bt gdb command after that?

superm1 commented 5 years ago

Or if you can give me a core dump after you install debug symbols that would be even better.

pivaldi commented 5 years ago

How can I do that. I've installed smbios-utils-dbgsym in my Debian OS… What next ?

superm1 commented 5 years ago

Depends on how core dump is configured on Debian. The docs you need are here: http://sourceware.org/gdb/onlinedocs/gdb/Core-File-Generation.html

Basically launch with gdb and try to use those commands.

pivaldi commented 5 years ago

Here the core dump file generate by the gdb command gcore. Is it right ?

superm1 commented 5 years ago

I'm having a hard time replicating the environment. It looks like you need libsmbios2-dbgsym though. If you can try one more time with that installed and then share coredump along with output of bt command please.

pivaldi commented 5 years ago

The package is installed and the core dump file is updated. Here the result of bt cmd :

(gdb) bt
#0  setServiceTagUsingCMOSToken (newTag=<optimized out>, pass_ascii=<optimized out>, pass_scancode=<optimized out>) at src/libsmbios_c/system_info/service_tag.c:377
#1  0x00007ffff5c2f0ea in sysinfo_set_service_tag (serviceTag=0x7ffff5b4b6b4 "XXXXXXX", pass_ascii=0x0, pass_scancode=0x0) at src/libsmbios_c/system_info/service_tag.c:465
#2  0x00007ffff5e55038 in ffi_call_unix64 () from /usr/lib/x86_64-linux-gnu/libffi.so.6
#3  0x00007ffff5e54a9a in ffi_call () from /usr/lib/x86_64-linux-gnu/libffi.so.6
#4  0x00007ffff6069224 in _ctypes_callproc () from /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so
#5  0x00007ffff6068be5 in ?? () from /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so
#6  0x000055555563c0c3 in PyObject_Call ()
#7  0x000055555565535f in PyEval_EvalFrameEx ()
#8  0x000055555564d9f5 in PyEval_EvalCodeEx ()
#9  0x000055555566a778 in ?? ()
#10 0x000055555563c0c3 in PyObject_Call ()
#11 0x00005555556563a0 in PyEval_EvalFrameEx ()
#12 0x000055555564d9f5 in PyEval_EvalCodeEx ()
#13 0x0000555555655b78 in PyEval_EvalFrameEx ()
#14 0x000055555564d9f5 in PyEval_EvalCodeEx ()
#15 0x0000555555655448 in PyEval_EvalFrameEx ()
#16 0x000055555565514f in PyEval_EvalFrameEx ()
#17 0x000055555564d9f5 in PyEval_EvalCodeEx ()
#18 0x000055555564d7b9 in PyEval_EvalCode ()
#19 0x000055555567dbff in ?? ()
#20 0x0000555555678b52 in PyRun_FileExFlags ()
#21 0x000055555567869e in PyRun_SimpleFileExFlags ()
#22 0x0000555555629771 in Py_Main ()
#23 0x00007ffff6f182e1 in __libc_start_main (main=0x5555556290a0 <main>, argc=4, argv=0x7fffffffe3a8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe398) at ../csu/libc-start.c:291
#24 0x0000555555628f9a in _start ()
(gdb)
superm1 commented 5 years ago

^ @pivaldi can you see if that fixes it for you?

superm1 commented 5 years ago

@dannyd4er, @isaquemelo can you try that branch? (fixes-57)?

pivaldi commented 5 years ago
[root@t560 libsmbios  (6d84ef2...)]$ smbios-sys-info --service-tag --set=XXXXXXX
Traceback (most recent call last):
  File "/usr/local/sbin/smbios-sys-info", line 132, in <module>
    sys.exit( main() )
  File "/usr/local/sbin/smbios-sys-info", line 86, in main
    cli.setup_std_options(options)
  File "/usr/local/share/smbios-utils/cli.py", line 77, in setup_std_options
    options.password_ascii = options.password.encode()
AttributeError: 'NoneType' object has no attribute 'encode'
[root@t560 libsmbios  (6d84ef2...)]$
superm1 commented 5 years ago

Sorry about that, just pushed a fix, can you try again.

pivaldi commented 5 years ago

There is no problem… Now it's better but does not do the job :)

[root@t560 libsmbios  (a171ee8...)]$ smbios-sys-info --service-tag --set=XXXXXXX
Current tag value:
Service Tag: R90N9D4P

Setting new tag value: XXXXXXX
[root@t560 libsmbios  (a171ee8...)]$ smbios-sys-info --service-tag
Service Tag: R90N9D4P
[root@t560 libsmbios  (a171ee8...)]$
superm1 commented 5 years ago

Thanks! That's all I can hope for is no crashes:)