Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
225-day installation attempt finally fails
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1633

PostPosted: Mon Aug 24, 2020 8:55 am    Post subject: Reply with quote

I have actually made a significant breakthrough. For some reason, I attempted to plug the device containing the key into a different USB port (this machine has all black USB ports, with the only determining feature the (extremely small) letters "ss" appearing on the exterior of the machine). I couldn't complete the boot (I have some other problem with the init script in the initramfs that I need to track down), but I wonder if anyone has suggestions on how to get all of the USB ports working.

I already tried one thing. From:

https://wiki.gentoo.org/wiki/Kernel/Gentoo_Kernel_Configuration_Guide

Quote:

Most systems come with two of the above interface types: XHCI (USB 3.0) and EHCI (USB 2.0). To use USB devices, it is no longer necessary to select both options since XHCI is compatible with slower USB-controllers. Users can also enable EHCI to be "extra" safe; it does no harm if USB 2.0 controllers are unavailable.


Didn't work for me. With CONFIG_USB_EHCI_HCD unset, the USB 2 ports no longer work (AND inserting anything into a USB 3 port still locks the system up immediately).
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 4142
Location: Illinois, USA

PostPosted: Mon Aug 24, 2020 2:56 pm    Post subject: Reply with quote

Code:
~ $ zgrep HCI /proc/config.gz |grep -v ^#
CONFIG_SATA_AHCI=y
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_USB_XHCI_HCD=m
CONFIG_USB_XHCI_PCI=m
CONFIG_USB_EHCI_HCD=m
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_TT_NEWSCHED=y
CONFIG_USB_EHCI_PCI=m
CONFIG_USB_EHCI_FSL=m
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PCI=y
CONFIG_USB_UHCI_HCD=m
CONFIG_MMC_CQHCI=y

Enable them all. God will know his own.
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1633

PostPosted: Tue Aug 25, 2020 12:06 am    Post subject: Reply with quote

Tony0945 wrote:
Code:
~ $ zgrep HCI /proc/config.gz |grep -v ^#
CONFIG_SATA_AHCI=y
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_USB_XHCI_HCD=m
CONFIG_USB_XHCI_PCI=m
CONFIG_USB_EHCI_HCD=m
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_TT_NEWSCHED=y
CONFIG_USB_EHCI_PCI=m
CONFIG_USB_EHCI_FSL=m
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PCI=y
CONFIG_USB_UHCI_HCD=m
CONFIG_MMC_CQHCI=y

Enable them all. God will know his own.


I *do* have them all enabled.

Code:

# grep HCI .config |grep -v ^#
CONFIG_SATA_AHCI=y
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DBGCAP=y
CONFIG_USB_XHCI_PCI=y
CONFIG_USB_XHCI_PLATFORM=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_TT_NEWSCHED=y
CONFIG_USB_EHCI_PCI=y
CONFIG_USB_EHCI_FSL=y
CONFIG_USB_EHCI_HCD_PLATFORM=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PCI=y
CONFIG_USB_UHCI_HCD=y
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1633

PostPosted: Wed Aug 26, 2020 12:13 am    Post subject: Reply with quote

Any ideas on fixing the crashes that occur whenever I plug anything into a USB 3 port? Should I repost this to the Kernel and Hardware forum?
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 4142
Location: Illinois, USA

PostPosted: Wed Aug 26, 2020 2:35 am    Post subject: Reply with quote

curmudgeon wrote:

I *do* have them all enabled.

But not as modules. The modules won't load if the hardware isn't there. Built-ins are, well, built in. There could be conflicts make everything a module that you can.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6722

PostPosted: Wed Aug 26, 2020 3:21 am    Post subject: Reply with quote

Here's something to try: stop udevd (make sure to kill the process too, stopping it from openrc won't do that) then plug the USB device in. Maybe a udev rule is causing the crash.
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1633

PostPosted: Wed Aug 26, 2020 2:00 pm    Post subject: Reply with quote

Ant P. wrote:
Here's something to try: stop udevd (make sure to kill the process too, stopping it from openrc won't do that) then plug the USB device in. Maybe a udev rule is causing the crash.


I failed to see the obvious reason that no relationship exists between udev and the crashes (udev does not run when the initramfs has control of the system, and the crashes still occur then), before I tried (as you suggested) disabling udevd (with no effect). In my case, killing udev via openrc did indeed kill the process (I checked both before and after).


Tony0945 wrote:
curmudgeon wrote:

I *do* have them all enabled.

But not as modules. The modules won't load if the hardware isn't there. Built-ins are, well, built in. There could be conflicts make everything a module that you can.


This kernel will eventually end up (assuming I can ever get the machine working) without support for loadable modules. Nevertheless, I did (for testing) make everything that I could a module except for CONFIG_USB_EHCI_HCD (which I need to even attempt to boot). It made no difference.


My other remaining problems consists of errors attempting to read the password for the key file.

The aescrypt program (in the initramfs) spits out "Error in read_password: fopen(). Nothing to read on input." When I go to the shell, I get "sh: can't access tty: job control turned off" (and the tty command shows "not a tty"). I do have both console and tty in /dev (before mounting devtmpfs). Any ideas why the program can't get read any input?

Updated to add. The file aescrypt-3.0.6b/password.c contains this:

Code:

/*
 *  read_password_error
 *
 *  Returns the description of the error when reading the password.
 */
const char* read_password_error(int error)
{
    if (error == AESCRYPT_READPWD_FOPEN)
        return "fopen()";
    if (error == AESCRYPT_READPWD_FILENO)
        return "fileno()";
    if (error == AESCRYPT_READPWD_TCGETATTR)
        return "tcgetattr()";
    if (error == AESCRYPT_READPWD_TCSETATTR)
        return "tcsetattr()";
    if (error == AESCRYPT_READPWD_FGETC)
        return "fgetc()";
    if (error == AESCRYPT_READPWD_TOOLONG)
        return "password too long";
    if (error == AESCRYPT_READPWD_NOMATCH)
        return "passwords don't match";
    return "No valid error code specified!!!";
}

/*
 *  read_password
 *
 *  This function reads at most 'MAX_PASSWD_LEN'-1 characters
 *  from the TTY with echo disabled, putting them in 'buffer'.
 *  'buffer' MUST BE ALREADY ALLOCATED!!!
 *  When mode is ENC the function requests password confirmation.
 *
 *  Return value:
 *    >= 0 the password length (0 if empty password is in input)
 *    < 0 error (return value indicating the specific error)
 */

int read_password(unsigned char* buffer, encryptmode_t mode)
{
    struct termios t;                   // Used to set ECHO attribute
    int echo_enabled;                   // Was echo enabled?
    int tty;                            // File descriptor for tty
    FILE* ftty;                         // File for tty
    unsigned char pwd_confirm[MAX_PASSWD_BUF];
                                        // Used for password confirmation
    int c;                              // Character read from input
    int chars_read;                     // Chars read from input
    unsigned char* p;                   // Password buffer pointer
    int i;                              // Loop counter
    int match;                          // Do the two passwords match?

    // Open the tty
    ftty = fopen("/dev/tty", "r+");
    if (ftty == NULL)
    {
        return AESCRYPT_READPWD_FOPEN;
    }
    tty = fileno(ftty);
    if (tty < 0)
    {
        return AESCRYPT_READPWD_FILENO;
    }
 
    // Get the tty attrs
    if (tcgetattr(tty, &t) < 0)
    {
        fclose(ftty);
        return AESCRYPT_READPWD_TCGETATTR;
    }

[...]



Shound the console prompting for the password have /dev/tty attached to it (I don't really understand much about that at all)?

Thank you again.
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1633

PostPosted: Fri Aug 28, 2020 3:52 pm    Post subject: Reply with quote

Any ideas about what could cause the password prompt to fail (as described above). I would expect than someone has seen something similar before. :)
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1633

PostPosted: Sun Sep 27, 2020 4:42 pm    Post subject: Reply with quote

It pleases me to report that this installation has successfully concluded after 263 days.

I needed the following command in the init script within the initramfs to prompt for and read the pass phrase to unlock the key file.

Code:

setsid cttyhack sh -c "/bin/aescrypt -d /mnt/key_drive/key.aes -o - | /sbin/cryptsetup --key-file - luksOpen /dev/sda2 mapname"


According to this page, I possibly could have used respawn or exec, as well (enlightenment accepted on positive or negative reasons for either of those choices).

https://raw.githubusercontent.com/brgl/busybox/master/shell/cttyhack.c

The comments at the top of the code suggest a preference for using an actual tty, but give no indication as to how to get a program such as to use one.


Anyway, I have gone from having as simple as possible grub.cfg files on my bios machines to the simplest possible efi partition on the efi machine.

The grub.cfg (yes, version 2) on my old machine:

Code:

set default=0
set timeout=30
set root=(hd0,5)

menuentry 'Gentoo Linux 5.4.66' {
    linux /bzImage-5.4.66-gentoo root=/dev/sda6
}


My "efi partition" on the new machine contains only two files: System.map-5.4.66-gentoo and bzImage-5.4.66-gentoo.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum