Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Removed /dev by mistake
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
destroyedlolo
l33t
l33t


Joined: 17 Jun 2011
Posts: 846
Location: Close to Annecy (France)

PostPosted: Wed Dec 30, 2020 10:59 pm    Post subject: Removed /dev by mistake Reply with quote

Hello,

I did a stupid mistake : I removed /dev content.
Is a way to rebuild it ?

The system is still up and running.

Any idea ?
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Wed Dec 30, 2020 11:24 pm    Post subject: Reply with quote

Udev? Reboot. Udev should rebuild it.
Back to top
View user's profile Send private message
destroyedlolo
l33t
l33t


Joined: 17 Jun 2011
Posts: 846
Location: Close to Annecy (France)

PostPosted: Wed Dec 30, 2020 11:36 pm    Post subject: Reply with quote

ok, thanks : will do it tomorrow 8O
Back to top
View user's profile Send private message
Buffoon
Veteran
Veteran


Joined: 17 Jun 2015
Posts: 1369
Location: EU or US

PostPosted: Wed Dec 30, 2020 11:47 pm    Post subject: Reply with quote

Not so fast, I recall two nodes there being static. I may be wrong, but you better check on that.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 21715

PostPosted: Thu Dec 31, 2020 12:10 am    Post subject: Reply with quote

If /dev is a mountpoint for devtmpfs, which is the usual configuration, then rebooting should be fine. The only time there would be static nodes of importance is in a statically maintained /dev, in which case the entire directory is the responsibility of the administrator.
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Thu Dec 31, 2020 1:22 am    Post subject: Reply with quote

Code:
$ mount|grep devtmpfs
devtmpfs on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=4104086,mode=755)

destroyedlolo, does that command look like that on your system?

How about
Code:
 $ grep devtmpfs /etc/mtab
devtmpfs /dev devtmpfs rw,nosuid,relatime,size=10240k,nr_inodes=4104086,mode=755 0 0


BTW, I don't have that explicitly in my /etc/fstab, so it must come from either the kernel or udev.
Code:
 $ zgrep DEVTMPFS /proc/config.gz
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y

Okay, It's the kernel. So, unless you have a static /dev, rebooting will recreate it (Thanks, Hu!) and udev (or mdev) will populate it.
Back to top
View user's profile Send private message
APolozov
Apprentice
Apprentice


Joined: 28 Sep 2006
Posts: 189
Location: Voronezh, Russia

PostPosted: Thu Dec 31, 2020 5:24 am    Post subject: Reply with quote

This two devices must be builded manually before rebooting:
Code:
sudo mknod -m 0666 /dev/null c 1 3
sudo mknod -m 0666 /dev/zero c 1 5

_________________
Excuse my bad English, I only study it.


Last edited by APolozov on Thu Dec 31, 2020 1:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
joanandk
Apprentice
Apprentice


Joined: 12 Feb 2017
Posts: 169

PostPosted: Thu Dec 31, 2020 7:55 am    Post subject: Reply with quote

APolozov wrote:
This two devices must be builded manually before rebooting:
Code:
sudo mknod -m 0666 /dev/null c 1 3
sudo mknod -m 0666 /dev/zerol c 1 5


Are you sure? I could not boot unless these were in /dev:
Quote:

dev/console
dev/null
dev/sda
dev/sda1
dev/sda2
dev/tty


With these nodes and modern Kernel with devtmpfs, the system should boot.

BR
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3925
Location: Hamburg

PostPosted: Thu Dec 31, 2020 10:12 am    Post subject: Reply with quote

APolozov wrote:
This two devices must be builded manually before rebooting:
Code:
sudo mknod -m 0666 /dev/null c 1 3
sudo mknod -m 0666 /dev/zerol c 1 5
/dev/zerol?
Back to top
View user's profile Send private message
destroyedlolo
l33t
l33t


Joined: 17 Jun 2011
Posts: 846
Location: Close to Annecy (France)

PostPosted: Thu Dec 31, 2020 10:47 am    Post subject: Reply with quote

Arg, as my last reading yesterday was "Only a reboot is enought", I shutdown the computer I was using to remote access : obviously now, I can't ssh or even login using the console as all ttys are gone.
So, rebooting ... (all my fingers crossed)

8O
Back to top
View user's profile Send private message
destroyedlolo
l33t
l33t


Joined: 17 Jun 2011
Posts: 846
Location: Close to Annecy (France)

PostPosted: Thu Dec 31, 2020 12:37 pm    Post subject: Reply with quote

It worked :wink:

Thanks for your tips :)
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Thu Dec 31, 2020 3:28 pm    Post subject: Reply with quote

Excerpt from /etc/mdev.conf
Code:
# null may already exist; therefore ownership has to be changed with command
null            root:root 666 @chmod 666 $MDEV
zero            root:root 666
full            root:root 666
random          root:root 444
urandom         root:root 444
hwrandom        root:root 444
grsec           root:root 660

kmem            root:root 640
mem             root:root 640
port            root:root 640
# console may already exist; therefore ownership has to be changed with command
console         root:tty 600 @chmod 600 $MDEV
ptmx            root:tty 666

So busybox should have created them on boot. I see mine are dated yesterday afternoon and I'm sure I didn't do it by hand.

Are you by any chance using systemd?
Back to top
View user's profile Send private message
destroyedlolo
l33t
l33t


Joined: 17 Jun 2011
Posts: 846
Location: Close to Annecy (France)

PostPosted: Thu Dec 31, 2020 4:05 pm    Post subject: Reply with quote

No no, I'm using rc scripts.

Creation dates are fake as created before the system time has been updated by NTP.
Code:
ls -l /dev/null /dev/full
crw-rw-rw- 1 root root 1, 7  1 janv.  2010 /dev/full
crw-rw-rw- 1 root root 1, 3  1 janv.  2010 /dev/null
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Thu Dec 31, 2020 5:43 pm    Post subject: Reply with quote

I don't understand it. I don't have to manually create anything on my system.

Sorry I gave you a problem.

EDIT:
Code:
~ $ rc-update|grep mdev
                 mdev |                                        sysinit
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum