3

How do I get /sbin/init to install?

  1. My boot started failing indicating no /sbin/init after an update.

  2. Lots of playing around with gparted, grub, supergrub2...

  3. So I created a bootable gparted disk.

  4. Mounted my / and found it to be intact, /sbin is present but missing /sbin/init.

  5. Stumbled on No /sbin/init after upgrading to ubuntu 15.

  6. Found How to restore a system after accidentally removing all kernels?

  7. Went through the mount, chroot procedure outlined in restore procedure.

  8. The procedure is for an upgrade to 15.04 from 14.04, but I want stay with 14.04, so I am using a reinstall. Its failing and I don't know where to go from here.

  9. Aslo tried to reinstall upstart as per Restoring /sbin/init from Live CD, failed with a dpkg error processing fontconfig (see output below).

# 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

TimR
  • 31
  • 1
  • 1
  • 3

3 Answers3

4

Never lose your hopes!

I've also faced a crash after apt-get install has installed some new packages... and at next reboot BANG! /sbin/init: No such file or directory. Also said /etc/init: Permission denied. Also said /bin/sh: 0: can't access tty; job control turned off.

Filesystem remained untouched at /dev/vda1 and fsck.ext4 returned: clean!

After a loooong research session, this worked for me: +1 to hill - a user from launchpad.

  1. boot your droplet with a Recovery ISO - TigerShark
  2. Network must be configured, either manually or via TigerShark script.
  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

After reboot your system. It will work fine. Enjoy!

References:

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

Zanna
  • 72,312
0

@Hudson Santos's method is working. But if you can't access to bootloader to use a live CD or usb boot, here is another way to update your initramfs:

  • First go to grub, if grub menu is skip you can try to press Shift or Esc (once) to enter grub menu
  • Press E, you will go to an editor to edit boot command. Now go to line start with 'linux ...' and add this to the end of that line : init=/bin/bash
  • Ctrl + X or F10 to boot into init path above.
  • Now connect to your lan network and set ip though ifconfig or ip link
  • apt install systemd (if you can't find /lib/systemd/systemd)
  • Follow steps from Hudson Santos
0

Easiest solution? Full reinstall of your OS. Mark the packages you have installed and backup your /home and other related files/folders (unless you have /home on another partition (good for you!)), then reinstall, writing over the old broken OS partition.