我删除了/etc/rc0.d
,但/etc/rc1.d
我不知道我丢失了什么。我知道这是我的自动启动脚本所在的位置。有没有办法找回这些目录?此外,似乎还有 4 个左右的etc/rc?.d
目录剩余。这些目录有备份吗?我的系统还能继续运行吗?
更新:我重启了系统,现在它无法加载紫色的 Ubuntu 屏幕。我使用的是 Ubuntu 12.04。
答案1
数字与级别有关,以前只有 3 级以上才有 GUI,较低级别加载的内容较少。现在,似乎已基本放弃这一做法,至少在 Ubuntu 中是如此。因此,其中一些是重复的。您可以使用“init”命令切换级别,然后是级别,例如init 3
运行 rc3.d 中的脚本。 init 0
关闭并init 6
重新启动。
如果我有任何链接在您的 init.d 目录中没有脚本,那么它们可能可以被安全地省略。
以下是我的所有目录:
$ ll rc*.d
rc0.d:
total 20
drwxr-xr-x 2 root root 4096 May 16 09:15 ./
drwxr-xr-x 131 root root 12288 Jun 10 21:59 ../
lrwxrwxrwx 1 root root 29 May 16 08:46 K10unattended-upgrades -> ../init.d/unattended-upgrades*
lrwxrwxrwx 1 root root 27 May 16 08:46 K20speech-dispatcher -> ../init.d/speech-dispatcher*
lrwxrwxrwx 1 root root 32 May 16 09:15 K20virtualbox-guest-utils -> ../init.d/virtualbox-guest-utils*
lrwxrwxrwx 1 root root 25 May 16 09:12 K65vboxadd-service -> ../init.d/vboxadd-service*
lrwxrwxrwx 1 root root 17 May 16 09:09 K70vboxadd -> ../init.d/vboxadd*
lrwxrwxrwx 1 root root 21 May 16 09:12 K70vboxadd-x11 -> ../init.d/vboxadd-x11*
-rw-r--r-- 1 root root 353 Apr 14 02:26 README
lrwxrwxrwx 1 root root 18 May 16 08:46 S20sendsigs -> ../init.d/sendsigs*
lrwxrwxrwx 1 root root 17 May 16 08:46 S30urandom -> ../init.d/urandom*
lrwxrwxrwx 1 root root 22 May 16 08:46 S31umountnfs.sh -> ../init.d/umountnfs.sh*
lrwxrwxrwx 1 root root 20 May 16 08:46 S35networking -> ../init.d/networking*
lrwxrwxrwx 1 root root 18 May 16 08:46 S40umountfs -> ../init.d/umountfs*
lrwxrwxrwx 1 root root 20 May 16 08:46 S60umountroot -> ../init.d/umountroot*
lrwxrwxrwx 1 root root 14 May 16 08:46 S90halt -> ../init.d/halt*
rc1.d:
total 20
drwxr-xr-x 2 root root 4096 May 16 09:15 ./
drwxr-xr-x 131 root root 12288 Jun 10 21:59 ../
lrwxrwxrwx 1 root root 20 May 16 08:46 K15pulseaudio -> ../init.d/pulseaudio*
lrwxrwxrwx 1 root root 22 May 16 08:46 K20acpi-support -> ../init.d/acpi-support*
lrwxrwxrwx 1 root root 20 May 16 08:46 K20kerneloops -> ../init.d/kerneloops*
lrwxrwxrwx 1 root root 15 May 16 08:46 K20saned -> ../init.d/saned*
lrwxrwxrwx 1 root root 27 May 16 08:46 K20speech-dispatcher -> ../init.d/speech-dispatcher*
lrwxrwxrwx 1 root root 32 May 16 09:15 K20virtualbox-guest-utils -> ../init.d/virtualbox-guest-utils*
lrwxrwxrwx 1 root root 25 May 16 09:12 K65vboxadd-service -> ../init.d/vboxadd-service*
lrwxrwxrwx 1 root root 17 May 16 09:09 K70vboxadd -> ../init.d/vboxadd*
lrwxrwxrwx 1 root root 21 May 16 09:12 K70vboxadd-x11 -> ../init.d/vboxadd-x11*
-rw-r--r-- 1 root root 369 Apr 14 02:26 README
lrwxrwxrwx 1 root root 19 May 16 08:46 S30killprocs -> ../init.d/killprocs*
lrwxrwxrwx 1 root root 19 May 16 08:46 S70dns-clean -> ../init.d/dns-clean*
lrwxrwxrwx 1 root root 18 May 16 08:46 S70pppd-dns -> ../init.d/pppd-dns*
lrwxrwxrwx 1 root root 16 May 16 08:46 S90single -> ../init.d/single*
rc2.d:
total 20
drwxr-xr-x 2 root root 4096 May 22 14:27 ./
drwxr-xr-x 131 root root 12288 Jun 10 21:59 ../
-rw-r--r-- 1 root root 677 Apr 14 02:26 README
lrwxrwxrwx 1 root root 20 May 16 08:46 S20kerneloops -> ../init.d/kerneloops*
lrwxrwxrwx 1 root root 27 May 16 08:46 S20speech-dispatcher -> ../init.d/speech-dispatcher*
lrwxrwxrwx 1 root root 32 May 16 09:15 S20virtualbox-guest-utils -> ../init.d/virtualbox-guest-utils*
lrwxrwxrwx 1 root root 17 May 16 09:09 S30vboxadd -> ../init.d/vboxadd*
lrwxrwxrwx 1 root root 21 May 16 09:12 S30vboxadd-x11 -> ../init.d/vboxadd-x11*
lrwxrwxrwx 1 root root 25 May 16 09:12 S35vboxadd-service -> ../init.d/vboxadd-service*
lrwxrwxrwx 1 root root 20 May 16 08:46 S50pulseaudio -> ../init.d/pulseaudio*
lrwxrwxrwx 1 root root 15 May 16 08:46 S50rsync -> ../init.d/rsync*
lrwxrwxrwx 1 root root 15 May 16 08:46 S50saned -> ../init.d/saned*
lrwxrwxrwx 1 root root 19 May 16 08:46 S70dns-clean -> ../init.d/dns-clean*
lrwxrwxrwx 1 root root 18 May 16 08:46 S70pppd-dns -> ../init.d/pppd-dns*
lrwxrwxrwx 1 root root 14 May 22 14:27 S75sudo -> ../init.d/sudo*
lrwxrwxrwx 1 root root 22 May 16 08:46 S99acpi-support -> ../init.d/acpi-support*
lrwxrwxrwx 1 root root 21 May 16 08:46 S99grub-common -> ../init.d/grub-common*
lrwxrwxrwx 1 root root 18 May 16 08:46 S99ondemand -> ../init.d/ondemand*
lrwxrwxrwx 1 root root 18 May 16 08:46 S99rc.local -> ../init.d/rc.local*
rc3.d:
total 20
drwxr-xr-x 2 root root 4096 May 22 14:27 ./
drwxr-xr-x 131 root root 12288 Jun 10 21:59 ../
-rw-r--r-- 1 root root 677 Apr 14 02:26 README
lrwxrwxrwx 1 root root 20 May 16 08:46 S20kerneloops -> ../init.d/kerneloops*
lrwxrwxrwx 1 root root 27 May 16 08:46 S20speech-dispatcher -> ../init.d/speech-dispatcher*
lrwxrwxrwx 1 root root 32 May 16 09:15 S20virtualbox-guest-utils -> ../init.d/virtualbox-guest-utils*
lrwxrwxrwx 1 root root 17 May 16 09:09 S30vboxadd -> ../init.d/vboxadd*
lrwxrwxrwx 1 root root 21 May 16 09:12 S30vboxadd-x11 -> ../init.d/vboxadd-x11*
lrwxrwxrwx 1 root root 25 May 16 09:12 S35vboxadd-service -> ../init.d/vboxadd-service*
lrwxrwxrwx 1 root root 20 May 16 08:46 S50pulseaudio -> ../init.d/pulseaudio*
lrwxrwxrwx 1 root root 15 May 16 08:46 S50rsync -> ../init.d/rsync*
lrwxrwxrwx 1 root root 15 May 16 08:46 S50saned -> ../init.d/saned*
lrwxrwxrwx 1 root root 19 May 16 08:46 S70dns-clean -> ../init.d/dns-clean*
lrwxrwxrwx 1 root root 18 May 16 08:46 S70pppd-dns -> ../init.d/pppd-dns*
lrwxrwxrwx 1 root root 14 May 22 14:27 S75sudo -> ../init.d/sudo*
lrwxrwxrwx 1 root root 22 May 16 08:46 S99acpi-support -> ../init.d/acpi-support*
lrwxrwxrwx 1 root root 21 May 16 08:46 S99grub-common -> ../init.d/grub-common*
lrwxrwxrwx 1 root root 18 May 16 08:46 S99ondemand -> ../init.d/ondemand*
lrwxrwxrwx 1 root root 18 May 16 08:46 S99rc.local -> ../init.d/rc.local*
rc4.d:
total 20
drwxr-xr-x 2 root root 4096 May 22 14:27 ./
drwxr-xr-x 131 root root 12288 Jun 10 21:59 ../
-rw-r--r-- 1 root root 677 Apr 14 02:26 README
lrwxrwxrwx 1 root root 20 May 16 08:46 S20kerneloops -> ../init.d/kerneloops*
lrwxrwxrwx 1 root root 27 May 16 08:46 S20speech-dispatcher -> ../init.d/speech-dispatcher*
lrwxrwxrwx 1 root root 32 May 16 09:15 S20virtualbox-guest-utils -> ../init.d/virtualbox-guest-utils*
lrwxrwxrwx 1 root root 17 May 16 09:09 S30vboxadd -> ../init.d/vboxadd*
lrwxrwxrwx 1 root root 21 May 16 09:12 S30vboxadd-x11 -> ../init.d/vboxadd-x11*
lrwxrwxrwx 1 root root 25 May 16 09:12 S35vboxadd-service -> ../init.d/vboxadd-service*
lrwxrwxrwx 1 root root 20 May 16 08:46 S50pulseaudio -> ../init.d/pulseaudio*
lrwxrwxrwx 1 root root 15 May 16 08:46 S50rsync -> ../init.d/rsync*
lrwxrwxrwx 1 root root 15 May 16 08:46 S50saned -> ../init.d/saned*
lrwxrwxrwx 1 root root 19 May 16 08:46 S70dns-clean -> ../init.d/dns-clean*
lrwxrwxrwx 1 root root 18 May 16 08:46 S70pppd-dns -> ../init.d/pppd-dns*
lrwxrwxrwx 1 root root 14 May 22 14:27 S75sudo -> ../init.d/sudo*
lrwxrwxrwx 1 root root 22 May 16 08:46 S99acpi-support -> ../init.d/acpi-support*
lrwxrwxrwx 1 root root 21 May 16 08:46 S99grub-common -> ../init.d/grub-common*
lrwxrwxrwx 1 root root 18 May 16 08:46 S99ondemand -> ../init.d/ondemand*
lrwxrwxrwx 1 root root 18 May 16 08:46 S99rc.local -> ../init.d/rc.local*
rc5.d:
total 20
drwxr-xr-x 2 root root 4096 May 22 14:27 ./
drwxr-xr-x 131 root root 12288 Jun 10 21:59 ../
-rw-r--r-- 1 root root 677 Apr 14 02:26 README
lrwxrwxrwx 1 root root 20 May 16 08:46 S20kerneloops -> ../init.d/kerneloops*
lrwxrwxrwx 1 root root 27 May 16 08:46 S20speech-dispatcher -> ../init.d/speech-dispatcher*
lrwxrwxrwx 1 root root 32 May 16 09:15 S20virtualbox-guest-utils -> ../init.d/virtualbox-guest-utils*
lrwxrwxrwx 1 root root 17 May 16 09:09 S30vboxadd -> ../init.d/vboxadd*
lrwxrwxrwx 1 root root 21 May 16 09:12 S30vboxadd-x11 -> ../init.d/vboxadd-x11*
lrwxrwxrwx 1 root root 25 May 16 09:12 S35vboxadd-service -> ../init.d/vboxadd-service*
lrwxrwxrwx 1 root root 20 May 16 08:46 S50pulseaudio -> ../init.d/pulseaudio*
lrwxrwxrwx 1 root root 15 May 16 08:46 S50rsync -> ../init.d/rsync*
lrwxrwxrwx 1 root root 15 May 16 08:46 S50saned -> ../init.d/saned*
lrwxrwxrwx 1 root root 19 May 16 08:46 S70dns-clean -> ../init.d/dns-clean*
lrwxrwxrwx 1 root root 18 May 16 08:46 S70pppd-dns -> ../init.d/pppd-dns*
lrwxrwxrwx 1 root root 14 May 22 14:27 S75sudo -> ../init.d/sudo*
lrwxrwxrwx 1 root root 22 May 16 08:46 S99acpi-support -> ../init.d/acpi-support*
lrwxrwxrwx 1 root root 21 May 16 08:46 S99grub-common -> ../init.d/grub-common*
lrwxrwxrwx 1 root root 18 May 16 08:46 S99ondemand -> ../init.d/ondemand*
lrwxrwxrwx 1 root root 18 May 16 08:46 S99rc.local -> ../init.d/rc.local*
rc6.d:
total 20
drwxr-xr-x 2 root root 4096 May 16 09:15 ./
drwxr-xr-x 131 root root 12288 Jun 10 21:59 ../
lrwxrwxrwx 1 root root 29 May 16 08:46 K10unattended-upgrades -> ../init.d/unattended-upgrades*
lrwxrwxrwx 1 root root 27 May 16 08:46 K20speech-dispatcher -> ../init.d/speech-dispatcher*
lrwxrwxrwx 1 root root 32 May 16 09:15 K20virtualbox-guest-utils -> ../init.d/virtualbox-guest-utils*
lrwxrwxrwx 1 root root 25 May 16 09:12 K65vboxadd-service -> ../init.d/vboxadd-service*
lrwxrwxrwx 1 root root 17 May 16 09:09 K70vboxadd -> ../init.d/vboxadd*
lrwxrwxrwx 1 root root 21 May 16 09:12 K70vboxadd-x11 -> ../init.d/vboxadd-x11*
-rw-r--r-- 1 root root 351 Apr 14 02:26 README
lrwxrwxrwx 1 root root 18 May 16 08:46 S20sendsigs -> ../init.d/sendsigs*
lrwxrwxrwx 1 root root 17 May 16 08:46 S30urandom -> ../init.d/urandom*
lrwxrwxrwx 1 root root 22 May 16 08:46 S31umountnfs.sh -> ../init.d/umountnfs.sh*
lrwxrwxrwx 1 root root 20 May 16 08:46 S35networking -> ../init.d/networking*
lrwxrwxrwx 1 root root 18 May 16 08:46 S40umountfs -> ../init.d/umountfs*
lrwxrwxrwx 1 root root 20 May 16 08:46 S60umountroot -> ../init.d/umountroot*
lrwxrwxrwx 1 root root 16 May 16 08:46 S90reboot -> ../init.d/reboot*
rcS.d:
total 20
drwxr-xr-x 2 root root 4096 Apr 23 04:38 ./
drwxr-xr-x 131 root root 12288 Jun 10 21:59 ../
-rw-r--r-- 1 root root 447 Apr 14 02:26 README
lrwxrwxrwx 1 root root 16 May 16 08:46 S25brltty -> ../init.d/brltty*
lrwxrwxrwx 1 root root 18 May 16 08:46 S37apparmor -> ../init.d/apparmor*
lrwxrwxrwx 1 root root 17 May 16 08:46 S55urandom -> ../init.d/urandom*
lrwxrwxrwx 1 root root 20 May 16 08:46 S70x11-common -> ../init.d/x11-common*
rc0.d 的 README 中写道:
The scripts in this directory are executed once when entering
runlevel 0.
The scripts are all symbolic links whose targets are located in
/etc/init.d/ .
Generally it is not necessary to alter the scripts in this directory.
Their purpose is to stop all services and to make the system ready
for shutdown.
For more information see /etc/init.d/README.
rc1.d 的 README 中写道:
The scripts in this directory are executed each time the system enters
this runlevel.
The scripts are all symbolic links whose targets are located in
/etc/init.d/ .
Generally it is not necessary to alter the scripts in this directory.
Their purpose is to stop all services and thus to put the system in
single-user mode.
For more information see /etc/init.d/README.
希望这可以帮助
答案2
对于遇到“问题”的用户来说,是否有更简单的方法来重新安装他们的默认设置,或者重建他们当前的 /etc/rc0.d 到 /etc/rc6.d 文件?
我的 ubuntu 20.04 显示文件集从 /etc/rc0.d 到 /etc/rc6.d
drwxr-xr-x 2 root root 4096 May 27 2021 rc0.d
drwxr-xr-x 2 root root 4096 May 27 2021 rc1.d
drwxr-xr-x 2 root root 4096 May 27 2021 rc2.d
drwxr-xr-x 2 root root 4096 May 27 2021 rc3.d
drwxr-xr-x 2 root root 4096 May 27 2021 rc4.d
drwxr-xr-x 2 root root 4096 May 27 2021 rc5.d
drwxr-xr-x 2 root root 4096 May 27 2021 rc6.d
drwxr-xr-x 2 root root 4096 May 12 2021 rcS.d
这些可能是在安装过程中创建的,或者在升级过程中修改的。