如何从错误更新和无 /sbin/init 中恢复

如何从错误更新和无 /sbin/init 中恢复

我如何/sbin/init安装?

  1. /sbin/init更新后,我的启动开始失败,显示“否” 。

  2. 玩了很多gparted,,grub...supergrub2

  3. 因此我创建了一个可启动gparted磁盘。

  4. 安装我的/并发现它完好无损,/sbin存在但丢失了/sbin/init

  5. 偶然发现升级到 ubuntu 15 后没有 /sbin/init

  6. 成立意外删除所有内核后如何恢复系统?

  7. 已完成恢复程序中概述的程序mountchroot

  8. 该程序是从 14.04 升级到 15.04,但我想保留 14.04,所以我正在重新安装。它失败了,我不知道接下来该怎么办。

  9. 还尝试upstart按照以下方法重新安装从 Live CD 恢复 /sbin/initdpkg,处理失败,出现错误fontconfig(见下面的输出)。

# apt-get install --reinstall linux-image-generic linux-image-3.13.0.96-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'linux-image-3.13.0-96-generic' for regex 'linux-image-3.13.0.96-generic'
0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 98 not upgraded.
1 not fully installed or removed.
Need to get 0 B/15.3 MB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 532316 files and directories currently installed.)
Preparing to unpack .../linux-image-3.13.0-96-generic_3.13.0-96.143_amd64.deb ...
Done.
Unpacking linux-image-3.13.0-96-generic (3.13.0-96.143) over (3.13.0-96.143) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-96-generic /boot/vmlinuz-3.13.0-96-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-96-generic /boot/vmlinuz-3.13.0-96-generic
Preparing to unpack .../linux-image-generic_3.13.0.96.104_amd64.deb ...
Unpacking linux-image-generic (3.13.0.96.104) over (3.13.0.96.104) ...
Setting up fontconfig (2.11.1-0ubuntu6) ...
Regenerating fonts cache... failed.
See /var/log/fontconfig.log for more information.
dpkg: error processing package fontconfig (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up linux-image-3.13.0-96-generic (3.13.0-96.143) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Not updating initrd symbolic links since we are being updated/reinstalled 
(3.13.0-96.143 was configured last, according to dpkg)
Not updating image symbolic links since we are being updated/reinstalled 
(3.13.0-96.143 was configured last, according to dpkg)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-96-generic /boot/vmlinuz-3.13.0-96-generic
run-parts: executing /etc/kernel/postinst.d/dkms 3.13.0-96-generic /boot/vmlinuz-3.13.0-96-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-96-generic /boot/vmlinuz-3.13.0-96-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-96-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.13.0-96-generic /boot/vmlinuz-3.13.0-96-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.13.0-96-generic /boot/vmlinuz-3.13.0-96-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.13.0-96-generic /boot/vmlinuz-3.13.0-96-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-96-generic
Found initrd image: /boot/initrd.img-3.13.0-96-generic
Found linux image: /boot/vmlinuz-3.13.0-95-generic
Found initrd image: /boot/initrd.img-3.13.0-95-generic
Found linux image: /boot/vmlinuz-3.13.0-91-generic
Found initrd image: /boot/initrd.img-3.13.0-91-generic
Found linux image: /boot/vmlinuz-3.13.0-86-generic
Found initrd image: /boot/initrd.img-3.13.0-86-generic
Found linux image: /boot/vmlinuz-3.13.0-74-generic
Found initrd image: /boot/initrd.img-3.13.0-74-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
  No volume groups found
done
Setting up linux-image-generic (3.13.0.96.104) ...
Errors were encountered while processing:
 fontconfig
E: Sub-process /usr/bin/dpkg returned an error code (1)
# apt-get install --reinstall upstart
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 98 not upgraded.
1 not fully installed or removed.
Need to get 0 B/399 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 532316 files and directories currently installed.)
Preparing to unpack .../upstart_1.13.2-0ubuntu13_amd64.deb ...
Unpacking upstart (1.13.2-0ubuntu13) over (1.13.2-0ubuntu13) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up fontconfig (2.11.1-0ubuntu6) ...
Regenerating fonts cache... failed.
See /var/log/fontconfig.log for more information.
dpkg: error processing package fontconfig (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up upstart (1.13.2-0ubuntu13) ...
Errors were encountered while processing:
 fontconfig
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@debian:/# ls -al /sbin/init
ls: cannot access /sbin/init: No such file or directory
  • /dev/sda3 /
  • /dev/sda5 /home
  • /dev/sda1 bios_grub
  • /dev/sda2 swap
$ sudo parted -l
Model: ATA WDC WD30EZRX-00M (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name      Flags
 1      17.4kB  1000MB  1000MB                  boot      bios_grub
 2      1000MB  13.0GB  12.0GB  linux-swap(v1)  swap
 4      513GB   713GB   200GB                   reserve1  msftdata
 5      713GB   1013GB  300GB   ext4            home      msftdata
 6      1013GB  1213GB  200GB                             msftdata
 3      1213GB  2000GB  787GB   ext4                      msftdata


Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0
has been opened read-only.
Error: Can't have a partition outside the disk!
Ignore/Cancel? ignore
Model: PLDS DVD+-RW DH-16ABS (scsi)
Disk /dev/sr0: 279MB
Sector size (logical/physical): 2048B/2048B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 2      1082MB  1095MB  12.8MB  primary               esp

答案1

永远不要放弃你的希望!

我也遇到过 apt-get install 安装一些新软件包后崩溃的情况……下次重启时/sbin/init: No such file or directory。也說/etc/init: Permission denied。也說/bin/sh: 0: can't access tty; job control turned off

文件系统保持不变/dev/vda1fsck.ext4返回:干净!

经过长时间的研究,我发现这个方法对我有用:+1 至山丘- 来自的用户发射台

  1. 使用恢复 ISO 启动你的 droplet - TigerShark
  2. 必须配置网络,可以手动配置或者通过 TigerShark 脚本配置。
  3. mount -rw -o remount /dev/vda1 /mnt
  4. chroot /mnt
  5. unlink /etc/resolv.conf && echo "nameserver 8.8.8.8" > /etc/resolv.conf
  6. apt-get install init
  7. update-initramfs -u

重启系统后,系统将正常运行。尽情享受吧!

参考

https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1652462 https://wiki.ubuntu.com/SystemdForUpstartUsers

答案2

最简单的解决方案?完全重新安装您的操作系统。标记您已安装的软件包并备份您的 /home 和其他相关文件/文件夹(除非您的 /home 在另一个分区上(这对您有好处!)),然后重新安装,覆盖旧的损坏的操作系统分区。

相关内容