21

I found information that nvram is used for BIOS flashing/backup and that it contains some bios related data. Would cat /dev/random > /dev/nvram permanently brick computer? I'm quite tempted to type this command but somehow I feel it's not gonna end up well for my machine so I guess I'd like to know how dangerous is playing with this device.

2
  • 8
    Why on earth would you be tempted to run that command? It's not like there's anything to be gained from it...If it was a a risk vs reward decision then I could maybe understand but what's the reward?
    – Andy
    Dec 20, 2016 at 10:45
  • 11
    Knowledge is its own reward Dec 20, 2016 at 15:12

3 Answers 3

22

I'm curious as to exactly why you'd want to run such a command if you think it might damage your computer...

/dev/nvram provides access to the non-volatile memory in the real-time clock on PCs and Ataris. On PCs this is usually known as CMOS memory and stores the BIOS configuration options; you can see the information stored there by looking at /proc/driver/nvram:

Checksum status: valid
# floppies     : 4
Floppy 0 type  : none
Floppy 1 type  : none
HD 0 type      : ff
HD 1 type      : ff
HD type 48 data: 65471/255/255 C/H/S, precomp 65535, lz 65279
HD type 49 data: 3198/255/0 C/H/S, precomp 0, lz 0
DOS base memory: 630 kB
Extended memory: 65535 kB (configured), 65535 kB (tested)
Gfx adapter    : monochrome
FPU            : installed

All this is handled by the nvram kernel module, which takes care of checksums etc. Most of the information here is only present for historical reasons, and reflects the limitations of old operating systems: the computer I ran this on doesn't have four floppy drives, the hard drive information is incorrect, as is the memory information and display adapter information.

I haven't tried writing random values to the device, but I suspect it wouldn't brick your system: at worst, you should be able to recover by clearing the CMOS (there's usually a button or jumper to do that on your motherboard). But I wouldn't try it!

The only useful features in the CMOS memory nowadays are RTC-related. In particular, nvram-wakeup can program the CMOS alarm to switch your computer on at a specific time. (So that would be one reason to write to /dev/nvram.)

9
  • So, one could potentially (with knowledge of the meanings of the data in this specific environment) create a "BIOS screen" that one could sudo into from the comfort of one's terminal?
    – wizzwizz4
    Dec 19, 2016 at 19:36
  • @wizzwizz4 yes that is quite possible. In fact, some proprietary Windows-only software provided by laptop manufacturers do just that, and I would suspect they use this same interface. Dec 19, 2016 at 20:25
  • 1
    @wizzwizz4 Only for certain very specific (and mostly useless, nowadays) settings. Most BIOS settings are not available through this interface.
    – user130738
    Dec 19, 2016 at 20:54
  • 1
    @AndréBorie I have said laptop with said software, which does not run on any open OS that I could find (not even Debian GNU/Linux with wine!); hopefully I'll be able to reverse-engineer the format (and perhaps share it, if I do it well enough).
    – wizzwizz4
    Dec 19, 2016 at 21:00
  • @duskwuff Are you referring to /proc/driver/nvram or /dev/nvram?
    – wizzwizz4
    Dec 19, 2016 at 21:01
15

It probably could but it depends on your BIOS. See this related problem with EFI configuration where a laptop was bricked by clearing EFI variables. If some BIOS can't handle cleared variables, it's likely that some might not handle random garbage in nvram any better.

At the very least, before you try this, see if there's a nvram reset procedure for your specific hardware. Usually something like removing the backup battery from the motherboard for a while.

1
  • 13
    If this had been asked a quarter of a century ago, the reflexive advice would have been "Before you try this, go into the firmware setup program and write all of the settings down!" It wasn't fun losing the disc type and geometry information.
    – JdeBP
    Dec 19, 2016 at 15:18
11

It would probably be fixable either because the firmware will notice it fails checksum and reset it (on the next boot), or alternatively by pulling the CMOS battery and/or using a CMOS clear jumper. Of course, buggy firmware may decide otherwise.

I personally would not recommend trying it. Just as I'd not recommend you test a GFI outlet by sticking a fork in it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .