boot stops at "mountroot>"

FreeBSD 11.0 KDE x64

Worked fine yesterday, but now it boots to “mountroot>”.
Can someone please help me fix this?
 

Attachments

  • IMG_20170504_211617350.jpg
    IMG_20170504_211617350.jpg
    1.1 MB · Views: 782
The important line is: "Mounting from ups:/dev/ada0p2 failed with error ENODEV" (I took the liberty of translating error number 19 for you). That means there is no device called /dev/ada0p2.

Let's assume that you haven't messed around with editing /etc/fstab and screwed it up (did you?), the more likely explanation is that your disk has gone missing. So do this: use the page or scroll function on the console and read the boot messages above. You should see a place where your disks are discovered. Here is what it looks like on my machine:
Code:
ada3 at ata1 bus 0 scbus4 target 0 lun 0
ada3: <Hitachi HDS5C3030ALA630 MEAOAA10> ATA8-ACS SATA 3.x device
ada3: Serial Number MJ0351YNG9RZ6A
ada3: 300.000MB/s transfers (SATA 2.x, UDMA5, PIO 8192bytes)
ada3: 2861588MB (5860533168 512 byte sectors)
If you see something like that (with the correct prefix ada0 in front), then your hardware is fundamentally working; then perhaps your partition ada0p2 has been stomped on. In that case, find an alternate way to boot (rescue CD? USB stick?), run a rescue shell, and use tools like gpart to examine what has happened to your disk.

More likely you'll find that your whole disk drive is gone. This might be a good time to open your computer and check power and data cables. Also check boot-time messages from the BIOS (although some boot device must be present, to even load the kernel and get this far).
 
Have you changed anything hardware? Added a disk perhaps? By adding a disk it's possible the designations moved around. Hit '?' to see what it actually detected. If you haven't changed any hardware and nothing shows up with '?' you may need to open the case. As ralphbsz noted the disk isn't detected any more. This could be due to a hardware failure (broken disk) but it could also be as simple as a dodgy connection.
 
Thank you for replies.
Ok, it works normally when I unplug the other 2 drives (SATA).
What I wanted was a linux system on one drive, and a windows 10 on another drive and all 3 systems would be isolated, one from another and selected from BIOS instead of screwing with non-compatible boot loaders.
Any way to make this work?
 
(TL;DR: At the bottom are instructions on my suggestion for fixing it.)

Ah, what probably happens is that the disk numbering changes. Your FreeBSD root disk itself is present and happy, but when you plug the other two disks in, it isn't ada0p2 any more, it's probably ada1p2 or ada2p2. Same problem often occurs in Linux: When there is a single (SCSI or SATA) disk, it's /dev/sda; you plug in another disk or two, and it becomes /dev/sdb or /dev/sdc, and the boot loader can't find the root file system any longer. Oops. The stupidity here is obvious: Operating systems and file systems are dumb (I'm allowed to say that, I get my paycheck for developing such stuff, so I'm part of the problem). The traditional Unix way of mounting file systems is: Let some early hardware discovery enumerate the disks it finds (for example with ada0/ada1/ada2, ... or sda/sdb/sdc), and then write the hardware-dependent disk address into the /etc/fstab file; that information is guaranteed to become wrong when disks are moved.

(Side remark: You understand the way partitions are numbered? Partition ada0p2 is the 2nd partition on ada0; the Linux equivalent would be sda2. When the disk ada0 moves to for example ada1, then that partition moves with it to ada1p2.)

To understand the theory behind this, one also has to consider the boot loader. When the hardware comes up, the BIOS in the machine also enumerates all disk drives, and tries to load the OS from one of them. How did it manage to find the right one, if they had been renumbered due to plugging things in or out? Most likely, the BIOS stores (in non-volatile RAM) the hardware identity of the disk it boots from, and finds it even when other hardware is plugged in. If you want to have some fun and see the hardware identity of your boot disk, try camcontrol identify ada0; here's the output from one of my disks at home:
Code:
device model          Hitachi HDS5C3030ALA630
firmware revision     MEAOAA10
serial number         MJ0351YNG9RZ6A
WWN                   5000cca228c46d95
In particular the WWN (= world wide name) is a guaranteed unique identifier for this particular disk, guaranteed to not change during the life of the disk, and guaranteed to not be shared with any other disk on this planet (it contains encoded the manufacturer of the disk).

So how to fix this in theory? One option would be: In /etc/fstab, instead of the disk's (variable) device name ada0p2, store the hardware identity of the disk, for example "wwn=5000cca228c46d95/partition=2". Unfortunately, that is not implemented. Another suggestion would be: Tell the file system to write a descriptor on the disk itself, which is unique, and which says "boot me, I'm the root disk", and then modify the boot loader code to search all disks for this descriptor. Unfortunately, that solution is very complex, because the descriptor (like all data on disks) is unreliable, and we would need multiple copies, and code to deal with corrupted, damaged, out-of-date, and malicious copies, and would need to be able to recognize when some disks are missing. Very hard to do.

Fortunately, FreeBSD has a simpler version of this which works well enough for single-disk file systems. On modern disks, the partition table at the beginning of the disk (the thing that defines what and where the partition ada0p2 is) can also store explicit names for partitions, and then you can put that explicit name into /etc/fstab. All you need to do is this: Pick sensible but unique names for your file system partitions. For example, on my machine "house", they are called "house_root", "house_var", and so on. Then, to give partition ada0p2 the name "foo_root", you issue this command: gpart modify -i 2 -l foo_root ada0. After explicitly naming all your partitions, check with gpart show -l ada0 that the partition names match your expectations. Then you go and edit /etc/fstab, and replace the explicit partition device names (like ada0p2) with your explicit names. From now on, mounting them at boot time will work, even when the devices themselves move around.
 
Back
Top