| View previous topic :: View next topic |
| Author |
Message |
Dutch_Master LXF regular
Joined: Tue Mar 27, 2007 2:49 am Posts: 2353
|
Posted: Thu Jul 24, 2008 3:02 am Post subject: What does Linux know about your hardware? |
|
|
On a regular basis (new) members ask help to 'troubleshoot' their system. In most cases it's pretty simple, but sometimes we'd need to know more about your system. I've created a little script you can use to do the 'dirty' work for you. Note that it currently only works on Debian based systems (next to Debian itself also any Ubuntu variant, Xandros and Knoppix) with the lshw package installed. Contributions to make the script distro-independent and a check of wether the required package(s) is/are installed are welcome
| Code: | #! /bin/bash
#
# script to collect hardware and software data on your system
# you'll need to be root to get proper results
# currently only works in Debian based systems, with the lshw package installed
# what kernel are you running?
echo uname -a: `uname -a` > mysystem.txt
echo ========= >> mysystem.txt
# find out all you want from your hardware with lshw
lshw >> mysystem.txt
echo ========= >> mysystem.txt
chmod 755 mysystem.txt
echo "done! read the file mysystem.txt in the current directory"
echo "use the cat and grep commands to select sections of interest if you're on the commandline"
exit 0 | Save the above text in a text file named "mysystem.sh" or click the link
Make it executable with | Code: | | chmod+x mysystem.sh | and run it withThe resulting text file "mysystem.txt" tells you all Linux knows about your hardware.
That simple? Yes, even 1sf (troll) could use it (although as Mandriva user he won't be able to run it, for now )
Anyway, this text file can be used to copy the relevant parts from in your reply (or even the original question!)
Frankly, I hope you won't need it, but if you do, let me know if it worked for you (it works on my system (pun intended )) |
|
| Back to top |
|
 |
nelz Moderator

Joined: Mon Apr 04, 2005 12:52 pm Posts: 8000 Location: Warrington, UK
|
Posted: Thu Jul 24, 2008 9:25 am Post subject: RE: What does Linux know about your hardware? |
|
|
Change
| Code: | | echo uname -a: `uname -a` > mysystem.txt |
to
| Code: | | echo uname -a: $(uname -a) >|mysystem.txt |
or it will fail if someone has the noclobber option set in their shell, or even
| Code: | echo "uname -a:" >|mysystem.txt
uname -a >>mysystem.txt |
which saves spawning another shell process.
Note that some distros install lshw into /usr/sbin, which may cause problems if you try to make the script distro-agnostic. Anyway, you should check that it is installed before trying to run it.
| Code: |
if which lshw &>/dev/null; then
lshw >> mysystem.txt
else
echo "You need to install lshw to use this script!
fi |
Why do you make the output file executable? _________________ Unix is user-friendly. It's just very selective about who it's friends are. |
|
| Back to top |
|
 |
ollie Moderator

Joined: Mon Jul 25, 2005 12:26 pm Posts: 2749 Location: Bathurst NSW Australia
|
Posted: Thu Jul 24, 2008 12:02 pm Post subject: RE: What does Linux know about your hardware? |
|
|
After installing lshw (and dependencies) the script works fine on my Asus Eee PC running the default Xandros (updated) and my self built Intel Q6600 running Ubuntu 8.04.1. The output to text is well presented and easy to search through.
Great work DM, this should be included on the LXF DVD!  |
|
| Back to top |
|
 |
Dutch_Master LXF regular
Joined: Tue Mar 27, 2007 2:49 am Posts: 2353
|
Posted: Thu Jul 24, 2008 1:02 pm Post subject: RE: What does Linux know about your hardware? |
|
|
Nelz, thanks for the suggestions, I've incorporated them in the script. The reason I've put in the chmod line is because the file is created by root and may not be readable as normal user. Changed the permissions to 644, 'cause that does the trick as well
Ollie, glad you liked it. Not sure it's mature enough to be on the LXF dvd's though  |
|
| Back to top |
|
 |
ollie Moderator

Joined: Mon Jul 25, 2005 12:26 pm Posts: 2749 Location: Bathurst NSW Australia
|
Posted: Thu Jul 24, 2008 1:48 pm Post subject: RE: What does Linux know about your hardware? |
|
|
I'm sure it is!
I'd add:
| Code: | echo ========= >> mysystem.txt
echo "System info at:" `date` >> mysystem.txt
echo ========= >> mysystem.txt |
at the start of the script just so you can check if the script was run before or after changes have been made. |
|
| Back to top |
|
 |
bobthebob1234 LXF regular

Joined: Thu Jan 03, 2008 9:38 pm Posts: 1356 Location: A hole in a field
|
Posted: Thu Jul 24, 2008 2:35 pm Post subject: |
|
|
erm, nelz
i think your missing an "
| Quote: |
if which lshw &>/dev/null; then
lshw >> mysystem.txt
else
echo "You need to install lshw to use this script!
fi
|
should be
| Code: |
if which lshw &>/dev/null; then
lshw >> mysystem.txt
else
echo "You need to install lshw to use this script!"
fi
|
I spent ages trying to get the script to work after i added your code!
Good idea though
Last edited by bobthebob1234 on Thu Jul 24, 2008 2:44 pm; edited 1 time in total |
|
| Back to top |
|
 |
bobthebob1234 LXF regular

Joined: Thu Jan 03, 2008 9:38 pm Posts: 1356 Location: A hole in a field
|
Posted: Thu Jul 24, 2008 2:42 pm Post subject: |
|
|
| Quote: |
'd add:
Code:
echo ========= >> mysystem.txt
echo "System info at:" `date` >> mysystem.txt
echo ========= >> mysystem.txt
at the start of the script just so you can check if the script was run before or after changes have been made.
|
Prehaps having the file as
mysystem date +%D .txt
might be better?
(PS, i don't know the exact syntax... ) |
|
| Back to top |
|
 |
pwbrum61 LXF regular

Joined: Fri Sep 29, 2006 10:02 am Posts: 308 Location: Worcestershire
|
Posted: Thu Jul 24, 2008 3:07 pm Post subject: |
|
|
For those of you who might dabble with Solaris, similar information to that from lshw can be obtained with
prtconf -v
 _________________ Where's the Kaboom? There's supposed to be an Earth-shattering kaboom!
. |
|
| Back to top |
|
 |
Dutch_Master LXF regular
Joined: Tue Mar 27, 2007 2:49 am Posts: 2353
|
Posted: Fri Jul 25, 2008 12:00 am Post subject: |
|
|
That's a very reasonable addition Ollie, you're in Had to change some bits though Bob, thx for getting the typo, fixed it. Solaris, however tempting and interesting, is a step too far for now pwbrum61, first get some distro-independence on Linux But I'll keep it warm for later use!  |
|
| Back to top |
|
 |
ollie Moderator

Joined: Mon Jul 25, 2005 12:26 pm Posts: 2749 Location: Bathurst NSW Australia
|
Posted: Fri Jul 25, 2008 12:25 am Post subject: |
|
|
Thanks  |
|
| Back to top |
|
 |
Dutch_Master LXF regular
Joined: Tue Mar 27, 2007 2:49 am Posts: 2353
|
Posted: Tue Jul 29, 2008 11:39 pm Post subject: |
|
|
Quick note to let you know that:
1) althought the script quoted above does work, it's version 0.001 and the link offers version 0.003 for 'download'. That is, the link always has the latest version available.
2) I'm downloading Fedora 9 ATM and will install it in a VirtualBox environment when done. Basic extention for rpm based distro's is therefor in progress. (but not yet available!) Don't hold your breath for it!  |
|
| Back to top |
|
 |
Dutch_Master LXF regular
Joined: Tue Mar 27, 2007 2:49 am Posts: 2353
|
Posted: Thu Sep 18, 2008 1:07 am Post subject: |
|
|
Update 2:
Getting Fedora to work on a virtual machine turns out to be a PITA. Slow, slugish, not responsive at all. I instantly knew again why I chose Debian in the first place Tried OpenSuse too, same results Any rpm based distro you guys would recommend that runs acceptable on a virtual machine? |
|
| Back to top |
|
 |
ollie Moderator

Joined: Mon Jul 25, 2005 12:26 pm Posts: 2749 Location: Bathurst NSW Australia
|
Posted: Thu Sep 18, 2008 3:10 am Post subject: |
|
|
With current distros you will have problems if they are configured by default to use Compiz, which requires 3D acceleration, which means that openSUSE with KDE4 would definitely have issues. You may also have to give the virtual machine more RAM if it is running very slowly. That's the big advantage of having a 64-bit OS as the base OS, you can install and use plenty of RAM  |
|
| Back to top |
|
 |
Dutch_Master LXF regular
Joined: Tue Mar 27, 2007 2:49 am Posts: 2353
|
Posted: Thu Sep 18, 2008 3:21 am Post subject: |
|
|
Thanks for the warning Ollie, but as Gnomy I wouldn't choose KDE anyway
The host has 2 GB RAM onboard, and 512 MB for a guest, and runs 64 bit Debian. Should suffice, shouldn't it? Frankly, any (modern) Linux distro that needs more then 512 MB RAM would be just as bad as M$ Vi$ta
Hmmm, would CentOS do, RH-based as it is? I'll see if I can get some .iso tomorrow  |
|
| Back to top |
|
 |
ollie Moderator

Joined: Mon Jul 25, 2005 12:26 pm Posts: 2749 Location: Bathurst NSW Australia
|
Posted: Thu Sep 18, 2008 7:25 am Post subject: |
|
|
| Dutch_Master wrote: | Thanks for the warning Ollie, but as Gnomy I wouldn't choose KDE anyway
The host has 2 GB RAM onboard, and 512 MB for a guest, and runs 64 bit Debian. Should suffice, shouldn't it? Frankly, any (modern) Linux distro that needs more then 512 MB RAM would be just as bad as M$ Vi$ta
Hmmm, would CentOS do, RH-based as it is? I'll see if I can get some .iso tomorrow  |
Gnomey still has Compiz.
I think CentOS would be closer to RHEL than Fedora.
I'm flat out with Software Freedom Day at the moment, but I'll see if I can do some testing on different distros after I have a week off.
No computers, no mobile phone reception - just fishing, sailing and pulling kids around behind my speedboat at Windamere Dam.  |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|