Linux booting can't execute '/sbin/init': No such file or directory

Treeboy·2025년 3월 6일

시간낭비주의: 결국 포맷함

문제: linux 컴퓨터 부팅 조차 안됨:

  1. Claude한테 아래 문구 문의
run-init: can't execute '/sbin/init': No such file or directory
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
CPU: 0 PID: 1 Comm: run-init Not tainted 5.15.0-131-generic #141~20.04.1-Ubuntu
Hardware name: ASUS System Product Name/ROG STRIX 2590-E GAMING WIFI, BIOS 0232/01/06/2021
  1. USB 부팅

USB 에 우분투 넣어서 부팅해봄. 근데 인식이 안되어서 다른 포트에다가 넣어서 결국 켜지게 만듬.

  1. 다음

Try or Install Ubuntu 로 들어가서

Ctrl+Alt+T 로 터미널 틀기

  1. Installation 점검
# List all disk partitions
sudo fdisk -l

# Mount your root partition (replace sdXY with your actual partition like sda1)
sudo mount /dev/sdXY /mnt

# Check if init exists
ls -la /mnt/sbin/init

# Check filesystem integrity
sudo fsck /dev/sdXY

나는 nvme0n1 이 부팅디스크여서 이걸로 했다.

근데 마운트를 하는 과정에서

/mnt: wrong fs type, bad option, bad superblock on /dev/nvme0n1, missing codepage or helper program, or other error.

라는 에러가 났음.

알고보니 nvme0n1 안에 두 파티션이 있어서 그 중 하나를 specify 해야 했었음.

# Claude Answer

1. First, list all partitions on your NVMe drive:

sudo fdisk -l /dev/nvme0n1

2. Look for the Linux partition(s) in the output. They will be labeled something like /dev/nvme0n1p1, /dev/nvme0n1p2, etc. The root partition is typically formatted as ext4.

Linux Filesystem 은 nvme0n1p2 였다.

  1. /sbin/init 확인하기
ls -la /mnt/sbin/init 

보니

lrwxrwxrwx 1 root root 20 Jun 17 2024 /mnt/sbin/init -> /lib/systemd/systemd

라는 글귀가 나왔다.

Claude 는

ls -la /mnt/lib/systemd/systemd

로 systemd 가 존재하는지 확인하라 했고,

-rwxr-xr-x 1 root root 1624320 Jun 17 2024 /mnt/lib/systemd/systemd

라는 답을 받았다.

  1. initramfs / bootloader configuration 체크하기

/sbin/init 은 확실히 있는 것 같다. claude 는 다음 스텝을 제시했음.

1. Check if all critical filesystems are mountable:
sudo mount -o bind /dev /mnt/dev
sudo mount -o bind /proc /mnt/proc
sudo mount -o bind /sys /mnt/sys

2. Check if your initramfs (initial RAM disk) is corrupted. First, let's find your kernel version:
ls -la /mnt/boot/

3. Depending on your kernel version, you may need to regenerate your initramfs. We can chroot into your installation and do this:
sudo chroot /mnt

4. Once in chroot, update and regenerate the initramfs:
update-initramfs -u -k all

5. Update your GRUB configuration:
update-grub

6. Exit the chroot
exit

2번 스텝에서 5.15.0-130 and 5.15.0-131 라는 파일 이름들이 존재했다.

Claude response

Based on the files you're seeing, you have two kernel versions installed:

5.15.0-130
5.15.0-131

The higher number (5.15.0-131) is likely your most recent kernel version, which matches the version mentioned in your initial kernel panic message:

This confirms that your system was trying to boot with kernel 5.15.0-131-generic when it encountered the error. You should regenerate the initramfs for both kernel versions to ensure everything is working properly, but focus on the 5.15.0-131 version first since that's what your system is trying to use.

When you run the commands to update the initramfs and GRUB, you'll want to make sure both kernels get updated, but especially the 5.15.0-131 version.

결국 3번 step 에서 bash 를 못들어가서 Ubuntu 를 다시 깔아버렸다..

0개의 댓글