Artix Linux Forum

Init systems => runit => Topic started by: theeast on 03 April 2021, 19:54:14

Title: Root device mounted successfully, but /sbin/init does not exist
Post by: theeast on 03 April 2021, 19:54:14
I've been dualbooting Artix runit with Windows 7 without any problem for several months now. But today, when restart from Windows, Artix displayed this error
Code: [Select]
/dev/sda3: recovering journal
/dev/sda3: clean, 194917/11231232 files, 3226083 blocks
ERROR: Root device mounted successfully, but /sbin/init does not exist.
Bailing out, you are on your own. Good luck.

sh: can't access tty: job control turned off

I did some research myself but most source are from Arch/systemd so I don't think they are useful in my case.
My
Code: [Select]
 ls -l sbin/init 
returned
Code: [Select]
 lrwxrwxrwx        1  0                 0                  7    Jan    1     1970  sbin/init  ->  busybox 

Some changes to the system that I made that could lead to the error:
   + I installed .NET framework 4 in my Windows
   + I removed some unused dependencies that did not appeared in  pacman -Qdtq
   + Some Arch users got  root        root  instead of the double 0s when run  ls -l sbin/init  so I think that could be the problem

I appreciate all help and support.
Thank you!
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: Dudemanguy on 03 April 2021, 20:12:42
I'm fairly certain sbin/init should symlink to runit-init on Artix runit systems. I have no idea why it is symlinked to busybox for you, but that would explain you being unable to boot the system.
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: strajder on 03 April 2021, 20:30:16
   + I installed .NET framework 4 in my Windows
That should have no effect on your GNU/Linux partitions.
Quote
   + I removed some unused dependencies that did not appeared in  pacman -Qdtq
This could be the culprit. In my experience, not every package reported as "unused" is disposable.
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: theeast on 03 April 2021, 20:40:49
I'm fairly certain sbin/init should symlink to runit-init on Artix runit systems. I have no idea why it is symlinked to busybox for you, but that would explain you being unable to boot the system.
Is there any way to return my system to its normal state?

That should have no effect on your GNU/Linux partitions.This could be the culprit. In my experience, not every package reported as "unused" is disposable.
How can I reinstall culprit? pacman did not work.

Thank you for your responses, I did not expect it to be this quick!
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: Dudemanguy on 04 April 2021, 00:47:21
Is there any way to return my system to its normal state?


Assuming you use grub as your bootloader, you can hit e during bootup and temporarily alter your kernel parameters (https://wiki.archlinux.org/index.php/Kernel_parameter#GRUB). You can add init=/usr/bin/runit-init which should then allow you to boot up. Of course, that assumes you still have runit-init on your system and it didn't mysteriously get removed with whatever happened. If that does not work, you would need to chroot into your root partition. In any either case, you should probably reinstall your init (runit and runit-rc) and double check to make sure that your init symlink is correct.
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: ####### on 04 April 2021, 03:41:17
If the other (rather good) ideas don't resolve it, my further suggestion is that /var/log/pacman.log should hold a record of what you did if you needed to check, and possibly the removed packages are still in /var/cache/pacman/pkg/ and if they are, pacman -U will easily reinstall them after chrooting in. Otherwise they can be found in the repos online. No need for a network connection on the problem machine either, you can get the package(s) and put them on a usb with another computer, then use pacman -U again.
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: theeast on 04 April 2021, 12:26:37
You can add init=/usr/bin/runit-init which should then allow you to boot up.
If that does not work, you would need to chroot into your root partition.
When cd /usr/bin I couldn't find runit-init but run-init so I tried both but it didn't work. I also looked into https://rlbcontractor.com/fixing-a-broken-linux-system-with-chroot (https://rlbcontractor.com/fixing-a-broken-linux-system-with-chroot) but I'm too afraid to try as I am rather inexperienced.

Could you give me a detailed guide on how to chroot?

/var/log/pacman.log should hold a record of what you did if you needed to check, and possibly the removed packages are still in /var/cache/pacman/pkg/ and if they are, pacman -U will easily reinstall them after chrooting in. Otherwise they can be found in the repos online. No need for a network connection on the problem machine either, you can get the package(s) and put them on a usb with another computer, then use pacman -U again.
Checked pacman.log and I didn't remove culprit but some packages belong in base-devel and /var only contain a /run file. However, /new_root (which I didn't create) contain all files you described, can this information be helpful?
I dualboot so I can use Windows when Artix is broken
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: strajder on 04 April 2021, 12:45:34
How can I reinstall culprit? pacman did not work.

Checked pacman.log and I didn't remove culprit

Dude

https://www.merriam-webster.com/dictionary/culprit

Number 3. /facepalm
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: theeast on 04 April 2021, 14:41:38
Damnit. Well at least now you know I'm not a native English speaker.
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: Dudemanguy on 04 April 2021, 16:28:58
When cd /usr/bin I couldn't find runit-init but run-init so I tried both but it didn't work. I also looked into https://rlbcontractor.com/fixing-a-broken-linux-system-with-chroot (https://rlbcontractor.com/fixing-a-broken-linux-system-with-chroot) but I'm too afraid to try as I am rather inexperienced.

Could you give me a detailed guide on how to chroot?

That guide is what you need to do (with regards to the arch section of it). The only difference is that with an artix live iso/usb you would use artools-chroot instead of arch-chroot.
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: theeast on 05 April 2021, 12:26:11
I've successfully mount my partition but artools-chroot returned command not found so I used chroot instead. I know it is the right partition because it have my user file. But when I attempted to  pacman -U  my deleted packages, it returned

error: could not open file: /etc/mtab: No such file or directory
error: could not determine filesystem mount points
error: not enough free disk space
error: failed to commit transaction (unexpected error)

And I was unable to restore them. I'm so close to fixing it, how do I continue from here?
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: Dudemanguy on 05 April 2021, 14:46:47
It seems quite odd artools-chroot wasn't found. Were you using an artix live iso? Well it doesn't matter in either case you can always do the chroot manually. It consists of many steps if you want a working system. Follow the Arch guide (https://wiki.archlinux.org/index.php/Chroot#Using_chroot) here.
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: theeast on 05 April 2021, 16:28:30
It seems quite odd artools-chroot wasn't found. Were you using an artix live iso? Well it doesn't matter in either case you can always do the chroot manually. It consists of many steps if you want a working system.
It's odd to me too, first is busybox and now this, do you have the same problem with your system? Yes I was in the live inviroment
Thanks for the link, I will look into it
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: theeast on 06 April 2021, 13:45:34
I've been able to chroot my system using artix-chroot (I found it while looking through lib64) and I executed
Code: [Select]
pacman -Syu
pacman -S base-devel runit runit-rc
mkinitcpio -P
all without issue. However, that didn't solve the problem, when I look into /sbin and /bin, init was nowhere to be found. Is it possible to generate or recover it?
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: alium on 06 April 2021, 14:48:29
/sbin and /bin are only symlinks to /usr/bin...
Title: [SOLVED] Re: Root device mounted successfully, but /sbin/init does not exist
Post by: theeast on 06 April 2021, 16:25:43
/sbin and /bin aee only symlinks to /usr/bin...
Interesting, but I also checked /usr/bin and I couldn't find init there either, this might be the last problem I have to deal with.
How should I fix it?
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: alium on 06 April 2021, 16:51:05
by installing your init again? pacman -S runit.. ..?
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: strajder on 06 April 2021, 17:13:12
by installing your init again? pacman -S runit.. ..?
Well, theeast seems to say this:
I've been able to chroot my system using artix-chroot (I found it while looking through lib64) and I executed
Code: [Select]
pacman -Syu
pacman -S base-devel runit runit-rc
mkinitcpio -P
all without issue. However, that didn't solve the problem, when I look into /sbin and /bin, init was nowhere to be found. Is it possible to generate or recover it?
Which is only possible if they didn't chroot.

The whole point is to first chroot into the hard disk partition which should be mounted to /, then reinstall. Otherwise the reinstall only happens in the live filesystem setup in RAM and goes away upon restart.

@OP: In order to have a working temporary system chrooted to your hard disk, you first need to redirect Linux pseudo file systems through mount, then chroot.
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: theeast on 06 April 2021, 18:04:14
@OP: In order to have a working temporary system chrooted to your hard disk, you first need to redirect Linux pseudo file systems through mount, then chroot.
But I did, first
Code: [Select]
sudo -i
mount /dev/sda3 /mnt
then
Code: [Select]
artix-chroot /mnt
I saw that  artix: [root]:~#  become  sh-5.1#
Also, when I pacman -Syu the second time right after rebooting, all repositories except community are up to date, so I definitely made changes to the system. runit and runit-rc were both up to date when I reinstalled them so I'm really stuck here
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: strajder on 06 April 2021, 18:07:57
Any error messages? Have you tried to do ls -l /sbin/init inside the chrooted environment?
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: theeast on 06 April 2021, 19:45:22
Any error messages? Have you tried to do ls -l /sbin/init inside the chrooted environment?
pacman -S runit runit-rc  now return
Code: [Select]
....
:: Running post-transaction hooks...
(1/3) Applying kernel sysctl settings...
  Skipped: Current root is not booted.
(2/3) Creating temporary files...
Failed to open file "/sys/devices/system/cpu/microcode/reload": Read-only file system
error: command failed to execute correctly
(3/3) Displaying runit service help ...
==> Add a service:
ln -s /etc/runit/sv/<service> /run/runit/service/
==> Start/stop/restart a service:
sv <start/stop/restart> <service>
and  ls -l /sbin/init  returned
Code: [Select]
ls: cannot access '/sbin/init': No such file or directory
All of these commands are done in the chroot system
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: alium on 06 April 2021, 19:56:24
put here your /etc/fstab
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: theeast on 06 April 2021, 20:20:58
ls -l /etc/fstab  returned
Code: [Select]
-rw-r--r-- 1 root root 415 Feb 23 03:44 /etc/fstab
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: strajder on 06 April 2021, 20:37:41
Code: [Select]
ls: cannot access '/sbin/init': No such file or directory

Well, that is different from:

My
Code: [Select]
 ls -l sbin/init 
returned
Code: [Select]
 lrwxrwxrwx        1  0                 0                  7    Jan    1     1970  sbin/init  ->  busybox 

which looks like a result of playing around with busybox in place of runit/OpenRC/s6.

Code: [Select]
-rw-r--r-- 1 root root 415 Feb 23 03:44 /etc/fstab
alium meant the result of cat /etc/fstab inside the chrooted environment.
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: ####### on 06 April 2021, 22:45:46
/usr/bin/init was owned by artix-sysvcompat but that got replaced by system/base sometime around October 2019. Reinstalling "base" might help with that.
Title: Re: Root device mounted successfully, but /sbin/init does not exist
Post by: theeast on 07 April 2021, 10:08:23
Yes, I installed  base  and it said
Code: [Select]
....
(1/1)  Detecting init  ...
                        ==>  Found runit-init
and after rebooting, Artix worked normally again

I'd like to thank everyone for your advice and guidance and for sticking around.
This is one hell of a learning experience!