You are not logged in.

#1 2022-01-15 02:48:57

odror
Member
Registered: 2015-03-17
Posts: 84

Unable restart the terminal processes on VT1-VT7

Hi

I share my Nvidia GPU with a windows VM. I do that by disabling the display and converting my computer to a headless machine. Then passing through the GPU to the VM.
When I am done with the VM I restart the Display. I get  gdm and gnome shell back.

The issues that I am having is that I lost the login (getty) on VT2 though VT7

So how do I restart the login terminal on VT2 though VT7.

I tried to use the getty@ service. That did not work.

Offline

#2 2022-01-16 10:17:31

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,992
Website

Re: Unable restart the terminal processes on VT1-VT7

odror wrote:

I do that by disabling the display

Please post the exact command(s) used.

odror wrote:

I restart the Display.

Please post the exact command(s) used.

odror wrote:

I tried to use the getty@ service.

Please post the exact command(s) used.

odror wrote:

That did not work.

https://bbs.archlinux.org/viewtopic.php?id=57855

Offline

#3 2022-01-16 16:52:53

odror
Member
Registered: 2015-03-17
Posts: 84

Re: Unable restart the terminal processes on VT1-VT7

I disabling the display:

#!/bin/bash
# Stop display manager
systemctl stop display-manager.service
killall gdm-x-session

# Unbind VTconsoles
echo 0 > /sys/class/vtconsole/vtcon0/bind
echo 0 > /sys/class/vtconsole/vtcon1/bind

# Unbind EFI-Framebuffer
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind

sleep 2

# Unbind the GPU from display driver
/usr/sbin/rmmod nvidia_drm
/usr/sbin/rmmod nvidia_modeset


this was takedn and modified from https://github.com/joeknock90/Single-GPU-Passthrough
sleep 1

virsh nodedev-detach pci_0000_0f_00_0
virsh nodedev-detach pci_0000_0f_00_1

Restarting the DIsplay :

#!/bin/bash
# Re-Bind GPU to Nvidia Driver
virsh nodedev-reattach pci_0000_0f_00_1
virsh nodedev-reattach pci_0000_0f_00_0

# Reload nvidia modules
modprobe nvidia
modprobe nvidia_modeset
modprobe nvidia_uvm
modprobe nvidia_drm

# Rebind VT consoles
echo 1 > /sys/class/vtconsole/vtcon0/bind
# Some machines might have more than 1 virtual console. Add a line for each corresponding VTConsole
#echo 1 > /sys/class/vtconsole/vtcon1/bind

nvidia-xconfig --query-gpu-info > /dev/null 2>&1
echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind

# Restart Display Manager
systemctl start display-manager.service

This was taken and modified from: https://github.com/joeknock90/Single-GPU-Passthrough

Offline

#4 2022-01-16 17:01:22

odror
Member
Registered: 2015-03-17
Posts: 84

Re: Unable restart the terminal processes on VT1-VT7

I can start the VT manually for example:

sudo systemctl start getty@tty3.service

Why not all of them are restarting automatically.

Offline

#5 2022-01-16 18:29:19

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,992
Website

Re: Unable restart the terminal processes on VT1-VT7

Check the journal to see what's happening with the various getty@tty?.services.

This is just a shot in the dark but try replacing

systemctl stop display-manager.service
killall gdm-x-session

With

systemctl isolate multi-user.target

And replace

systemctl start display-manager.service

With

systemctl isolate graphical.target

Offline

#6 2022-01-16 19:38:36

odror
Member
Registered: 2015-03-17
Posts: 84

Re: Unable restart the terminal processes on VT1-VT7

There are no messages in journalctl regarding tty2-tty7

also "systemctl isolate multi-user.target" did not stop the display manager. Thus I wasn't able to passthrough the GPU

It is not clear to me how during boot the tty2-6 (or 7) are started.

if it is any of these units then why running them when restarting the display does not restore the terminals.

/usr/lib/systemd/system/console-getty.service
/usr/lib/systemd/system/container-getty@.service
/usr/lib/systemd/system/getty-pre.target
/usr/lib/systemd/system/getty@.service
/usr/lib/systemd/system/getty.target
/usr/lib/systemd/system/serial-getty@.service

Offline

#7 2022-01-16 22:30:44

seth
Member
Registered: 2012-09-03
Posts: 38,835

Re: Unable restart the terminal processes on VT1-VT7

http://0pointer.de/blog/projects/serial-console.html

n a systemd world we made this more dynamic: in order to make things more efficient login prompts are now started on demand only. As you switch to the VTs the getty service is instantiated to getty@tty2.service, getty@tty5.service and so on.

Since the autospawning is configured in logind.conf, I'd try "systemctl restart systemd-logind.service" (but idk whether that will suffice)

Offline

#8 2022-01-17 04:16:24

odror
Member
Registered: 2015-03-17
Posts: 84

Re: Unable restart the terminal processes on VT1-VT7

seth wrote:

http://0pointer.de/blog/projects/serial-console.html

Since the autospawning is configured in logind.conf, I'd try "systemctl restart systemd-logind.service" (but idk whether that will suffice)

That did not work. It actually caused a system freeze.

Offline

#9 2022-01-17 16:47:43

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,992
Website

Re: Unable restart the terminal processes on VT1-VT7

odror wrote:

"systemctl isolate multi-user.target" did not stop the display manager

Hmm, sorry. It always worked for me when I was using GNOME & GDM.

odror wrote:

It is not clear to me how during boot the tty2-6 (or 7) are started

See systemd-getty-generator(8).

Another guess: try reloading the frame buffer with

# udevadm trigger /dev/fb*

Offline

#10 2022-01-17 23:58:32

odror
Member
Registered: 2015-03-17
Posts: 84

Re: Unable restart the terminal processes on VT1-VT7

This is did not fix the issue. there is something, which is done during boot differently from what I am going now. Is there a way to restore the display/getty serviced to their state in the early boot and then redo the boot portion related to the displays/getty services. Many years ago before systemd. It was possible to go to a system state with very basic graphics (getty without X11). I do not know if it is possible with systemd.

Changing display state is important when there is a need to switch to a headless state and back.

Offline

#11 2022-01-18 06:45:59

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,992
Website

Re: Unable restart the terminal processes on VT1-VT7

This brings the TTYs back for me after I stop them manually:

# systemctl restart getty.target

Offline

#12 2022-01-21 01:38:06

odror
Member
Registered: 2015-03-17
Posts: 84

Re: Unable restart the terminal processes on VT1-VT7

That did not work either.

Offline

Board footer

Powered by FluxBB