View previous topic :: View next topic |
Author |
Message |
destroyedlolo l33t
Joined: 17 Jun 2011 Posts: 846 Location: Close to Annecy (France)
|
Posted: Wed Dec 30, 2020 10:59 pm Post subject: Removed /dev by mistake |
|
|
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 |
|
|
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Wed Dec 30, 2020 11:24 pm Post subject: |
|
|
Udev? Reboot. Udev should rebuild it. |
|
Back to top |
|
|
destroyedlolo l33t
Joined: 17 Jun 2011 Posts: 846 Location: Close to Annecy (France)
|
Posted: Wed Dec 30, 2020 11:36 pm Post subject: |
|
|
ok, thanks : will do it tomorrow |
|
Back to top |
|
|
Buffoon Veteran
Joined: 17 Jun 2015 Posts: 1369 Location: EU or US
|
Posted: Wed Dec 30, 2020 11:47 pm Post subject: |
|
|
Not so fast, I recall two nodes there being static. I may be wrong, but you better check on that. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 21768
|
Posted: Thu Dec 31, 2020 12:10 am Post subject: |
|
|
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 |
|
|
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Thu Dec 31, 2020 1:22 am Post subject: |
|
|
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 |
|
|
APolozov Apprentice
Joined: 28 Sep 2006 Posts: 189 Location: Voronezh, Russia
|
Posted: Thu Dec 31, 2020 5:24 am Post subject: |
|
|
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 |
|
|
joanandk Apprentice
Joined: 12 Feb 2017 Posts: 169
|
Posted: Thu Dec 31, 2020 7:55 am Post subject: |
|
|
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 |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3925 Location: Hamburg
|
Posted: Thu Dec 31, 2020 10:12 am Post subject: |
|
|
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 |
|
|
destroyedlolo l33t
Joined: 17 Jun 2011 Posts: 846 Location: Close to Annecy (France)
|
Posted: Thu Dec 31, 2020 10:47 am Post subject: |
|
|
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)
|
|
Back to top |
|
|
destroyedlolo l33t
Joined: 17 Jun 2011 Posts: 846 Location: Close to Annecy (France)
|
Posted: Thu Dec 31, 2020 12:37 pm Post subject: |
|
|
It worked
Thanks for your tips |
|
Back to top |
|
|
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Thu Dec 31, 2020 3:28 pm Post subject: |
|
|
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 |
|
|
destroyedlolo l33t
Joined: 17 Jun 2011 Posts: 846 Location: Close to Annecy (France)
|
Posted: Thu Dec 31, 2020 4:05 pm Post subject: |
|
|
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 |
|
|
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Thu Dec 31, 2020 5:43 pm Post subject: |
|
|
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 |
|
|
|