[PATCH] Fix console for s390 and 'noshell' mode (#1070672)

Samantha N. Bueno sbueno+anaconda at redhat.com
Fri Feb 28 18:44:34 UTC 2014


We agonized over this in irc, but so it's noted somewhere.... comments
inline.

On Thu, Feb 27, 2014 at 05:50:05PM -0500, Will Woods wrote:
> So the way sshd installs work, we actually do need to run tmux on s390 -
> when the user connects to the system, it'll attach them to the existing
> tmux session.
> 
> Relatedly, we also actually need to use tmux when in 'noshell' mode,
> because anaconda-direct.service doesn't allow any input from stdin, so
> e.g. you can't answer the VNC question.
> 
> So: instead of disabling tmux for noshell or s390x, we should do the
> following:
> 
> 1) Start anaconda inside a detached tmux session
> 2) If "noshell", lock down tmux (close the shell, disallow new windows)
> 3) If s390x, run anaconda-direct.service like usual
> 
> This commit also silences an error message about the missing 'null' in
> anaconda-direct.service.
> ---
>  data/systemd/Makefile.am              |  1 +
>  data/systemd/anaconda-direct.service  |  7 +------
>  data/systemd/anaconda-noshell.service | 18 ++++++++++++++++++
>  data/systemd/anaconda-tmux at .service   |  4 ++--
>  data/systemd/anaconda.service         |  3 +--
>  5 files changed, 23 insertions(+), 10 deletions(-)
>  create mode 100644 data/systemd/anaconda-noshell.service
> 
> diff --git a/data/systemd/Makefile.am b/data/systemd/Makefile.am
> index 2c4e692..d27ba2f 100644
> --- a/data/systemd/Makefile.am
> +++ b/data/systemd/Makefile.am
> @@ -21,6 +21,7 @@ systemddir = $(prefix)/lib/systemd/system
>  generatordir = $(prefix)/lib/systemd/system-generators
>  
>  dist_systemd_DATA = anaconda.service \
> +		    anaconda-noshell.service \
>  		    anaconda-direct.service \
>  		    anaconda.target \
>  		    anaconda-tmux at .service \
> diff --git a/data/systemd/anaconda-direct.service b/data/systemd/anaconda-direct.service
> index b4c1f2f..9bf172a 100644
> --- a/data/systemd/anaconda-direct.service
> +++ b/data/systemd/anaconda-direct.service
> @@ -1,6 +1,3 @@
> -[Install]
> -WantedBy=anaconda.target
> -
>  [Unit]
>  Description=the anaconda installation program
>  Wants=instperf.service rsyslog.service systemd-udev-settle.service NetworkManager.service
> @@ -8,15 +5,13 @@ After=instperf.service rsyslog.service systemd-udev-settle.service NetworkManage
>  Requires=anaconda.service
>  # TODO: use ConditionArchitecture in systemd v210 or later
>  ConditionPathIsDirectory=|/sys/hypervisor/s390
> -ConditionKernelCommandLine=|noshell
> -ConditionKernelCommandLine=|inst.noshell
>  
>  [Service]
>  Environment=HOME=/root MALLOC_CHECK_=2 MALLOC_PERTURB_=204 PATH=/usr/bin:/bin:/sbin:/usr
>  Type=oneshot
>  WorkingDirectory=/root
>  ExecStart=/usr/sbin/anaconda
> -StandardInput=
> +StandardInput=null
>  StandardOutput=journal+console
>  StandardError=journal+console
>  TimeoutSec=0
> diff --git a/data/systemd/anaconda-noshell.service b/data/systemd/anaconda-noshell.service
> new file mode 100644
> index 0000000..a57af39
> --- /dev/null
> +++ b/data/systemd/anaconda-noshell.service
> @@ -0,0 +1,18 @@
> +[Unit]
> +Description=Restrict Anaconda Text Console
> +After=anaconda.service
> +Before=anaconda-tmux at .service anaconda-sshd.service

With this line, there's a dependency problem in the systemd services
since anaconda-sshd.service starts before anaconda-target, which starts
before anaconda.service.

anaconda-noshell.service is *after* anaconda.service though, but says
before anaconda-sshd.service.

With this in place, it renders one completely unable to ssh into an
s390x machine at all. (It's a testament to how much crap I have in my
repo dir that I didn't even notice I hadn't added this new file to get
built into my updates.img when I tested initially.)

Anyway, change it to:
Before=anaconda-tmux at .service

And s390x is happy, inst.noshell still functions on x86_64, and ack.

Samantha

> +ConditionKernelCommandLine=|inst.noshell
> +ConditionKernelCommandLine=|noshell
> +
> +[Service]
> +Type=oneshot
> +WorkingDirectory=/root
> +ExecStart=/usr/bin/tmux unbind-key -a; \
> +                        kill-window -t anaconda:shell; \
> +                        bind-key 1 select-window -t :1; \
> +                        bind-key 2 select-window -t :2; \
> +                        bind-key 3 select-window -t :3; \
> +                        bind-key 4 select-window -t :4; \
> +                        bind-key 5 select-window -t :5; \
> +                        bind-key ? list-keys
> diff --git a/data/systemd/anaconda-tmux at .service b/data/systemd/anaconda-tmux at .service
> index 6a3f58d..e2fd1b8 100644
> --- a/data/systemd/anaconda-tmux at .service
> +++ b/data/systemd/anaconda-tmux at .service
> @@ -2,8 +2,8 @@
>  Description=Anaconda Text Console
>  Requires=anaconda.service
>  After=anaconda.target anaconda.service
> -ConditionKernelCommandLine=!noshell
> -ConditionKernelCommandLine=!inst.noshell
> +# TODO: use ConditionArchitecture in systemd v210 or later
> +ConditionPathIsDirectory=!/sys/hypervisor/s390
>  
>  [Service]
>  Type=idle
> diff --git a/data/systemd/anaconda.service b/data/systemd/anaconda.service
> index e6104b0..a70528b 100644
> --- a/data/systemd/anaconda.service
> +++ b/data/systemd/anaconda.service
> @@ -1,8 +1,7 @@
>  [Unit]
>  Description=Anaconda
>  After=anaconda.target
> -ConditionKernelCommandLine=!noshell
> -ConditionKernelCommandLine=!inst.noshell
> +Wants=anaconda-noshell.service
>  
>  [Service]
>  Type=forking
> -- 
> 1.8.5.3
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches


More information about the anaconda-patches mailing list