# [SOLVED] you have crap in your /proc

## queen

During boot I get this message :

```
"You have crap in your /proc/; please clean it; see #291916"
```

I checked the web and found this:

http://sources.gentoo.org/cgi-bin/viewvc.cgi/baselayout/branches/baselayout-1_12/sbin/rc?sortby=rev&r1=3177&r2=3176&pathrev=3177

But it's not clear what I have to do. 

Any input will be welcome.Last edited by queen on Sun Dec 19, 2010 10:29 am; edited 1 time in total

----------

## Goverp

If I understand the referenced Gentoo bug 291916 correctly, your kernel uses an initrd/initramfs, and your init script is leaving some stuff in /proc; maybe it's not unmounting /proc before ending.  See the Gentoo wiki item on initramfs.

----------

## queen

 *Goverp wrote:*   

> If I understand the referenced Gentoo bug 291916 correctly, your kernel uses an initrd/initramfs, and your init script is leaving some stuff in /proc; maybe it's not unmounting /proc before ending.  See the Gentoo wiki item on initramfs.

 

Indeed I use initramfs in the kernel. Will pay more attention if it doesn't unmount /proc during close time. 

Checking now the link you gave me. Thanks.

----------

## queen

 *Goverp wrote:*   

> If I understand the referenced Gentoo bug 291916 correctly, your kernel uses an initrd/initramfs, and your init script is leaving some stuff in /proc; maybe it's not unmounting /proc before ending.  See the Gentoo wiki item on initramfs.

 

You are probably right, when I closed the laptop it only said "unmounting filesystems". There was no specification of which ones. 

Can you please check on your system if it says specifically for each fs?

----------

## Goverp

 *queen wrote:*   

> ...
> 
> Indeed I use initramfs in the kernel. Will pay more attention if it doesn't unmount /proc during close time. 
> 
> Checking now the link you gave me. Thanks.

 

Ah, no, it's not close time.  If you're using initramfs, you have two init stages; the first init runs with only the initramfs mounted, running an init script therein to mount your root file system (typically sorting out LVM or RAID or LKS); the second stage then switches root into your newly-mounted root file system and runs your "real" init script from your real root fs.

The first init script has to leave things nice and tidy so that baselayout can take over when you switch root. "clean" includes having nothing in the initramfs's /proc directory.  The first init script (inside the initramfs, remember) should end by unmounting /proc and /sys.  That should happen during boot.  The messages about "unmounting systems" at system close come from baselayout and the second init script in your real root fs, and that shouldn't be connected with your problem, it's much later.

----------

## queen

I am not sure what to do anymore. I reread bugzilla. They mention there to mask 1.12.3. I have 1.12.14-r1 and get this error. I can't rm directories in /proc. 

To downgrade baselayout to 1.12.11.1 as mentioned in one of the posts there? I don't see it in portage anymore. 

```

[I] sys-apps/baselayout

     Available versions:  [P]1.11.15-r3 1.12.13 ~1.12.14 1.12.14-r1 ~2.0.1 ~2.0.1-r1 {bootstrap build static unicode}

     Installed versions:  1.12.14-r1(03:26:11 PM 11/23/2010)(unicode -bootstrap -build -static)

```

2nd option is to disable initrd/initramfs in the kernel and add another boot option without the initrd?

I can't afford myself downtime of the laptop. 

I don't have  LVM or RAID or LKS.

The procedure in the wiki seems to be overkill. I don't want to mess with creating all these directories and then cp, especially when something can be easily forgotten. After all, it's a bug. It worked nicely without this procedure until now.

Currently grub.conf looks like this:

```

splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title Gentoo Linux

root (hd0,0)

kernel /boot/kernel-genkernel-x86-2.6.30-gentoo-r1 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/sda3 noapic

initrd /boot/initramfs-genkernel-x86-2.6.30-gentoo-r1
```

----------

## Goverp

I don't think you need anything so complicated.  IIUC, the problem is that the init script in your initramfs fails to unmount /proc before it issues the switch_root.  I think you need to unpack the initramfs and look at its contents.

----------

## percy_vere_uk

Hi

I am getting the following boot messages. Can someone please advise me as to what I should have in these two folders so that I can clean them:

"You have crap in your /proc"     "You have crap in your /sys"

percy

----------

## tomk

Merged previous post.

----------

## percy_vere_uk

Hi

I had already found this post and read through it 

I checked and found that I did have initramfs enabled in the kernel which I was not aware of. So I  looked in 'Initramfs.htm' and it told me "If you don't have advanced requirements, you do not need initramfs." So I disabled this, recompiled the kernel and copied it to /boot. Having since done a reboot I still get the same errors.

It does not look from this post that the problem was resolved so any more help would be appreciated.

percy

----------

## nativemad

I suppose you guys used genkernel to produce the kernel... genkernel also provides the initramfs...

The good news is that you can just leave it out, if you don't need it...

If you press e during the grub menu, you can edit the boot-options on the fly... delete the last initrd line by pressing d on it (if i remember right) and e again on the kernel line to edit it. To actually boot, press b (there is a description on the bottom about the keys).

The other option is to add a second section in grub.conf/menu.lst

```
title Gentoo Linux 

root (hd0,0) 

kernel /boot/kernel-genkernel-x86-2.6.30-gentoo-r1 root=/dev/sda3 noapic 

```

hth

----------

## percy_vere_uk

nativemad

In my case I do not use genkernel. But even with initramfs disabled in the kernel I am still getting these errors on boot.

percy

----------

## nativemad

Ok, then i would say that the error is right... you've got crap in /proc!   :Wink: 

It should be an empty directory on the disk... the stuff that is normally there comes from the kernel! The same thing for /sys.

```
mkdir /fakeroot4proc

mount -o bind / /fakeroot4proc

rm -rf /fakeroot4proc/proc/*

rm -rf /fakeroot4proc/sys/*

umount /fakeroot4proc

rm -rf /fakeroot4proc

```

----------

## percy_vere_uk

nativemad 

I have entered the code that you suggested and having rebooted I seem to have lost the boot 'crap in /sys  & /proc' errors.

/proc now shows 24,505 items, totalling 1016.1 MB  all modified today. 

/sys now shows 10380 items, totalling  286 MB all modified today.

percy

----------

## percy_vere_uk

nativemad 

I guess this is how these folders are supposed to be. Thanks for your help on this.

percy

----------

## queen

 *percy_vere_uk wrote:*   

> nativemad 
> 
> I have entered the code that you suggested and having rebooted I seem to have lost the boot 'crap in /sys  & /proc' errors.
> 
> /proc now shows 24,505 items, totalling 1016.1 MB  all modified today. 
> ...

 

percy,  can you please  send the output of this: 

```
 ls -l /proc |wc -l
```

In my case I have now 166 lines (nativemad suggestion deleted 5 lines). I didn't reboot yet. Will report tomorrow the results.Last edited by queen on Thu Dec 16, 2010 10:02 pm; edited 1 time in total

----------

## queen

 *nativemad wrote:*   

> I suppose you guys used genkernel to produce the kernel... genkernel also provides the initramfs...
> 
> The good news is that you can just leave it out, if you don't need it...
> 
> If you press e during the grub menu, you can edit the boot-options on the fly... delete the last initrd line by pressing d on it (if i remember right) and e again on the kernel line to edit it. To actually boot, press b (there is a description on the bottom about the keys).
> ...

 

Should it be root=/dev/sda3 or real_root=/dev/sda3 ?

I will try tomorrow to disable the line of initrd via editing grub.conf

----------

## nativemad

 *Quote:*   

> In my case I have now 166 lines (nativemad suggestion deleted 5 lines). I didn't reboot yet. Will report tomorrow the results.

 

Sorry, if my explanation wasn't that clear... 

As i said, these directories should be empty on the disk! They are getting populated during the boot from the Kernel... You can see that if you make an empty directory somewhere and just "mount -t proc none /newdirectory/some/where". It should contain exactly the same as the real /proc!  :Wink: 

The trick with the bind mount of the root partition is just to avoid an unnecessary boot from a livecd... ->a bind mount doesn't take third-party mounted device with it... So at lease these Kernel-devices aren't existent within the new bind-mounted-root and you can see the real content of the plain /proc directory of the rootfilesystem and of course also delete it!   :Razz: 

You would see the same content, if you would boot off a livecd and mount the disk.

Perhaps you've seen it the other way around... if you have a seperate partition for /home for example, you still need the directory itself within the root-partition... If you unmount /home, you could then place something (a pseudo-hidden-file) within that /home folder of the root... If you then remount the /home partition, you'll not see the pseudo-hidden-file! Now, do a bind-mount and you'll see it again!   :Razz: 

...I suppose the proc-mount doesn't hide the existing entries of the mount-target like other common fs-types do, as you could see that there was something removed with `ls | wc`!   :Wink: 

 *Quote:*   

> Should it be root=/dev/sda3 or real_root=/dev/sda3 ? 

 

real_root is an option that is needed by the genkernel-initramfs. So without that, its just root=/dev/blabla

----------

## percy_vere_uk

queen

I did not use genkernel.

```
# ls -l /proc |wc -l

175

```

On the laptop I am using I have two other linux systems ubuntu & mint. I have checked and they both show  roughly the same number of files when in /proc & /sys when booted. All three including gentoo show these to be empty when shut down!   

percy

----------

## queen

nativemad

Thanks a lot for the explanation.

1.  What worried me is that few days ago I had 165 lines, yesterday I had 171 lines (files, directories). Actually growing. I was afraid this will grow every time. After your suggestion, it indeed cleaned the crap. 

2. Today I booted again and I don't get anymore the error "you have crap in your /proc". So your trick worked very nice, and thanks for that   :Very Happy: 

3. The removal of the initrd in grub.conf doesn't work. If I want to remove that line, I will have to disable the option in the kernel. Maybe I will do it when I have time. 

4. What worries me, is that this error will start to appear once again.

----------

## nativemad

 *Quote:*   

> Thanks a lot for the explanation. 

  You're welcome.

 *Quote:*   

> 3. The removal of the initrd in grub.conf doesn't work. If I want to remove that line, I will have to disable the option in the kernel. Maybe I will do it when I have time. 

  The Kernel option is just for the support of an initrd... you don't need to disable it, if you don't use it!   :Wink: 

You could try to play around within the grub-menu directly, as i explained in my first post here... that will save you from another reboot, as you don't have to edit grub.conf directly! 

 *Quote:*   

> 
> 
> 4. What worries me, is that this error will start to appear once again.

  I don't think that this will happen again, as we all would become a victim of that behavior!   :Shocked: 

I suppose that happened during the install phase!? Probably the install got copied around without unmounting proc first or such a thing (That could even happened years ago, and nowadays the init script has a check for it!? -i've never seen the message, but could swear that i also copied proc some time ago....  :Wink:  )

----------

## queen

 *nativemad wrote:*   

> 
> 
>  *Quote:*   3. The removal of the initrd in grub.conf doesn't work. If I want to remove that line, I will have to disable the option in the kernel. Maybe I will do it when I have time.   The Kernel option is just for the support of an initrd... you don't need to disable it, if you don't use it!  
> 
> You could try to play around within the grub-menu directly, as i explained in my first post here... that will save you from another reboot, as you don't have to edit grub.conf directly! 
> ...

 

Maybe they added a check for that recently. I started to see this message few weeks ago. 

On a 2nd thought, there was a similar bug  but from 2009. 

https://bugs.gentoo.org/show_bug.cgi?id=291916

Anyway, it's time to flag this thread as solved.  :Wink: 

----------

