Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] /sbin/init does not exist after "rm -rf /usr" (Read 3319 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[SOLVED] /sbin/init does not exist after "rm -rf /usr"

hi, well  maybe this is the rigth place for this topic, for reasons of space i decided move /usr to another partition.
the procedure that I followed was:
 -make partitition & filesystem
-mount new part on /run/mount
 cp /usr/* run/mount       <<<<<-----maybe here i'm loosing something so
 rsync -axqP /usr/* run/mount   <<<<-------- i dont remeber the exact options, here also do not preserve hardlinks with option H
-edit fstab
-umount
-reboot

once login:

sudo mount --bind / /mnt
sudo rm -rf /mnt/usr     <<<< i needed this for recover space, dont understand how is working "--bind" but then the /usr is still there
////some error here about cant delete, i was trying to delete old files
sudo umount /mnt

at next reboot, stop and says "/sbin/init does not exist"
root

i tried to edit kernel before boot adding the line init=/usr/bin/run-init
inside bin
ls -lh init*
lrwxrwxrwx 1 root root 11 ago 16 08:29 init -> openrc-init

Re: /sbin/init does not exist after "rm -rf /usr"

Reply #1
Uh yeah you don't want to do this. Arch distros have the various /bin and /sbin directories all symlinked to /usr/bin.

I guess you could play with symlinks until it works, but really I would just say "don't do this." You're opening yourself up to have a ton of problems for very questionable benefit.

Re: /sbin/init does not exist after "rm -rf /usr"

Reply #2
I think it is best to try this through chroot so the system will not loose its /usr in the transition between copying and mounting.
1 make partition sdxx
2 mkdir /mnt/usr
3 mount /dev/sdxx /mnt/usr
4 cp -R /usr/* /mnt/usr
5 delete /usr/*
6 edit fstab uuid or /dev/sdxx /usr ext4 ......  (always use uuid not /dev/sdxx long term because repartitionig disks will create havoc)
7 mount -a  and check that your /usr/ is there
8 exit chroot and reboot

You can skip 5 if you are unsure everything was copied but once you boot with the new partition mounted you will not see the old /usr   - so you can't delete its contents.  By commenting out the /usr in fstab, umount /dev/sdxx and mount -a you can see it again and maybe then empty it).


Re: /sbin/init does not exist after "rm -rf /usr"

Reply #3
the process is done. Maybe I deleted something I should not have but I do not know how to get it back. Trying with links without knowing, is not a safe option.

Re: /sbin/init does not exist after "rm -rf /usr"

Reply #4
The best way at this point might be just to do a reinstall and then try what fungalnet suggested if you really want a separate /usr partition

Re: /sbin/init does not exist after "rm -rf /usr"

Reply #5
Does pacman still work on your system, if not try chroot.  With pacman -Qs or pacman -Qg you can get your active package list to use on a new install.  /home is a good thing to isolate and have on another partition.  Also copy all .conf files you remember to have changed and do a reinstall.
You can also try a hack if you have the pkg list, make a new installation just as big as this one is. Then copy /usr to your messed up /usr and see if it fixes the problem.
I also keep /var/cache is a separate partition and share it with other installations so I don't have to download the same pkg twice.
But /usr I haven't tried for a long time, not in arch-based anyway.  It is full of links and differential rights to files that sometimes even with rsync might get messed up if you don't use the right options.

Re: /sbin/init does not exist after "rm -rf /usr"

Reply #6
thanks both for your help... i'm gonna say what i did to solve it:
[root#] mount /dev/sdb8 new_root/usr                  <<<----without this cant execute chroot----->>>
[root#] chroot new_root/
[artixlinux /] nano etc/mkinitcpio.conf                   <<<---- here add 'shutdown' and 'usr' to hooks----->>>
[artixlinux /] nano etc/fstab                                          <<<-----here make sure the line where is /usr end with 0 0 ---->>>>
[artixlinux /] mount -t proc proc /proc
[artixlinux /] mount -t sysfs sys /sys
[artixlinux /] mount -o bind /dev /dev                    <<<---- if this doesnt work try mount -t dev /dev --->>>>
[artixlinux /] mkinitcpio -p linux


thats all folks,reboot & enjoy ;D


Re: [SOLVED] /sbin/init does not exist after "rm -rf /usr"

Reply #7
I have always used 0 2
I only use 0 0 for /swap

but I have forgotten why I have been doing this ;)

Re: [SOLVED] /sbin/init does not exist after "rm -rf /usr"

Reply #8
I have always used 0 2
I only use 0 0 for /swap

but I have forgotten why I have been doing this ;)

man fstab
       The fifth field (fs_freq).
              This field is used by dump(8) to determine which filesystems
              need to be dumped.  Defaults to zero (don't dump) if not
              present.

       The sixth field (fs_passno).
              This field is used by fsck(8) to determine the order in which
              filesystem checks are done at boot time.  The root filesystem
              should be specified with a fs_passno of 1.  Other filesystems
              should have a fs_passno of 2.  Filesystems within a drive will
              be checked sequentially, but filesystems on different drives
              will be checked at the same time to utilize parallelism
              available in the hardware.  Defaults to zero (don't fsck) if
              not present.

Re: [SOLVED] /sbin/init does not exist after "rm -rf /usr"

Reply #9
hi, well  maybe this is the rigth place for this topic, for reasons of space i decided move /usr to another partition.
the procedure that I followed was:
 -make partitition & filesystem
-mount new part on /run/mount
 cp /usr/* run/mount       <<<<<-----maybe here i'm loosing something so
 rsync -axqP /usr/* run/mount   <<<<-------- i dont remeber the exact options, here also do not preserve hardlinks with option H
-edit fstab
-umount
-reboot

once login:

sudo mount --bind / /mnt
sudo rm -rf /mnt/usr     <<<< i needed this for recover space, dont understand how is working "--bind" but then the /usr is still there
////some error here about cant delete, i was trying to delete old files
sudo umount /mnt

at next reboot, stop and says "/sbin/init does not exist"
root

i tried to edit kernel before boot adding the line init=/usr/bin/run-init
inside bin
ls -lh init*
lrwxrwxrwx 1 root root 11 ago 16 08:29 init -> openrc-init


It is not the symlinks that are particularly the problem, (symlinkls don't care about partitions) but when you boot up,  the /usr partition is absent for core unitilities.  Maybe you can boot with busybox.

FWIW:  This move of binaries to /usr/bin sucks....

 

Re: [SOLVED] /sbin/init does not exist after "rm -rf /usr"

Reply #10
hi, well  maybe this is the rigth place for this topic, for reasons of space i decided move /usr to another partition.
the procedure that I followed was:
 -make partitition & filesystem
-mount new part on /run/mount
 cp /usr/* run/mount       <<<<<-----maybe here i'm loosing something so
 rsync -axqP /usr/* run/mount   <<<<-------- i dont remeber the exact options, here also do not preserve hardlinks with option H
-edit fstab
-umount
-reboot

once login:

sudo mount --bind / /mnt
sudo rm -rf /mnt/usr     <<<< i needed this for recover space, dont understand how is working "--bind" but then the /usr is still there
////some error here about cant delete, i was trying to delete old files
sudo umount /mnt

at next reboot, stop and says "/sbin/init does not exist"
root

i tried to edit kernel before boot adding the line init=/usr/bin/run-init
inside bin
ls -lh init*
lrwxrwxrwx 1 root root 11 ago 16 08:29 init -> openrc-init


why make this so hard?  Why not just make the partition and cp the /usr directory to it, or tar up the /usr directory and untar it.