Skip to main content
Topic: Using artix ISO to merge home and root partitions; unable to artix-chroot (Read 1191 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Using artix ISO to merge home and root partitions; unable to artix-chroot

I have previously successfully installed artix runit on my home computer following online guides. However, the root partition on my computer became too small after a year of use. I attempted to boot in with a live artix ISO, and merge the partitions from the command line. The following are the steps I took to do so.

1)Transfer data to external hard drive. I copied the home and root partitions on seperate folders.

2)Boot in using runit artix ISO; use cfdisk to delete all 3 partitions.

3)Follow artix wiki guide on using cfdisk  to create an EFI partition, and then reserving the rest of the hard drive for only the root partition. I made sure to use the EFI and EXT4 file systems for the respective partitions.

For the remaining tasks assume
 /dev/sda1 : EFI partition
/dev/sda2: root partition

4)Mount /dev/sda2 in /mnt; mount /dev/sda1 in /mnt/boot/efi . First I copied the root partitions from external drive. Next I made a home directory within /mnt/dev/sda2 and copied home directory from the external drive.

Note: A reminder that the data on the drive was from a previous successful installation.

5) Do fstabgen -U /mnt >> /mnt/etc/fstab.  I used cat on the file, and it all seemed to look good. I then rebooted my machine. (Note: I rebooted the machine without unmounting the partitions. Could that have negatively effected the data?)

6)I attempt to mount /dev/sda1 and /dev/sda2 in the same directories, and try to [artix-chroot /mnt] in order to install grub on /dev/sda1. I get the error below:

chroot failed to run command bin/bash no such file or directory

Attempts to troubleshoot:
I try the command:

artix-chroot /mnt /mnt/usr/bin/bash

I get the error:

chroot failed to run command bin/bash no such file or directory

I haven't tried anything else, as I scared I will ruin my machine.

I don't know why it isn't working. If I directly clone partitions from a successful installation, why doesn't it work. Please explain the answers to me in a simple format, as I am stupid. I am desperate for help, as I want to use my PC for my college work.

Re: Using artix ISO to merge home and root partitions; unable to artix-chroot

Reply #1
try
Code: [Select]
artix-chroot /mnt
Create problems which don't have solution

Re: Using artix ISO to merge home and root partitions; unable to artix-chroot

Reply #2

I have already tried that method unfortunately. That is why I am looking for suggestions as to what I can do to chroot in my partitions.

For anyone who comes along in this thread, please give your suggestions. I am desperate to save my installation, as I am an idiot who needs assistance :(

I am sorry for not using the proper format to show my attempts in code format. I was in a hurry when I first posted this. Please assist me

Re: Using artix ISO to merge home and root partitions; unable to artix-chroot

Reply #3
5) Do fstabgen -U /mnt >> /mnt/etc/fstab.  I used cat on the file, and it all seemed to look good. I then rebooted my machine. (Note: I rebooted the machine without unmounting the partitions. Could that have negatively effected the data?)

6)I attempt to mount /dev/sda1 and /dev/sda2 in the same directories, and try to [artix-chroot /mnt] in order to install grub on /dev/sda1. I get the error below:

chroot failed to run command bin/bash no such file or directory
When you rebooted in step 5, did the system boot successfully? If no, then I assume you have rebooted from Live ISO before step 6.

artix-chroot will attempt to execute /bin/sh if no command is specified. It is a script, you can open it up in text editor to see what exactly it is doing. If you run exactly
Code: [Select]
artix-chroot /mnt
it shouldn't report that it can't run "bin/bash" (the proper path is "/bin/bash", with the leading /), because it will call chroot(1), with SHELL=/bin/sh.

Before rebooting in step 5, you should have chrooted to /mnt and regenerated grub with
Code: [Select]
update-grub

If you still can't recover your system, post /etc/fstab and /var/log/dmesg.log (if it doesn't exist, then /var/log/dmesg - it's the same log) from the root partition on your hard disk and the output of:
Code: [Select]
lsblk -f
(Use https://paste.artixlinux.org.)

Re: Using artix ISO to merge home and root partitions; unable to artix-chroot

Reply #4
When you have got stuff mounted, check that the paths are as you expect, for example does /mnt /mnt/usr/bin/bash exist, and does this mean instead of /usr/bin you have /mnt/usr/bin on your new / partition. Also check permissions are OK with ls -l, you didn't specify if you had used cp -a for example, these can be fixed, but if you had lost executable permission on the bash file it would give this error too. You can actually resize partitions with gparted and it will do this for you easily, although you should still back up first, and your method is probably more educational.

Re: Using artix ISO to merge home and root partitions; unable to artix-chroot

Reply #5
When you have got stuff mounted, check that the paths are as you expect, for example does /mnt /mnt/usr/bin/bash exist, and does this mean instead of /usr/bin you have /mnt/usr/bin on your new / partition. Also check permissions are OK with ls -l, you didn't specify if you had used cp -a for example, these can be fixed, but if you had lost executable permission on the bash file it would give this error too. You can actually resize partitions with gparted and it will do this for you easily, although you should still back up first, and your method is probably more educational.

/mnt/usr/bin/bash both exist. To check if it did. I tried executing the binaries from the command line. I was even able to execute zsh in my partition, however the command prompt was garbled up due to powerlevel 10k prompt being enabled for zsh.

I did not use cp-a. Maybe that could have caused it to not be executed by artix-chroot. Currently I am unable to access my home computer, so it may be a few hours before I can get back to you, and confirm whether the binaries are truly executable.
Thank you so much for trying to help me out.

Update: Yes they have executable permissions

Code: [Select]
 
-rwxr-xr-x 1 root root    952720 Oct 15 19:51 bash
-rwxr-xr-x 1 root root      6945 Oct 15 19:51 bashbug
-rwxr-xr-x 1 root root    13601  Oct 15 19:51 env_parallel.bash

Re: Using artix ISO to merge home and root partitions; unable to artix-chroot

Reply #6
Quote
When you rebooted in step 5, did the system boot successfully? If no, then I assume you have rebooted from Live ISO before step 6.

Yes  I rebooted from the main ISO. When I was in the bios there was no option for me to boot into the partition, as I had also wiped out /dev/sda1 which contained my EFI partition as well as grub. I thought that I had to remove my /dev/sda1 for me to make my new partition scheme. Was that incorrect?

Quote
it shouldn't report that it can't run "bin/bash" (the proper path is "/bin/bash", with the leading /), because it will call chroot(1), with SHELL=/bin/sh.
Sorry that was a typo. It did say /bin/sh. 

Quote
Before rebooting in step 5, you should have chrooted to /mnt and regenerated grub with
Code: [Select]
update-grub

Ah that was my stupid of me. I did not know that such a command existed. I have a question. Is it possible for me to install grub on /dev/sda1 without chrooting into /mnt, where I usually mount /dev/sda?

Quote
If you still can't recover your system, post /etc/fstab and /var/log/dmesg.log (if it doesn't exist, then /var/log/dmesg - it's the same log) from the root partition on your hard disk and the output of:

Unfortunately I am unable to access my home PC at the moment. I am also unsure how to post the logs, as I am booting using the live ISO. I am thinking that I should boot with a graphical distro and post the logs. Is that correct?

Thank you so much for your replies. Once I am able to use my machine I will post the necessary information. Thank you for helping me out, as I am clueless on what to do next.



Re: Using artix ISO to merge home and root partitions; unable to artix-chroot

Reply #7
From the Live ISO, for example from a terminal emulator if GUI ISO or from a tty if base ISO:
Code: [Select]
sudo su
lsblk -f > /tmp/lsblk.txt
lsblk -f                              # check where is your *hard disk* root partition
mount /dev/sda2 /mnt      # /dev/sda2 here is wherever is your root; it could also be /dev/sdb2 so do a lsblk -f above to check
cp /mnt/var/log/dmesg.log /tmp/dmesg.txt || cp /mnt/var/log/dmesg /tmp/dmesg.txt
cp /mnt/etc/fstab /tmp/fstab.txt
If GUI ISO: access a web browser and post those three files to https://paste.artixlinux.org: /tmp/lsblk.txt, /tmp/dmesg.txt, /tmp/fstab.txt

If base ISO or if network doesn't work: copy the three files above to a separate flash disk and post them to https://paste.artixlinux.org from a working computer.

Re: Using artix ISO to merge home and root partitions; unable to artix-chroot

Reply #8
Hello everyone,

I am happy that I got so many replies instantly. However I couldn't apply any of the solutions...
I am close to my exam dates, and I had to quickly submit a university project with Matlab. The program is too bloated to run on my old macbook and I needed my PC ASAP.

To those who have the same issue as me, here are the steps that I took to merge my installation, after butchering my install.

I live installed artix runit, and I then used 
Code: [Select]
rsync -va 
to clone my home directory. Next, I used
Code: [Select]
sudo rsync -va --delete --dry-run
on the directories in my root partition, and manually sort and include the changes, as copying my saved root partition directly into my PC was what prevented me from chrooting into the installation after basestrap. Rsyncing directories suck as
Code: [Select]
bin
and
Code: [Select]
sbin
was alright, but make sure to not rsync your /etc directory, as if you do, it'll effect your tty daemons, and completely prevent you from running terminal commands (something I found out unfortunately during my first attempt)  :(

Finally, I manually edited my  /etc/profile to change the $PATH variable to what I want. I also advise checking your /etc/fstab folder to see if the correct mountpoints are set.

For future individuals with the same issue, I found out too late that I could have used
Code: [Select]
update-grub
to update my grub config. I shouldn't have deleted all my partitions in one shot, and should have just deleted my home directory.

Finally, for any artix devs who see this thread, I wonder whether it should be discouraged to make seperate home and root partitions. Resizing partitions is dangerous, especially for newbies like me who are likely to get instructions wrong. The slight benefit of being able to distrohop isn't really worth it when you are installing beautiful artix, your first and final system ;), and the hectic pain you have to go through when dependencies eventually clutter your root partition make it, in my opinion, a poor convention.

I am sorry everyone that there was no resounding conclusion, and I apologize for taking so much time to make a reply to your responses. Nothing left to do but to close the thread :(

Re: Using artix ISO to merge home and root partitions; unable to artix-chroot

Reply #9
It's not only about "distrohopping", having a separate /home partition makes it easy to backup only your settings and user files, but it is recommended, and not enforced.

By default, calamares installer partitions the entire hard disk into one boot and one root partition when the "erase disk" option is selected, and it doesn't assign a separate partition to /home. You can also choose "manual partitioning" to have more precise control.

Edit: Attached two screenshots of calamares. One is the option to erase the entire disk, the other to manually partition.


 

Re: Using artix ISO to merge home and root partitions; unable to artix-chroot

Reply #10
Sounds a great conclusion if you got things working, well done! Any way is a good way if it gets you the right result!
The advice for any major partition changes is back up thoroughly before, there are so many possible pitfalls. Thoughtful use of gparted would probably have made this process much easier for you, for example you could have saved home, deleted or moved it, resized root, put the things from home into root, just a matter of waiting for gparted to take care of it all after backing up. Not sure there is any convention to have a separate home, it's just something some people like to do. I don't have one, unhelpful if you are short of drive space, probably give you version problems if you did distro hop, might make it easier for backups though. The Artix wiki shows you how to do that but clearly says OPTIONAL after that bit:
https://wiki.artixlinux.org/Main/Installation#Partition_your_disk_.28BIOS.29