- Linux check BIOS settings from the command line
- How to view BIOS setting from the command line on Linux
- Можно ли изменить настройки BIOS из Linux?
- Как прочитать / записать все настройки BIOS из Linux CLI?
- LPI Linux Certification/Configure Fundamental BIOS Settings
- Contents
- Configure Fundamental BIOS Settings [ edit | edit source ]
- Detailed Objective [ edit | edit source ]
- BIOS [ edit | edit source ]
- Introduction [ edit | edit source ]
- POST — Power On Self Test [ edit | edit source ]
- Hardware Management [ edit | edit source ]
- Security [ edit | edit source ]
- Date and Time [ edit | edit source ]
- Disk Drives [ edit | edit source ]
- Attachment Interfaces [ edit | edit source ]
- A Brief History [ edit | edit source ]
- LBA [ edit | edit source ]
- IRQ [ edit | edit source ]
- DMA [ edit | edit source ]
- I/O [ edit | edit source ]
- Putting it all together [ edit | edit source ]
- Viewing BIOS-related information in Linux [ edit | edit source ]
- Introduction [ edit | edit source ]
- /proc [ edit | edit source ]
- Getting kernel information [ edit | edit source ]
- /proc/acpi [ edit | edit source ]
- Getting hard drive Information [ edit | edit source ]
Linux check BIOS settings from the command line
How to view BIOS setting from the command line on Linux
Open the terminal application. You must login as root to run command:
$ sudo -i
OR
$ su —
Type the following command:
# dmidecode | more
Sample outputs:
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
See “Get Information About Your BIOS / Server Hardware From a Shell Without Opening Chassis ( BIOS Decoder )” for more info. Another option is to run:
# biosdecode
You can also use command such as hwinfo. It is used to probe for the hardware present in the system. It can be used to generate a system overview log which can be later used for support.
# hwinfo
# hwinfo —short
# hwinfo —disk
# hwinfo —short —block
# hwinfo —disk —only /dev/sdb
Sample outputs:
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник
Можно ли изменить настройки BIOS из Linux?
Я пытаюсь написать скрипт для включения IPMI на кучу машин без необходимости подключать к ним KVM один за другим. Можно ли изменить настройки BIOS с Linux? ОС SL6.
Я понимаю, что каждую машину, вероятно, нужно будет включать и выключать, но я могу делать это программно, конечно.
В общем нет. Не существует стандарта для того, как хранятся настройки и даже какие настройки существуют. Эта информация является собственностью каждого отдельного BIOS.
Использование:
. читать
- dmidecode (инструмент для сброса DMI на компьютере (некоторые говорят, SMBIOS))
. написать
http://flashrom.org (инструмент для идентификации, чтения, записи, проверки и удаления флэш-чипов . )
http://www.coreboot.org (это проект свободного программного обеспечения, направленный на замену проприетарного BIOS (прошивки), найденного на большинстве компьютеров.)
На серверах HPE вы можете изменить настройки с помощью утилиты под названием conrep . Это часть hp-scripting-tools RPM. Использование описано здесь:
Это довольно просто. С параметром -s (сохранить) вы говорите, чтобы сохранить конфигурацию, например:
И с параметром -l (нагрузка) вы говорите, чтобы загрузить конфигурацию:
Файл данных на самом деле является XML-кодом. Поэтому, если вы хотите, например, включить / отключить настройки гиперпоточности, найдите соответствующую строку и измените значение. Смотрите пример для G6 и более новых поколений:
Источник
Как прочитать / записать все настройки BIOS из Linux CLI?
Я искал около 8 часов, и я хотел бы прояснить моменты, которые я еще не до конца выяснил.
(Версия TLDR: Как я могу получить доступ (читать и писать) ко всем настройкам BIOS (таким как включение / отключение виртуализации, включение / отключение турбо частоты графического процессора, установка времени отображения журнала и т.д.) Из CLI?)
Во-первых, у нас были старые BIOS, такие как этот.
И теперь у нас есть новое поколение BIOS, таких как этот. И мы называем их UEFI BIOS, я прав?
Затем я прочитал (и протестировал) следующие статьи:
- www.pixelbeat.org/docs/bios/
- stackoverflow.com/questions/6259124/apis-for-querying-and-setting-bios-properties (а также все ссылки, указанные в ответах)
- unix.stackexchange.com/questions/126132/how-to-dump-bios-data-to-a-file
- stackoverflow.com/questions/34537435/where-does-dmidecode-get-the-smbios-table
- en.wikipedia.org/wiki/System_Management_BIOS
- www.linux-mag.com/id/7768/
- www-pc.uni-regensburg.de/hardware/techdok/bios_dmi_20.pdf (до страницы 17)
- www.geeklab.info/2010/05/backup-your-cmos-from-linux/
- www.bioscentral.com/misc/cmosmap.htm
- smackerelofopinion.blogspot.com.tr/2010/09/digging-into-bios-cmos-memory.html
После этого я несколько раз менял настройки BIOS (такие как виртуализация, включение / отключение IGD Turbo, изменение настроек USB и т.д.) И выгружал все содержимое следующих файлов / команд при каждой загрузке.
- dmidecode
- biosdecode
- CPUID
- / DEV / MEM
- / DEV / NVRAM
Результат? Я сравнил результаты дампа бок о бок с Meld и woala! Ничего не изменилось! Какого черта.
Итак, вот список моих вопросов (я инженер-электронщик, поэтому вы можете узнать подробности или обратиться к техническим материалам без колебаний).
- В какой части материнской платы (я имею в виду чип) мы хранили все настройки BIOS (для старых версий)?
- Какое оборудование нам требуется, чтобы сохранить настройки и интерфейс BIOS UEFI? И как аппаратное обеспечение UEFI BIOS отличается от старых версий?
- Есть ли способ получить доступ к этому (или к этому) оборудованию через любые драйверы / файлы в Linux?
- Можно ли изменить эти конфигурации из-за ОС?
Источник
LPI Linux Certification/Configure Fundamental BIOS Settings
Contents
Configure Fundamental BIOS Settings [ edit | edit source ]
Detailed Objective [ edit | edit source ]
Description Candidates should be able to configure fundamental system hardware by making the correct settings in the system BIOS in x86 based hardware.
- Key knowledge area(s):
- Enable and disable integrated peripherals.
- Configure systems with or without external peripherals such as keyboards.
- Correctly set IRQ,DMA and I/O addresses for all BIOS administrated ports and settings for error handling.
- The following is a partial list of the used files, terms and utilities:
- /proc/ioports
- /proc/interrupts
- /proc/dma
- /proc/pci
BIOS [ edit | edit source ]
BIOS Tips & Tricks |
---|
Familiarize yourself with BIOS settings in equipment that you support. |
Know your beeps: You may not have access to the internet when things go wrong. |
Change control: Always make sure you can reverse any change you make in a BIOS. |
BIOS updates: Keep informed. Don’t roll them out as soon as they hit the mirrors. Wait a couple of months then check manufacturer forums for problems with the update. Once you are happy, update one system, monitor it and then roll out to the rest of your systems. Document the change, BIOS updates are normally a nightmare to reverse. |
Be aware of the F1 key to continue, particularly when rebooting remote servers. |
Lights Out Management if it is available, utilize it. |
Think long and hard about implementing BIOS security. Can the same level of security be implemented elsewhere? Normally it can. |
Understand the limitations of BIOS date and time. Can system date and time be better maintained by other means? |
Introduction [ edit | edit source ]
The BIOS (Basic Input / Output System) can be thought of as a suite of small programs that operate between the operating system and the hardware on any given computer. It provides a number of services that enable the computer to boot any given operating system. The BIOS can also provide or present other services to the operating system depending on the operating system and / or the type of hardware installed. It is also wise to note that a modern-day computer may have multiple BIOS chips interfacing the various different hardware components that combine to build the whole computer. These include Disk Array Controllers, Graphic Cards, Sound Cards, and possibly a few others. Firstly let’s look at the services the BIOS provides regardless of which operating system is installed: these being the POST (Power On Self Test), Hardware Management, Security and Date & Time.
Intel and other manufacturers have developed another standard called EFI (Extensible Firmware Interface), which performs a similar function to BIOS, but does the job in a different manner. EFI is far more flexible and powerful than BIOS, but it has not enjoyed as much commercial success. Exploration of EFI is beyond the scope of this document for now.
POST — Power On Self Test [ edit | edit source ]
- The POST process involves a small diagnostic program that checks system hardware such as RAM or motherboard components. If a particular piece of hardware is present, a basic test is performed to check for faults. More advanced tests such as a long memory test may be performed, but normally these features need to be manually enabled in the BIOS.
- If the POST process finds errors it will usually sound beeps on the motherboard speaker and / or show some visual message via LEDs on the motherboard and / or messages on the screen. This is known as an «Irregular POST Condition».
- The number (and in some cases the pattern) of the beeps, lights, or messages will aid you in diagnosing the problem; however, different motherboard models (even those from the same manufacturer) have different implementations of these signals, so it is always wise to have a printed reference manual for each model you support or internet access on another machine for a quick look-up.
Hardware Management [ edit | edit source ]
- During the POST process, the BIOS allows you great flexibility to customize certain aspects of the system via settings stored in CMOS (Complementary Metal Oxide Semiconductor) memory. CMOS memory is volatile memory, but your motherboard has a backup battery to preserve any customized system configurations that you have made. This battery will eventually die. If you find that your computer is not retaining BIOS settings from one power cycle to another, the usual reason is that you need to replace this battery.
- Useful BIOS settings often edited by users and system administrators may include:
- Boot device priority
- Enable / disable motherboard features like integrated video, LAN, or sound
- Setting preferred memory addresses or IRQ vectors for PCI (or older) cards
- On older motherboards these configurations were done by positioning certain jumpers or dip switches to the hardware manufacturer’s specifications. Modern CMOS menus have replaced nearly all of these devices, with the exception of setting SCSI ID or resetting a BIOS password. There are still some «old school» motherboards in operation, so always keep the possibility of jumpers in mind.
Security [ edit | edit source ]
- Most BIOSs allow the user to set a password. The computer will require this password to be input before completing the boot process. Often this BIOS password adds inconvenience without any real security: information on how to get around these passwords is freely available on the internet. If the user forgets this password, the computer will not proceed to load an operating system. It’s not hard to see why BIOS Passwords are rarely invoked at the business level.
- Many modern computers have the ability to detect configuration changes such as memory size changes and even if the case has been removed. The BIOS will often report these changes and prompt the user to press a key (usually the F1 key) to continue if this change is acceptable. Users may be required to hit another key to enter the BIOS configuration screens to change parameters depending on the particular BIOS manufacturer.
Date and Time [ edit | edit source ]
- Setting the time and date are options within any modern BIOS. This is a «real-time» clock that runs constantly, powered by the same battery that preserves the CMOS settings. It’s not very accurate, even compared to a wrist-watch, but it’s better to have this poor clock than to require users to enter the time manually at every reboot. (That’s how it was done in the early days of computers.)
- Linux (like other operating systems) maintains its own clock in software by counting interrupts generated by an oscillator circuit in your computer. This clock only functions while the operating system is running.
- The BIOS provides the date and time to the operating system upon booting. After the operating system has gathered this information, the BIOS clock and the Operating System clock continue to run independently. This means that the BIOS clock will soon differ from the operating system clock, even if it is only in milliseconds.
- Linux has a command called hwclock which can be used to synchronize the operating system clock with the BIOS. Once synchronized, they will drift apart again, however. (This is due to the Hardware nature of the BIOS clock and the Software nature of the OS clock.)
- Further on in the course, you will start to look at ntp and how important it is to maintain a consistent «Network Time». Knowing that the BIOS and operating system maintain separate clocks will aid you in setting out a solution.
- The BIOS does not handle time zone or daylight savings time adjustments. These are handled by the operating system. For this reason, some administrators may choose to set their BIOS clocks to UTC rather than the local time.
Disk Drives [ edit | edit source ]
Most computers use Hard Disk Drives to hold an operating system and users’ data. Some newer computers use Solid State Disk Drives instead. Though the physical devices vary greatly, there is little difference from the standpoint of configuring Linux or other operating systems.
Attachment Interfaces [ edit | edit source ]
Firstly let’s address the confusion that often comes around from disk drive terminology such as IDE/ATA (Integrated Drive Electronics / Advanced Technology Attachment) and SATA (Serial Advanced Technology Attachment) and indeed PATA (Parallel Advanced Technology Attachment), which all use the ATA (Advanced Technology Attachment) standard to communicate with the device. The first part of the acronym can be thought of simplistically as a revision. Take for instance the revisions IDE, Fast IDE, EIDE, etc. These revisions changed the physical cables or ribbons that connect the disk drives to the computer, which enabled certain features, e.g. to address more disk space or speed up communications with the device. SATA was like a rewrite, once SATA came into being it was decided that all historical ATA devices that predated SATA (IDE, etc.) were to be grouped under the terminology PATA.
SCSI is another popular attachment interface that has undergone several generations of revision over the years: SCSI, SCSI-2, SCSI-3, U160, U320, and SAS. Click on the link at the head of this paragraph for more details, if desired. The SCSI family of attachment interfaces is not hardware-compatible with the ATA family, nor do they use the same software command set, so you cannot mix SCSI drives with ATA controllers or ATA drives with SCSI controllers. Because they use different commands, Linux will enumerate them with different labels. This will be handled in more detail when it becomes important later.
A Brief History [ edit | edit source ]
To get an understanding of modern hard drives, it helps to have some background. The BIOS traditionally uses INT13h as an interface to the hard drive. INT13h, from a historical standpoint, had certain limitations. On the other hand, the IDE/ATA interfaces also had restrictions. These restrictions are highlighted in the table below.
Specification | Max Cylinders | Max heads | Max sectors | Max Size |
---|---|---|---|---|
IDE/ATA | 65,536 | 16 | 256 | 138GB |
INT13h | 1,024 | 256 | 63 | 528MB |
Clearly you can see that because of the limitations of INT13h and IDE/ATA (which we have highlighted) under the above scenario, the largest drive your average computer could handle was 528MB. We call this specification CHS (cylinder-head-sector). You may recall that to calculate the total size of a hard drive use the following formula:
- Cylinders * Heads * Sectors * 512 = Capacity
To get around this a new specification was implemented called ECHS (extended cylinder-head-sector), sometimes also referred to as «Large Mode». This introduced a translation layer between the BIOS and INT13h. The translation layer then allowed a computer to handle disk drives up to 8.4GB in size. We can see this with a modification to the table above, which we have set out below and highlighted the relevant row.
Specification | Max Cylinders | Max heads | Max sectors | Max Size |
---|---|---|---|---|
IDE/ATA | 65,536 | 16 | 256 | 138GB |
ECHS | 620 | 128 | 63 | 2.5GB |
INT13h | 1,024 | 256 | 63 | 8.4GB |
To see how the translation works, let’s take a 2.5GB hard drive with 4960 cylinders, 16 heads, and 63 sectors. The translation program looks at the number of cylinders and makes a «best fit» with the INT13h limitation of 1,024 cylinders. The translation program does this by division, normally. It divides the number of cylinders by one of the following numbers: 2,4,6,8 and in some cases 16. In our case, 4960 / 8 = 620, which does not break the limitation of INT13h. Now the translation program multiplies the number of heads by 8, so 16 * 8 = 128. In this way, the translation program maintains the INT13h standard and provides a way in which the computer can see the whole disk. We can see this by calculating the disk space at both points previous translation and after.
- Native 4960 * 16 * 63 * 512 = 2.5GB
- Translation 620 * 128 * 63 * 512 = 2.5GB
The Table above needs a little more clarification. You will note that the maximum number of heads for the ECHS (translation layer) is 128, which is incompatible with the IDE/ATA Layer, which specifies a limit of 16. We get away with this because the translation layer is only concerned with INT13h and is not in any way related to the IDE/ATA layer. The next table will show how this model really looks.
Specification | Max Cylinders | Max heads | Max sectors | Max Size |
---|---|---|---|---|
Physical Drive | 4,660 | 16 | 63 | 2.5GB |
IDE/ATA | 65,536 | 16 | 256 | 138GB |
INT13h | 1,024 | 256 | 63 | 8.4GB |
ECHS | 620 | 128 | 63 | 2.5GB |
Needless to say, hard drives got a lot bigger than 8.4GB, so some other way was needed, as the cylinder-head-sector method was no longer a viable option. This is covered in the next section where we bring you right up to date.
LBA [ edit | edit source ]
LBA (Logical Block Addressing) is the most common scheme in use today to get past the 528MB limit imposed on an IDE/ATA disk drive. With LBA each block has a unique identification number that starts at 0 and then 1,2,3,4,5. In order for this mechanism to work it must be supported by the BIOS, the operating system, and the IDE drive. A common misconception with LBA is that it is the LBA itself that gets around the 528MB limit when in fact LBA uses translation. When you enable LBA mode in a BIOS you are in effect enabling translation. The translation can be the same as ECHS as discussed above, or another algorithm can be used by a 3rd party. It is way beyond the scope of this course to look at these algorithms. But the point of 3rd party algorithms should be made. More and more with modern operating systems the BIOS is taking a back seat when «talking» to the drive, and modern operating systems now perform this function with their own interpretation of the ATA specification preferring to bypass the BIOS altogether.
IRQ [ edit | edit source ]
There are 16 IRQs (Interupt ReQuest) channels on x86 architecture. Of those only a few are freely available. The table below lists the IRQs that cannot be used in red and the IRQs that could be reassigned (providing that certain hardware does not exist in your system) in orange, and those that you are free to assign as you please in white.
IRQ No. | Hardware Assignment | IRQ No. | Hardware Assignment | IRQ No. | Hardware Assignment | IRQ No. | Hardware Assignment |
---|---|---|---|---|---|---|---|
0 | System timer | 4 | COM1 | 8 | Real Time Clock | 12 | PS2 Mouse |
1 | Keyboard | 5 | LPT2 / Sound Card | 9 | Available | 13 | Floating Point Proc |
2 | Handles IRQ 8 — 15 | 6 | Floppy Controller | 10 | Available | 14 | Primary IDE |
3 | COM2 | 7 | Parallel Port | 11 | Available | 15 | Secondary IDE |
In essence IRQs are used to halt the computer from processing any further information and immediately service the request from the interrupt. That being the device that is assigned to the interrupt. The table above explains what the IRQ architecture looked like under PIC (Programmable Interrupt Controller), however it does hide the issue of priorities. The priorities of the IRQ structure are given by 0-1-2-8-9-10-11-12-13-14-15-3-4-5-6-7. The reason 8-15 have a higher priority is that they hook into IRQ 2, in fact IRQ 2 can be said to be IRQ 9. What we have looked at here is somewhat historical. Under the above scenario adding new hardware quickly became an art and a pain! The advent of PCI and USB enabled a greater range of addresses and also the ability to just plug things in and go.
DMA [ edit | edit source ]
DMA (Direct Memory Access) is a feature of the modern computer to enable devices to bypass the CPU when needing to write or read information to or from another device, the purpose of this is to take the load off the CPU and utilize the DMA controller and RAM to move blocks of data from one area to another. Although the CPU is never completely eliminated in a DMA transfer, its role is purely to initiate the process rather than manage it.
I/O [ edit | edit source ]
I/O (Input / Output) refers to moving data among all devices, both external and internal, within a modern computer system. Some devices can perform both input and output functions. An example of this is a Network Card. Obviously keyboards, mouse, etc. are examples of input devices and monitors and printers are examples of output devices.
Putting it all together [ edit | edit source ]
When you turn the PC on, BIOS instructions are loaded into RAM from a permanently available ROM chip on the motherboard. These instructions, after performing a POST, may further inform the processor where the operating system is located and how to load it into RAM. In order to allow operating systems and applications to run on a PC, the BIOS provides a standard layer of services that the operating system can use to «talk» to the hardware. In turn, the operating system provides standard services to applications to perform their functions. It is important to understand that not all operating systems use all BIOS services: some use their own instructions to access the hardware. The direct method of accessing the hardware may improve performance.
The BIOS utilizes a number of technologies to perform the services we have addressed above. However, as with all things in the computer industry, technology is moving forward fast. The BIOS performs a crucial role within the system and new technology added to the motherboard will normally require BIOS cooperation so that the OS can utilize the new technology.
By now you should have a good understanding of the BIOS and the role it performs with hardware. In the next section we look at Linux and how it interacts with the BIOS / Hardware. This will hopefully give you a system administrator’s view of these relationships.
Viewing BIOS-related information in Linux [ edit | edit source ]
Introduction [ edit | edit source ]
From this point onward it becomes necessary to have access to a Linux PC. Although some theory is involved, we shall be interacting with Linux more and more. I advise that you attempt the commands as you come across them, testing your understanding as you go. Do be careful with some of the commands as an incorrect switch, or in some cases running a command from the wrong directory is not healthy. (One famous example is running rm -R * from / as root.) So if you are new to Linux, be careful: don’t misuse the root account. Only use it when you have to. I personally advise a separate Linux installation for the course that contains no personal data.
Understand that No author / contributor to this book is in any way responsible for any loss of data or damage to any hardware, however it is caused. Mistakes in typing can happen and this is an open book for anyone to edit regardless of their knowledge.
/proc [ edit | edit source ]
/proc is a pseudo-filesystem which is used as an interface to kernel data structures. Most of it is read-only, but some files allow kernel variables to be changed, particularly in /proc/sys. if you were to list the file system in /proc you would see something like this:
The first thing that you will notice is the numbered directories these represent processes running on your system. Each numbered directory, has a common subset of directories that provide information about that process. The number representing the directory is consistent with the process number seen with the ps command. We cover processes in a later section.
The directories and files we are interested in are the following:
Getting kernel information [ edit | edit source ]
/proc is a pseudo-filesystem which is used as an interface to kernel data structures. Most of it is read-only, but some files allow kernel variables to be changed.
Examples of available directories are:
/proc/acpi [ edit | edit source ]
acpi is the interface to monitor events and states.
Getting hard drive Information [ edit | edit source ]
In order to get disk information, use hdparm. More information is available at the hdparm man page
Источник