# Can't boot, /dev/ mostly empty, and no sys-fs/udev

## jasonstjohn

Hello, List.

I am looking at one very sad hp Compaq nc6400, which only this morning was home to a system built up from LiveCD 2008.0-r1 i686.  Yesterday I tooled around trying to address some blocked packages, and unmerged more than I should have. Clearly I was wrong to think that I can put it all back the way it was, because rebooting is now a tedious process with a repeated, failing attempt to do... somthing:

 *Quote:*   

>  ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2 frozen
> 
>  ata1.00: cmd a0/00:00:00:24:00/00:00:00:00:00:00/a0 tag 0 pio 36 frozen
> 
>               cdb 12 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00
> ...

 ///....etc

....which repeats again with PIO0 after the message "limiting speed to PIO0" and eventually

 *Quote:*   

>  ata1: WARNING: synchronous SCSI scan failed without making any progress, switching to async

 

... and then we begin to make some headway, load some modules, activate mdev, mount root, and begin booting (intramfs)

 *Quote:*   

>  INIT: version 2.86 booting

 

which looks very normal to me, but only gets off these two successful mounts: 

 *Quote:*   

> proc at /proc
> 
> sysfs at /sys

 

and then 

 *Quote:*   

>  * The Gentoo Linux system initialization scripts have detected that
> 
>  * your sytem does not support UDEV. Since Gentoo Linux has been 
> 
>  * designed with dynamic /dev in mind, it is highly suggested that you 
> ...

 

Then we wrap up bymounting devpts at /dev, and fail when checking the filesystem:

 *Quote:*   

>  fsck.ext3 No such file or directory while trying to open/dev/sda3

 

 *Quote:*   

> (none) ~ # cat /etc/fstab
> 
> /dev/sda1  /boot  ext2  defaults      12
> 
> /dev/sda2  none           swap     sw        00
> ...

 

I'm able to log in as root, then, and sure enough, /dev is nearly empty: console, null, pts, shm, and tty1 are the only things there. The entire filesystem seems to be read only, so I cannot emerge anything, and cannot ssh from the machine. 

I have never worked at this level in my system before. I  think I would desperately try just about any suggestion which seems even halfway promising!

Cheers,

_jmsj

----------

## cach0rr0

ouch

You might snag the udev binaries from here (for amd64) http://tinderbox.dev.gentoo.org/default-linux/amd64/sys-fs/

or here for x86 http://tinderbox.dev.gentoo.org/default-linux/x86/sys-fs/

If that's all it is, that might patch you back together. 

I'm betting you unmerged e2fsprogs as well - might snag those binaries too

Now this is all for naught if you don't have physical access - do you have physical access? If so, boot from a CD or thumb drive (and do NOT use the 2008-r1 .iso, as it's both deprecated and garbage), mount per the handbook, and chroot. You may be able to re-emerge the stuff that's gone, depending upon how much stuff you lost. 

...of course if you only installed this yesterday, haven't done heaps of customization, and don't have any data on there you care about recovering, let's just rebuild the sucker. In fact you can boot from rescuecd, mount, and copy the stuff off to a backup drive 

One way or another though, youll want to boot from a CD or thumb drive, nothing you can do from the console itself when booted from that mangled an install (well, not without more pain than itd be to install in the first place)

ALSO: if  youre worried about having to recompile packages, you can use quickpkg to bundle the things up and move em off to a safe spot

----------

## jasonstjohn

Thanks, cach0rr0.  This install's about half a year old; I'll try to patch it back together before

I fall back on the backup records and a fresh install.

Booting with a handy LiveCD, I can 

 *Quote:*   

> gentoo@livecd ~ $ sudo mount --verbose -t ext3 /dev/sda3 /mount
> 
> /dev/sda3 on /mount type ext3 (rw)

 

so that at least I'm able to write to the old filesystem again.  But what I don't know is how to have emerge pretend this is the / directory.  (I think if I knew how, I would unpack and install it myself.)

I checked what is there already:

 *Quote:*   

> gentoo@livecd ~ $ ls -l /mount/usr/portage/sys-fs/udev
> 
> total 248
> 
> -rw-r--r-- 1 root root 98780 Aug 15 22:37 ChangeLog
> ...

 

and, while I don't know much about what should be where upon completing a package installation correctly, it's clear that udev isn't available to run, nevertheless:

 *Quote:*   

> gentoo@livecd ~ $ ls /mount/usr/bin/ | grep dev
> 
> devdump
> 
> devnag
> ...

 

So for the moment, I'm thinking about how to get around this:

 *Quote:*   

> gentoo@livecd ~ $ sudo emerge --verbose /mount/usr/portage/sys-fs/udev/udev-141-r1.ebuild 
> 
> *** emerging by path is broken and may not always work!!!
> 
> These are the packages that would be merged, in order:
> ...

 

Ideas?

Cheers,

_jmsj

----------

## Simba7

 *jasonstjohn wrote:*   

>  *Quote:*   gentoo@livecd ~ $ sudo emerge --verbose /mount/usr/portage/sys-fs/udev/udev-141-r1.ebuild 
> 
> *** emerging by path is broken and may not always work!!!
> 
> These are the packages that would be merged, in order:
> ...

 

You definitely are a noob..  :Very Happy: 

Enter this:

sudo emerge =sys-fs/udev-141-r1

I would suggest going in as root, though. If you do, get rid of sudo.

----------

## jasonstjohn

 :Smile:  In some way, isn't each of us a noob?

Booting from the LiveCD, I get to be the user gentoo, but cannot become root:

 *Quote:*   

> gentoo@livecd ~ $ su -     
> 
> Password: 
> 
> su: Authentication failure
> ...

 

Booting from the harddrive with the sick installation, I get to be root, but emerge can't do its business so long as /dev/sda3 is mounted read-only. 

So, I can work at a lower level, I can try with ebuild:

 *Quote:*   

> 
> 
> gentoo@livecd ~ $ sudo ebuild /mount/usr/portage/sys-fs/udev/udev-141-r1.ebuild setup
> 
> Appending /mount/usr/portage to PORTDIR_OVERLAY...
> ...

 

...and I'll stop right there because, although 'compile' and 'install' can complete without strong complaints,

they only seem to address /var/tmp, whereas for me, with everything important starting at /mount rather than the / directory, this is not going to last through a boot, I don't think.  I'll unmount my /mount and try a reboot... Back in a sec.

----------

## jasonstjohn

Just before rebooting, since I'd noticed that ebuild compiles to /var/tmp/portage/sys-fs/udev, I mv'd everything there to the corresponding location on the harddrive.... 

...and in fact, I booted off the harddrive, was chastened for not having udev installed, fell back being root but unable to see /dev/sda3 (the same old rigamarole), and out of curiosity checked what I could see in the harddrive at /var/tmp/portage/sys-fs/udev/.  It's all there, just where I would want it to be, if I were a system running udev.

What in the world else needs to be done for udev to run on this drive? The ebuild man pages make me think it's qmerging I've omitted.  Sure enough, here's where it becomes a problem that the drive I want to install onto is mounted at /mount, whereas I can't (yet) persuade ebuild that it should start all paths there: *Quote:*   

> 
> 
> gentoo@livecd ~ $ sudo ebuild /mount/usr/portage/sys-fs/udev/udev-141-r1.ebuild qmerge
> 
> Appending /mount/usr/portage to PORTDIR_OVERLAY...
> ...

 

Perhaps I could build a prison at /mount, and run it in there....

----------

## cach0rr0

the root pass on the livecd is autoscrambled IIRC

instead do

```
sudo su -
```

What you need to do is

-boor from the livecd

-do all of the mount steps it mentions

```

mount /dev/sda3 /mnt/gentoo

mount -t proc none /mnt/gentoo/proc

mount -o bind /dev /mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash

env-update

source /etc/profile

```

You should then have function /dev, as prepped by the livecd. This should allow you to emerge what you need to get things back to operational. 

You're basically mounting the livecd's /dev on /mnt/gentoo/dev

which when you chroot simply becomes /dev relative to the chroot

anyway, try that

----------

## jasonstjohn

Sorry it took me so long to post back here.

The fix is in, udev is once again emerged, and this system is back to its old self.

 <: Thank you very, very much!

Cheers,

_jmsj

----------

## cach0rr0

glad to hear it. Please mark this one as [SOLVED] when you have a chance

----------

## jasonstjohn

Sure, happy to... but what do I do to mark it [SOLVED]?  This is some interface, I tell ya....

_jmsj

----------

