LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Trying to set up a "clean" chroot login at console in Slackware - can't login (https://www.linuxquestions.org/questions/slackware-14/trying-to-set-up-a-clean-chroot-login-at-console-in-slackware-cant-login-4175470644/)

Eldarby 07-23-2013 01:07 PM

Trying to set up a "clean" chroot login at console in Slackware - can't login
 
Hey everyone, I'm running Slackware 14.0 and I'm trying to set up a console login for my Arch chroot. My intention is to have a "clean" login environment for the chroot. If I run chroot normally while logged in as root...
Code:

# chroot /mnt/chroot/arch /bin/bash
... it copies over my environment variables from Slackware's root login. Arch uses some different environment variables than Slackware, which is why it's very important that I don't pass any through the host environment to the chroot, and instead login in a way that will run the chroot's own /etc/profile and so forth. This would additionally give non-root users a way to login to Arch without needing to have root privileges to chroot first.

Here's where I'm stuck:

After installing Arch in a chroot and making sure to bind-mount all the necessary directories, I took a hint from this guide (as well as some other guides I found related to creating Gentoo chroots in Slackware that suggested the same thing), and added the following to my /etc/inittab:
Code:

c7:12345:respawn:/usr/bin/chroot /mnt/chroot/arch /sbin/agetty 38400 tty8 linux
I ran 'init q', hit Ctrl+F8 and sure enough there was a fresh new console login with "Arch Linux" instead of the usual "Welcome to Linux" at the top. However, when I tried logging in, I just got hit with "Login incorrect" every single time.

I was trying to login as root and I know I got my password right, after typing it several times, very slowly and deliberately, looking at the keys and everything to be sure. I even ran passwd in the chroot, set the password again, and tried again in the console login. Login incorrect. I can still login on my Slackware tty's, but this new one just doesn't seem to be taking correctly.

Do I not have the inittab configured correctly? Is there something else I need to do? I realize that guide I'm referencing is from back in 2007, so I don't know how much may have changed since then.

I'd really like to be able to benefit from Arch's selection of packages, while still having peace of mind knowing it's safely cradled under a stable Slackware installation in case anything goes horribly wrong. Any help and advice is appreciated. Oh, and before anyone suggests virtualization as an alternative, that just isn't an option -- my computer is simply too old to do that efficiently.

MasterOfMagic 07-24-2013 01:35 PM

Did you set your root password in the Arch chroot? If not then it's no surprise that your password isn't working to log into the chroot. You might also want to look at the log files to see if login is writing any errors to them. To rule out the password issue do the following from your Slackware host system:

Code:

# chroot /mnt/chroot/arch /usr/bin/passwd
This will set up root's password in the chroot and then you should be able to login.

Eldarby 07-26-2013 03:13 PM

I used the command you suggested, even set the password to "taco" to make sure I'd type it right, but it still didn't work. Then I looked in my log files, and /var/log/secure was saying this:

Code:

Jul 26 15:51:26 slackbook login: pam_securetty(login:auth): access denied: tty 'tty8' is not secure !
Jul 26 15:51:30 slackbook login: FAILED LOGIN 1 FROM tty8 FOR root, Authentication failure

I'm not quite sure what's going on here or how to fix it, but at least we've got some sort of lead on the problem now, so thank you for suggesting to look in the logs. I ran several searches in multiple search engines regarding that error but no results relevant to this issue came up. I'm still quite stuck on what to do next. Any ideas?

guanx 07-26-2013 05:53 PM

"tty 'tty8' is not secure" means tty8 is not in /etc/securetty

For details please do a web search.

Eldarby 07-28-2013 09:35 AM

I see, now I understand what's happening, thank you.

<EDIT> There was a bit of a rant against search engines here earlier, but I'll just stick that in a blog or something later. It doesn't really belong here. </EDIT>

Anyway, I managed to solve the problem!

I ultimately decided I didn't really need an eighth tty anyway, so instead of adding tty8 to /etc/securetty, I removed the line I originally added to /etc/inittab and changed the c6 line to read:
Code:

c6:12345:respawn:/usr/bin/chroot /mnt/chroot/arch /sbin/agetty 38400 tty6 linux
After rebooting (since tty6 was already spawned by Slackware last boot), I was able to successfully login to my chroot through tty6. Thank you and MasterOfMagic for helping me through this tangled web of confusion.


All times are GMT -5. The time now is 07:30 PM.