LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-28-2020, 02:32 AM   #1
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,959

Rep: Reputation: 271Reputation: 271Reputation: 271
Can I change the root drive?


I'm having trouble booting off my hard disk. I can boot off a flash drive then mount the hard disk and use it without trouble, but the directories are all off. Is there a way to remount, say /disk to / ? mount -o remount would seem to do this, but doesn't, possibly because / is already in use. I can execute individual commands with chroot, but the libraries are in the wrong place.
 
Old 05-28-2020, 03:55 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,292

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
And not a backup in sight? /Sigh

You need to expand on: "The directories are all off."
If you can't simply rename these, say 32/64 bit libs incorrigibly mixed, one suggestion might be to boot on your live usb, and run
Code:
ROOT=/mnt upgradepkg --reinstall *
from every relevant directory of the install dvd. It's simple to script this. I used this
Code:
#!/bin/bash

for i in a ap  d e f l n t tcl x xap xfce y; do
     cd  $i
     ROOT=$1 /sbin/upgradepkg  *.txz 
     cd ..
     sync
     next $i
     done
It spins some error when finished, but that's my PRIMITIVE scripting. You would need to add the '--reinstall' option after upgradepkg but before the filename. The usage is 'upgrade.sh /rootdir' and it will do the work in /rootdir. That should restore directory sanity.
 
Old 05-28-2020, 04:05 AM   #3
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Quote:
but the directories are all off.
Do you mean you can't access the directories?

Any encryption or other methods that is blocking the access on that HDD?
 
Old 05-28-2020, 04:16 AM   #4
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by RandomTroll View Post
I'm having trouble booting off my hard disk. I can boot off a flash drive then mount the hard disk and use it without trouble, but the directories are all off. Is there a way to remount, say /disk to / ? mount -o remount would seem to do this, but doesn't, possibly because / is already in use. I can execute individual commands with chroot, but the libraries are in the wrong place.
Booting how? LILO? Grub?

There are ways to fix problems like this but, if this is a fresh install that won't boot, it might be advisable to take B.K.'s suggestion and re-install. Take care to set up the boot device using the installation menu items. I hadn't used Slackware for years and botched that step the first time I ran the installer.
 
Old 05-28-2020, 04:20 AM   #5
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by business_kid View Post
And not a backup in sight? /Sigh

You need to expand on: "The directories are all off."
I read that as meaning that "/bin", "/usr", etc. are, after mounting the root partition, now seen as "/mnt/bin", "/mnt/usr", etc. (or whatever the mount point is/was). Nothing is going to work with that mess.
 
Old 05-28-2020, 06:57 AM   #6
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by RandomTroll View Post
I'm having trouble booting off my hard disk. I can boot off a flash drive then mount the hard disk and use it without trouble, but the directories are all off. Is there a way to remount, say /disk to / ? mount -o remount would seem to do this, but doesn't, possibly because / is already in use. I can execute individual commands with chroot, but the libraries are in the wrong place.
What is the exact issue, that will help give you proper guidance.
When system is booting (or trying to boot) from hard disk, do you see an error? You may have to press F2 to see the text.
Which OS and release?
Depending on issue, since you are able to boot to USB media and mount the hard disk, you need to backup your data first, and then figure out what is causing the issue.
 
Old 05-28-2020, 07:25 AM   #7
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Examine the chroot command. I see no reason why you should not boot off one drive, then use chroot to make the other drive your current root before starting any processes (or a gui desktop).

That said, all of this is a kludge. The more lasting option is to troubleshoot the problem, and correct whatever is causing the boot issue. You might need to replace the drive and reload your OS on new hardware, but only do that if the drive itself is failing. (Well, unless you like doing that for fun. In that case, go to and have fun!)
 
Old 05-28-2020, 08:03 AM   #8
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,959

Original Poster
Rep: Reputation: 271Reputation: 271Reputation: 271
Quote:
Originally Posted by business_kid View Post
And not a backup in sight?
2 complete backups. I said nothing about data loss.

Booting is the problem, not data loss. The disk from which I am trying to boot was bootable when I removed it from the drive, so I am surprised that it won't boot now.



Quote:
Originally Posted by JJJCR View Post
Do you mean you can't access the directories?
No. I can access everything, but because the only disk from which I can boot is a DVD or flash drive, and all my personal programs and data files are on the hard disk, they are now in /disk4/home/RandomTroll.

Quote:
Originally Posted by rnturn View Post
Booting how? LILO? Grub?
GRUB.

Quote:
Originally Posted by rnturn View Post
I read that as meaning that "/bin", "/usr", etc. are, after mounting the root partition, now seen as "/mnt/bin", "/mnt/usr", etc. (or whatever the mount point is/was). Nothing is going to work with that mess.
You read correctly.

Quote:
Originally Posted by dc.901 View Post
What is the exact issue, that will help give you proper guidance.
When system is booting (or trying to boot) from hard disk, do you see an error? You may have to press F2 to see the text.
Which OS and release?
Depending on issue, since you are able to boot to USB media and mount the hard disk, you need to backup your data first, and then figure out what is causing the issue.
Everything was already backed up. I didn't mention data loss; I have had none. I'm trying to figure out the problem. As it has been refractory, I asked if an imaginable stop-gap existed. I asked elsewhere about my boot problem. This is a separate question.

Quote:
Originally Posted by wpeckham View Post
Examine the chroot command. I see no reason why you should not boot off one drive, then use chroot to make the other drive your current root before starting any processes (or a gui desktop).
I call scripts: must I rewrite all of them to add chroot to their invocations of relocated executables?

Quote:
Originally Posted by wpeckham View Post
this is a kludge.
duh

Quote:
Originally Posted by wpeckham View Post
The more lasting option is to troubleshoot the problem, and correct whatever is causing the boot issue.
duh^2

Quote:
Originally Posted by wpeckham View Post
You might need to replace the drive and reload your OS on new hardware, but only do that if the drive itself is failing.
It passes e2fsck -fcvy . This was my root drive for years. I replaced it with a larger drive but kept it for backup, so I'm surprised that it doesn't work
 
Old 05-28-2020, 08:22 AM   #9
camorri
LQ 5k Club
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 15.0, current, slackware-arm-currnet
Posts: 6,215

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
No one has asked, and you have not stated; is this disk formatted as MBR or GPT? Is the system its in now BIOS or EFI?
 
Old 05-28-2020, 10:28 AM   #10
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,292

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Picture is slightly clearer now. I presume your system was backed up from a live usb or similar as you don't want loads of XXX in /proc, /sys/, or any of the many places it turns up

I would check (fsck -fvy) the disks, if you believe nothing major is up with them. Poorly unmounted disks can have loads of Orphaned inodes, but that cleans up nicely. Then check grub is pointing approximately in the right place and set the disk/partition as /, turn off, change the hw so it is / and try for it.

IME, it's only when the disk is badly damaged that you need the 'c' option, which takes forever.
 
Old 05-29-2020, 06:39 AM   #11
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
more clarity
You have removed the root drive from one location and installed it at another? If so, did you update grub to properly identify the new location? If not, that step may be all that is needed to make your drive boot properly.

If you use chroot to lock your session into the root of the desired drive, all scripts and processes run under that session will run in that environment. Only scripts that run from cron, at, batch, or other automation (outside that session environment) would have to be adjusted. Let us avoid that if we can. Check your grub configuration and see if you can fix that, making all of these other factors (including chroot) unnecessary.

Last edited by wpeckham; 05-29-2020 at 06:42 AM.
 
Old 05-29-2020, 10:52 AM   #12
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,292

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
In addition to the last comment, there's one niggle under chroot which stops you in odd places. Proc is absent. Toi remedy,
Code:
mount -t proc proc /proc
 
1 members found this post helpful.
Old 05-29-2020, 04:17 PM   #13
quickbreakfast
Member
 
Registered: Oct 2015
Location: northern territory
Distribution: slackware 15
Posts: 335

Rep: Reputation: Disabled
Quote:
Originally Posted by RandomTroll View Post
I'm having trouble booting off my hard disk. I can boot off a flash drive then mount the hard disk and use it without trouble,
With my recent install of Slackware I had the same problem, then I found that the root partition did not have a boot flag.

Installed a boot flag and the HDD boots problem free, so I can not help wondering if you are missing the boot flag.
 
Old 05-31-2020, 03:49 AM   #14
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,808
Blog Entries: 1

Rep: Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066
Exactly how are you setting up the chroot? I find the following typically does what I need it to do:
Code:
# mount /dev/whatever /mnt
# mount -o bind /dev /mnt/dev
# mount -o bind /proc /mnt/proc
# mount -o bind /sys /mnt/sys
# chroot /mnt
Possibly doing the same bind mount with /run might also be necessary with some of the newer systemd distros.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can not change root password from root riponnk Linux - General 4 02-11-2013 08:25 AM
[SOLVED] How can I change file permissions in windows ntfs partition.Even root can't change it e3399 Linux - Newbie 3 03-02-2011 10:54 PM
Can not change user to root with "su" or login as root anymore d1s4st3r *BSD 3 05-05-2010 07:43 AM
root files: create as root:root or root:wheel? pcass Linux - Security 1 02-07-2004 04:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration