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

Deprecate CentralProcessor's getSystemSerialNumber method #307

Merged
merged 1 commit into from
Feb 4, 2017
Merged

Deprecate CentralProcessor's getSystemSerialNumber method #307

merged 1 commit into from
Feb 4, 2017

Conversation

dbwiddis
Copy link
Member

@dbwiddis dbwiddis commented Feb 3, 2017

It duplicated ComputerSystem's getSerialNumber method. See #296

duplicated ComputerSystem's getSerialNumber method.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.222% when pulling 842055d on dbwiddis:master into 6a25d7a on oshi:master.

@dbwiddis dbwiddis merged commit 847d494 into oshi:master Feb 4, 2017
@neilyoung
Copy link

What is supposed to be used instead?

@Qiu1024
Copy link

Qiu1024 commented Jan 2, 2018

I think it's:
"
SystemInfo sys = new SystemInfo();
ComputerSystem cs = sys.getHardware().getComputerSystem();
String serialNum = cs.getSerialNumber();
"

@neilyoung
Copy link

@Qiu1024 Indeed. Thanks

@neilyoung
Copy link

@Qiu1024 The problem with cs.getSerialNumber() is, that it returns "unkown" on two different Ubuntu systems, hence it cannot be used for generating keys. What else do you have? :)

@YoshiEnVerde
Copy link
Collaborator

@neilyoung On which Ubuntu versions is this failing? Are you running the code under root privileges?

@neilyoung
Copy link

neilyoung commented Jan 15, 2018

@YoshiEnVerde

Ubuntu 17.10 on a 10 years old 32 bit Samsung R509 laptop
And no, I'm not (g)root :)

EDIT: If I run as sudo, the correct serial number appears. Is root required?

@YoshiEnVerde
Copy link
Collaborator

@neilyoung Then that's where it's failing. For older versions of Linux, the code defaults to HAL (and equivalent) tables. For newer versions, we check values that can only be accessed by root.

Sadly, hardware info at this level can only be accessed by root users in Linux

@dbwiddis
Copy link
Member Author

Sadly, hardware info at this level can only be accessed by root users in Linux

Sadly for OSHI. Happily for privacy advocates who won this particular battle in Linux.

But yes... for full functionality on Linux (and many Unix features) part of your implementation plan needs to be running OSHI (or the program you import it into) with elevated privileges.

@neilyoung
Copy link

neilyoung commented Jan 15, 2018

@dbwiddis Strange enough, the same code doesn't need to have root on MacOSX. Cannot believe Apple to be less restrictive here :), but it seems to be the case

@dbwiddis
Copy link
Member Author

There are workarounds besides root.... for example, installing hal package. OSHI has several fallbacks that it attempts but if the user doesn't cooperate, there's not much we can do!

Not sure why Apple makes it easy. :)

@neilyoung
Copy link

@dbwiddis What are the other fallbacks? There is no HAL installer any longer for Ubuntu since 10.something

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

Successfully merging this pull request may close these issues.

None yet

5 participants