You are not logged in.

#1 2021-09-23 07:02:13

gregory112
Member
Registered: 2017-12-11
Posts: 12

Is it possible to enable SSH access during emergency mode?

Hi,

Back then my Arch went to emergency mode due to LVM thin provisioning problems everytime I reboot. I have worked around the problem by disabling checking by setting thin_check_executable to empty string in `/etc/lvm/lvm.conf`. However, because direct access may not be possible I want to be able to SSH to the server just in case it drops into emergency mode again, due to any kind of problems. Is it possible to do this?

I tried to use systemd-tool hook, and tinyssh hook in mkinitcpio but tinyssh does not seem to be running in emergency mode. I haven't got dropbear to work though due to the its issue with SSH key format. I have also tried to add sshd to emergency.target.wants but then my network stops running in emergency mode and the server stops getting IP.


Old school undergraduate
Intel i7-4770, Motherboard MSI Z87-G45 Gaming, V-Gen DDR3 PC10600 8GB, ~10 old harddisks, Corsair CX600M PSU

Offline

#2 2021-09-23 13:59:25

seth
Member
Registered: 2012-09-03
Posts: 50,012

Re: Is it possible to enable SSH access during emergency mode?

I haven't got dropbear to work though due to the its issue with SSH key format.

/usr/bin/dropbearconvert ?
Also https://archlinux.org/packages/communit … -dropbear/

Offline

#3 2021-09-24 04:19:09

gregory112
Member
Registered: 2017-12-11
Posts: 12

Re: Is it possible to enable SSH access during emergency mode?

seth wrote:

I haven't got dropbear to work though due to the its issue with SSH key format.

/usr/bin/dropbearconvert ?
Also https://archlinux.org/packages/communit … -dropbear/

Yes, I get what you mean. I may be able to make it work with dropbear eventually but my point is, is SSH (tinyssh, dropbear, or openssh/sshd) supposed to be running on emergency mode too? If not can I make them run or that is not possible due to the nature of emergency mode?


Old school undergraduate
Intel i7-4770, Motherboard MSI Z87-G45 Gaming, V-Gen DDR3 PC10600 8GB, ~10 old harddisks, Corsair CX600M PSU

Offline

#4 2021-09-24 06:26:29

seth
Member
Registered: 2012-09-03
Posts: 50,012

Re: Is it possible to enable SSH access during emergency mode?

dropbear can (and is kinda meant) to run from the initramfs - the problem might be that you don't have network in the "emergency mode", so you'll have to establish that, too.
So you need those tools and drivers in the initramfs, see eg. https://wiki.gentoo.org/wiki/Custom_Ini … Networking

Offline

#5 2021-09-24 07:16:49

gregory112
Member
Registered: 2017-12-11
Posts: 12

Re: Is it possible to enable SSH access during emergency mode?

seth wrote:

dropbear can (and is kinda meant) to run from the initramfs - the problem might be that you don't have network in the "emergency mode", so you'll have to establish that, too.
So you need those tools and drivers in the initramfs, see eg. https://wiki.gentoo.org/wiki/Custom_Ini … Networking

I actually have. I can see that I have IP from DHCP and I can ping to it when it drops to emergency mode. But I see tinyssh not starting.
I actually saw a glimpse of a log that tinyssh was stopped before getting to emergency mode. I originally thought that the "period" where they should be active is over so systemd shut it down for openssh. My current hook is systemd and systemd-tool but I have enabled initrd-tinyssh.


Old school undergraduate
Intel i7-4770, Motherboard MSI Z87-G45 Gaming, V-Gen DDR3 PC10600 8GB, ~10 old harddisks, Corsair CX600M PSU

Offline

#6 2021-09-24 07:43:19

seth
Member
Registered: 2012-09-03
Posts: 50,012

Re: Is it possible to enable SSH access during emergency mode?

What's tinyssh's status and can you re/start the service (inside the emergency shell)?

initrd-tinyssh

you mean https://archlinux.org/packages/communit … o-tinyssh/ ?

Offline

#7 2021-09-24 07:46:29

gregory112
Member
Registered: 2017-12-11
Posts: 12

Re: Is it possible to enable SSH access during emergency mode?

I'm using this https://github.com/random-archer/mkinit … stemd-tool. It is from mkinitcpio-systemd-tool package But I guess using udev + netconf + tinyssh hooks are the same though?


Old school undergraduate
Intel i7-4770, Motherboard MSI Z87-G45 Gaming, V-Gen DDR3 PC10600 8GB, ~10 old harddisks, Corsair CX600M PSU

Offline

#8 2021-09-24 07:55:54

seth
Member
Registered: 2012-09-03
Posts: 50,012

Re: Is it possible to enable SSH access during emergency mode?

seth wrote:

What's tinyssh's status and can you re/start the service (inside the emergency shell)?

Offline

#9 2021-09-24 11:03:58

gregory112
Member
Registered: 2017-12-11
Posts: 12

Re: Is it possible to enable SSH access during emergency mode?

Back then when I tried to start the service with

systemctl start tinyssh@22

I got an error. I actually forgot the exact service name but it failed to start. It is inactive when I first got into emergency mode and get its status with systemctl status.
I am currently not able to reproduce the error as I do not have access to the server and cannot risk the server going into emergency mode now that I cannot reboot it by hand. Is there a way to force Linux to go to emergency mode so I can try it with my own laptop?


Old school undergraduate
Intel i7-4770, Motherboard MSI Z87-G45 Gaming, V-Gen DDR3 PC10600 8GB, ~10 old harddisks, Corsair CX600M PSU

Offline

#10 2021-09-24 15:18:01

seth
Member
Registered: 2012-09-03
Posts: 50,012

Re: Is it possible to enable SSH access during emergency mode?

2nd link below, "emergency.target"

Offline

Board footer

Powered by FluxBB