[arch-releng] [RFC] [archiso] Use a pure systemd enviroment
* rewrite automatic_script to work with systemd or completelly in automatic login shell. * research how to avoid systemd to stop archiso mounted filesystem and leave all the work to our special shutdown script in initramfs (just works, but shows lots of resource busy at shutdown)
The only way to do this from systemd is via setting "@" in argv[0][0] [#1] nbd-client does not support this at this moment, but doing via dirty hack: just install nbd-client as @nbd-client in initramfs image ;) PS: I will ask to nbd author, to support it via some switch. [#1] http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- Makefile | 2 -- archiso/archiso_pxe_nbd | 6 ------ archiso/archiso_shutdown | 4 ++-- archiso/hooks/archiso_pxe_nbd | 10 +++------- archiso/install/archiso_pxe_nbd | 4 +--- configs/releng/build.sh | 1 - 6 files changed, 6 insertions(+), 21 deletions(-) delete mode 100644 archiso/archiso_pxe_nbd diff --git a/Makefile b/Makefile index 309f890..cb5ec1d 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,6 @@ install-hooks: install -D -m 755 archiso/archiso_shutdown $(DESTDIR)/usr/lib/initcpio/archiso_shutdown install -D -m 644 archiso/hooks/archiso_shutdown $(DESTDIR)/usr/lib/initcpio/hooks/archiso_shutdown install -D -m 644 archiso/install/archiso_shutdown $(DESTDIR)/usr/lib/initcpio/install/archiso_shutdown - install -D -m 644 archiso/archiso_pxe_nbd $(DESTDIR)/usr/lib/initcpio/archiso_pxe_nbd install -D -m 644 archiso/hooks/archiso_pxe_common $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_common install -D -m 644 archiso/install/archiso_pxe_common $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_common install -D -m 644 archiso/hooks/archiso_pxe_nbd $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nbd @@ -42,7 +41,6 @@ uninstall: rm -f $(DESTDIR)/usr/lib/initcpio/archiso_shutdown rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_shutdown rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_shutdown - rm -f $(DESTDIR)/usr/lib/initcpio/archiso_pxe_nbd rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_common rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_common rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nbd diff --git a/archiso/archiso_pxe_nbd b/archiso/archiso_pxe_nbd deleted file mode 100644 index e6b9872..0000000 --- a/archiso/archiso_pxe_nbd +++ /dev/null @@ -1,6 +0,0 @@ -omit_kill_nbd_client() { - add_omit_pids $(< /run/archiso/nbd_client.pid) -} - -add_hook shutdown_prekillall omit_kill_nbd_client -add_hook single_prekillall omit_kill_nbd_client diff --git a/archiso/archiso_shutdown b/archiso/archiso_shutdown index 85cce59..b252c16 100644 --- a/archiso/archiso_shutdown +++ b/archiso/archiso_shutdown @@ -27,8 +27,8 @@ if [[ ! -d /oldrun/archiso/copytoram ]]; then else umount /oldrun/archiso/bootmnt fi - if [[ -f /oldrun/archiso/nbd_client.pid ]]; then - nbd-client -d /dev/nbd0 + if @nbd-client -c /dev/nbd0; then + @nbd-client -d /dev/nbd0 fi fi diff --git a/archiso/hooks/archiso_pxe_nbd b/archiso/hooks/archiso_pxe_nbd index 6147d06..6c81459 100644 --- a/archiso/hooks/archiso_pxe_nbd +++ b/archiso/hooks/archiso_pxe_nbd @@ -25,9 +25,9 @@ archiso_pxe_nbd_mount_handler () { msg ":: Setup NBD from ${archiso_nbd_srv} at /dev/nbd0" if [[ "${copytoram}" = "y" ]]; then - nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0 + @nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0 else - nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0 -persist + @nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0 -persist fi archisodevice=/dev/nbd0 @@ -36,10 +36,6 @@ archiso_pxe_nbd_mount_handler () { if [[ "${copytoram}" = "y" ]]; then msg ":: Disconnect NBD from ${archiso_nbd_srv} at /dev/nbd0" - nbd-client -d /dev/nbd0 - else - mkdir -p /run/archiso - pidof nbd-client > /run/archiso/nbd_client.pid - cp /archiso_pxe_nbd ${newroot}/etc/rc.d/functions.d/ + @nbd-client -d /dev/nbd0 fi } diff --git a/archiso/install/archiso_pxe_nbd b/archiso/install/archiso_pxe_nbd index 8d9552a..55adba4 100644 --- a/archiso/install/archiso_pxe_nbd +++ b/archiso/install/archiso_pxe_nbd @@ -5,9 +5,7 @@ build() { add_runscript - add_binary nbd-client - - add_file /usr/lib/initcpio/archiso_pxe_nbd /archiso_pxe_nbd + add_binary nbd-client /usr/bin/@nbd-client } help() { diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 795f217..7aad14e 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -43,7 +43,6 @@ make_setup_mkinitcpio() { done cp /usr/lib/initcpio/install/archiso_kms ${work_dir}/root-image/usr/lib/initcpio/install cp /usr/lib/initcpio/archiso_shutdown ${work_dir}/root-image/usr/lib/initcpio - cp /usr/lib/initcpio/archiso_pxe_nbd ${work_dir}/root-image/usr/lib/initcpio cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf : > ${work_dir}/build.${FUNCNAME} fi -- 1.7.11.5
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- .../root-image/usr/lib/systemd/system/pacman-init.service | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 configs/releng/root-image/usr/lib/systemd/system/pacman-init.service diff --git a/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service b/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service new file mode 100644 index 0000000..58a9271 --- /dev/null +++ b/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Initializes Pacman keyring +Wants=haveged.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/pacman-key --init +ExecStart=/usr/bin/pacman-key --populate archlinux +ExecStop=/bin/rm -rf /etc/pacman.d/gnupg + +[Install] +WantedBy=multi-user.target -- 1.7.11.5
On Sun, Aug 19, 2012 at 12:57:17AM -0300, Gerardo Exequiel Pozzi wrote:
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- .../root-image/usr/lib/systemd/system/pacman-init.service | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 configs/releng/root-image/usr/lib/systemd/system/pacman-init.service
diff --git a/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service b/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service new file mode 100644 index 0000000..58a9271 --- /dev/null +++ b/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Initializes Pacman keyring +Wants=haveged.service
There should be an 'After=haveged.service' here as well
+ +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/pacman-key --init +ExecStart=/usr/bin/pacman-key --populate archlinux +ExecStop=/bin/rm -rf /etc/pacman.d/gnupg + +[Install] +WantedBy=multi-user.target -- 1.7.11.5
On 08/19/2012 01:11 AM, Dave Reisner wrote:
On Sun, Aug 19, 2012 at 12:57:17AM -0300, Gerardo Exequiel Pozzi wrote:
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- .../root-image/usr/lib/systemd/system/pacman-init.service | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 configs/releng/root-image/usr/lib/systemd/system/pacman-init.service
diff --git a/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service b/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service new file mode 100644 index 0000000..58a9271 --- /dev/null +++ b/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Initializes Pacman keyring +Wants=haveged.service There should be an 'After=haveged.service' here as well OK thank you, this was my first unit :P
+ +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/pacman-key --init +ExecStart=/usr/bin/pacman-key --populate archlinux +ExecStop=/bin/rm -rf /etc/pacman.d/gnupg + +[Install] +WantedBy=multi-user.target -- 1.7.11.5
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
On 08/19/2012 01:23 AM, Gerardo Exequiel Pozzi wrote:
On 08/19/2012 01:11 AM, Dave Reisner wrote:
On Sun, Aug 19, 2012 at 12:57:17AM -0300, Gerardo Exequiel Pozzi wrote:
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- .../root-image/usr/lib/systemd/system/pacman-init.service | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 configs/releng/root-image/usr/lib/systemd/system/pacman-init.service
diff --git a/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service b/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service new file mode 100644 index 0000000..58a9271 --- /dev/null +++ b/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Initializes Pacman keyring +Wants=haveged.service There should be an 'After=haveged.service' here as well OK thank you, this was my first unit :P
Maybe can be a good idea to start also after ntpd ? to ensure that time on machine is right...
+ +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/pacman-key --init +ExecStart=/usr/bin/pacman-key --populate archlinux +ExecStop=/bin/rm -rf /etc/pacman.d/gnupg + +[Install] +WantedBy=multi-user.target -- 1.7.11.5
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
On Sun, Aug 19, 2012 at 01:33:09AM -0300, Gerardo Exequiel Pozzi wrote:
On 08/19/2012 01:23 AM, Gerardo Exequiel Pozzi wrote:
On 08/19/2012 01:11 AM, Dave Reisner wrote:
On Sun, Aug 19, 2012 at 12:57:17AM -0300, Gerardo Exequiel Pozzi wrote:
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- .../root-image/usr/lib/systemd/system/pacman-init.service | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 configs/releng/root-image/usr/lib/systemd/system/pacman-init.service
diff --git a/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service b/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service new file mode 100644 index 0000000..58a9271 --- /dev/null +++ b/configs/releng/root-image/usr/lib/systemd/system/pacman-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Initializes Pacman keyring +Wants=haveged.service There should be an 'After=haveged.service' here as well OK thank you, this was my first unit :P
Maybe can be a good idea to start also after ntpd ? to ensure that time on machine is right...
Sure, imo the Wants should be Requires for haveged.service in pacman-init.service, and there should only be a Wants for ntpd.service in haveged.service. FYI: The difference between Wants and Requires is that a failure of a wanted unit to start won't prevent the unit with the dependency from starting. ntpd might not start properly if the network doesn't come up, and there's a bunch of reasons that might not happen. Still, the clock could be correct without the aid of ntpd running. d
+ +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/pacman-key --init +ExecStart=/usr/bin/pacman-key --populate archlinux +ExecStop=/bin/rm -rf /etc/pacman.d/gnupg + +[Install] +WantedBy=multi-user.target -- 1.7.11.5
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
Also makes a custom autologin unit. Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- configs/releng/build.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 7aad14e..eb0e5b4 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -150,6 +150,9 @@ make_customize_root_image() { sed -i "s/#Server/Server/g" ${work_dir}/root-image/etc/pacman.d/mirrorlist patch ${work_dir}/root-image/usr/bin/pacman-key < ${script_path}/pacman-key-4.0.3_unattended-keyring-init.patch sed -i 's/#\(en_US\.UTF-8\)/\1/' ${work_dir}/root-image/etc/locale.gen + sed 's#\(^ExecStart=-/sbin/agetty\)#\1 --autologin root#; + s#\(^Restart=\).\+$#\1no#' \ + /usr/lib/systemd/system/getty@.service > ${work_dir}/root-image/etc/systemd/system/autologin@.service mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \ -r 'locale-gen' \ run @@ -159,6 +162,9 @@ make_customize_root_image() { mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \ -r 'useradd -m -p "" -g users -G "audio,disk,optical,wheel" -s /bin/zsh arch' \ run + mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \ + -r 'systemctl -f enable haveged.service pacman-init.service autologin@.service dhcpcd@eth0.service || true' \ + run : > ${work_dir}/build.${FUNCNAME} fi } -- 1.7.11.5
--- configs/releng/build.sh | 8 ++++++++ configs/releng/packages.i686 | 1 - configs/releng/packages.x86_64 | 1 - 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configs/releng/build.sh b/configs/releng/build.sh index eb0e5b4..342920d 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -26,6 +26,14 @@ setup_workdir() { make_basefs() { mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" init mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" -p "memtest86+ mkinitcpio-nfs-utils nbd curl" install + + # Install systemd in this way until hits {base} group + mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \ + -r 'pacman -R --noconfirm --noprogressbar initscripts sysvinit' \ + run + mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \ + -p "systemd systemd-sysvcompat" \ + install } # Additional packages (root-image) diff --git a/configs/releng/packages.i686 b/configs/releng/packages.i686 index 3d30971..9bee336 100644 --- a/configs/releng/packages.i686 +++ b/configs/releng/packages.i686 @@ -41,7 +41,6 @@ rp-pppoe rsync smartmontools speedtouch -systemd tcpdump usb_modeswitch vpnc diff --git a/configs/releng/packages.x86_64 b/configs/releng/packages.x86_64 index 76d0854..bffece4 100644 --- a/configs/releng/packages.x86_64 +++ b/configs/releng/packages.x86_64 @@ -42,7 +42,6 @@ rp-pppoe rsync smartmontools speedtouch -systemd tcpdump usb_modeswitch vpnc -- 1.7.11.5
On Sun, Aug 19, 2012 at 12:57:19AM -0300, Gerardo Exequiel Pozzi wrote:
---
What I don't notice in this patchset (unless I'm blind) is evidence of actually adding the symlinks for the services. You probably want something like the below to mimic what's current on the sysvinit archiso: etc/systemd/system/ ├── multi-user.target.wants │ ├── dhcpcd@eth0.service -> /usr/lib/systemd/system/dhcpcd@.service │ ├── haveged.service -> /usr/lib/systemd/system/haveged.service │ ├── ntpd.service -> /usr/lib/systemd/system/ntpd.service │ └── pacman-keyring.service -> /etc/systemd/system/pacman-keyring.service └── pacman-keyring.service
configs/releng/build.sh | 8 ++++++++ configs/releng/packages.i686 | 1 - configs/releng/packages.x86_64 | 1 - 3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/configs/releng/build.sh b/configs/releng/build.sh index eb0e5b4..342920d 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -26,6 +26,14 @@ setup_workdir() { make_basefs() { mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" init mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" -p "memtest86+ mkinitcpio-nfs-utils nbd curl" install + + # Install systemd in this way until hits {base} group + mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \ + -r 'pacman -R --noconfirm --noprogressbar initscripts sysvinit' \ + run + mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \ + -p "systemd systemd-sysvcompat" \ + install }
# Additional packages (root-image) diff --git a/configs/releng/packages.i686 b/configs/releng/packages.i686 index 3d30971..9bee336 100644 --- a/configs/releng/packages.i686 +++ b/configs/releng/packages.i686 @@ -41,7 +41,6 @@ rp-pppoe rsync smartmontools speedtouch -systemd tcpdump usb_modeswitch vpnc diff --git a/configs/releng/packages.x86_64 b/configs/releng/packages.x86_64 index 76d0854..bffece4 100644 --- a/configs/releng/packages.x86_64 +++ b/configs/releng/packages.x86_64 @@ -42,7 +42,6 @@ rp-pppoe rsync smartmontools speedtouch -systemd tcpdump usb_modeswitch vpnc -- 1.7.11.5
On 08/19/2012 01:14 AM, Dave Reisner wrote:
On Sun, Aug 19, 2012 at 12:57:19AM -0300, Gerardo Exequiel Pozzi wrote:
--- What I don't notice in this patchset (unless I'm blind) is evidence of actually adding the symlinks for the services. You probably want something like the below to mimic what's current on the sysvinit archiso:
etc/systemd/system/ ├── multi-user.target.wants │ ├── dhcpcd@eth0.service -> /usr/lib/systemd/system/dhcpcd@.service │ ├── haveged.service -> /usr/lib/systemd/system/haveged.service │ ├── ntpd.service -> /usr/lib/systemd/system/ntpd.service │ └── pacman-keyring.service -> /etc/systemd/system/pacman-keyring.service └── pacman-keyring.service
look at PATCH 3/5
configs/releng/build.sh | 8 ++++++++ configs/releng/packages.i686 | 1 - configs/releng/packages.x86_64 | 1 - 3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/configs/releng/build.sh b/configs/releng/build.sh index eb0e5b4..342920d 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -26,6 +26,14 @@ setup_workdir() { make_basefs() { mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" init mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" -p "memtest86+ mkinitcpio-nfs-utils nbd curl" install + + # Install systemd in this way until hits {base} group + mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \ + -r 'pacman -R --noconfirm --noprogressbar initscripts sysvinit' \ + run + mkarchiso ${verbose} -w "${work_dir}" -C "${pacman_conf}" -D "${install_dir}" \ + -p "systemd systemd-sysvcompat" \ + install }
# Additional packages (root-image) diff --git a/configs/releng/packages.i686 b/configs/releng/packages.i686 index 3d30971..9bee336 100644 --- a/configs/releng/packages.i686 +++ b/configs/releng/packages.i686 @@ -41,7 +41,6 @@ rp-pppoe rsync smartmontools speedtouch -systemd tcpdump usb_modeswitch vpnc diff --git a/configs/releng/packages.x86_64 b/configs/releng/packages.x86_64 index 76d0854..bffece4 100644 --- a/configs/releng/packages.x86_64 +++ b/configs/releng/packages.x86_64 @@ -42,7 +42,6 @@ rp-pppoe rsync smartmontools speedtouch -systemd tcpdump usb_modeswitch vpnc -- 1.7.11.5
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
--- configs/releng/root-image/etc/archiso/functions | 20 --------- configs/releng/root-image/etc/inittab | 48 ---------------------- configs/releng/root-image/etc/rc.conf | 23 ----------- .../etc/rc.d/functions.d/automated_script | 23 ----------- .../etc/rc.d/functions.d/setup_special_console | 25 ----------- configs/releng/root-image/etc/rc.d/pacman-init | 34 --------------- 6 files changed, 173 deletions(-) delete mode 100644 configs/releng/root-image/etc/archiso/functions delete mode 100644 configs/releng/root-image/etc/inittab delete mode 100644 configs/releng/root-image/etc/rc.conf delete mode 100644 configs/releng/root-image/etc/rc.d/functions.d/automated_script delete mode 100644 configs/releng/root-image/etc/rc.d/functions.d/setup_special_console delete mode 100755 configs/releng/root-image/etc/rc.d/pacman-init diff --git a/configs/releng/root-image/etc/archiso/functions b/configs/releng/root-image/etc/archiso/functions deleted file mode 100644 index 9fffdcb..0000000 --- a/configs/releng/root-image/etc/archiso/functions +++ /dev/null @@ -1,20 +0,0 @@ -# vim: set ft=sh: - -# kernel_cmdline <param> <default> -# Looks for a parameter on the kernel's boot-time command line. -# -# returns: 0 if param was found. Also prints its value if it was a K=V param. -# 1 if it was not. Also prints value passed as <default> -# -kernel_cmdline () -{ - for param in $(/bin/cat /proc/cmdline); do - case "${param}" in - $1=*) echo "${param##*=}"; return 0 ;; - $1) return 0 ;; - *) continue ;; - esac - done - [ -n "${2}" ] && echo "${2}" - return 1 -} diff --git a/configs/releng/root-image/etc/inittab b/configs/releng/root-image/etc/inittab deleted file mode 100644 index e3fe2c8..0000000 --- a/configs/releng/root-image/etc/inittab +++ /dev/null @@ -1,48 +0,0 @@ -# -# /etc/inittab -# - -# Runlevels: -# 0 Halt -# 1(S) Single-user -# 2 Not used -# 3 Multi-user -# 4 Not used -# 5 X11 -# 6 Reboot - -## Only one of the following two lines can be uncommented! -# Boot to console -id:3:initdefault: -# Boot to X11 -#id:5:initdefault: - -rc::sysinit:/etc/rc.sysinit -rs:S1:wait:/etc/rc.single -rm:2345:wait:/etc/rc.multi -rh:06:wait:/etc/rc.shutdown -su:S:wait:/sbin/sulogin -p - -# -8 options fixes umlauts problem on login -c1:2345:respawn:/sbin/agetty -8 -s -a root 38400 tty1 linux -c2:2345:respawn:/sbin/agetty -8 -s 38400 tty2 linux -c3:2345:respawn:/sbin/agetty -8 -s 38400 tty3 linux -c4:2345:respawn:/sbin/agetty -8 -s 38400 tty4 linux -c5:2345:respawn:/sbin/agetty -8 -s 38400 tty5 linux -c6:2345:respawn:/sbin/agetty -8 -s 38400 tty6 linux - -# Serial Virtual Console for KVM and others VMs -#s0:2345:respawn:/sbin/agetty -8 -s 9600 ttyS0 linux - -# Hypervisor Virtual Console for Xen and KVM -#h0:2345:respawn:/sbin/agetty -8 -s 38400 hvc0 linux - -ca::ctrlaltdel:/sbin/shutdown -t3 -r now - -# Example lines for starting a login manager -x:5:respawn:/usr/bin/xdm -nodaemon -#x:5:respawn:/usr/sbin/gdm -nodaemon -#x:5:respawn:/usr/bin/kdm -nodaemon -#x:5:respawn:/usr/bin/slim >/dev/null 2>&1 - -# End of file diff --git a/configs/releng/root-image/etc/rc.conf b/configs/releng/root-image/etc/rc.conf deleted file mode 100644 index a2e6ebf..0000000 --- a/configs/releng/root-image/etc/rc.conf +++ /dev/null @@ -1,23 +0,0 @@ -. /etc/archiso/functions -# -# /etc/rc.conf - configuration file for initscripts -# -# Most of rc.conf has been replaced by various other configuration -# files. See archlinux(7) for details. -# -# For more details on rc.conf see rc.conf(5). -# - -DAEMONS=(syslog-ng network haveged pacman-init) - -# Storage -# -# USEDMRAID="no" -# USELVM="no" - -# Network -# -# interface= -# address= -# netmask= -# gateway= diff --git a/configs/releng/root-image/etc/rc.d/functions.d/automated_script b/configs/releng/root-image/etc/rc.d/functions.d/automated_script deleted file mode 100644 index f3e9018..0000000 --- a/configs/releng/root-image/etc/rc.d/functions.d/automated_script +++ /dev/null @@ -1,23 +0,0 @@ -automated_script () -{ - script="$(kernel_cmdline script)" - if [[ -n "${script}" ]]; then - stat_busy "Configuring $script" - if [[ "${script}" =~ ^http:// || "${script}" =~ ^ftp:// ]]; then - wget "${script}" -q -O /tmp/startup_script >/dev/null - rt=$? - else - cp "${script}" /tmp/startup_script - rt=$? - fi - if [ ${rt} -eq 0 ]; then - chmod +x /tmp/startup_script - echo -e '\nif [ $(tty) = "/dev/tty1" ]; then\n /tmp/startup_script\nfi\n' >> /root/.zprofile - stat_done - else - stat_fail - fi - fi -} - -add_hook multi_end automated_script diff --git a/configs/releng/root-image/etc/rc.d/functions.d/setup_special_console b/configs/releng/root-image/etc/rc.d/functions.d/setup_special_console deleted file mode 100644 index 7badfe3..0000000 --- a/configs/releng/root-image/etc/rc.d/functions.d/setup_special_console +++ /dev/null @@ -1,25 +0,0 @@ -# If an alternate console was specified on the kernel command line, -# start agetty on it too. -setup_special_console() -{ - local cmdline_console - if cmdline_console=$(kernel_cmdline console); then - stat_busy "Starting agetty on console: ${cmdline_console}" - local port options baud rts - port=${cmdline_console%%,*} - options=${cmdline_console#${port}} - options=${options#,} - baud=${options%%[neo]*} - [[ ${options} == *r ]] && rts="-h" - if ! grep -q "^${port}" /etc/securetty; then - echo ${port} >> /etc/securetty - fi - if ! grep -q "^z0:" /etc/inittab; then - echo "z0:2345:respawn:/sbin/agetty -8 -s ${rts} ${baud:-9600} ${port} linux" >> /etc/inittab - fi - /sbin/telinit q - stat_done - fi -} - -add_hook sysinit_end setup_special_console diff --git a/configs/releng/root-image/etc/rc.d/pacman-init b/configs/releng/root-image/etc/rc.d/pacman-init deleted file mode 100755 index bbbd719..0000000 --- a/configs/releng/root-image/etc/rc.d/pacman-init +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -. /etc/rc.conf -. /etc/rc.d/functions - -case "$1" in - start) - stat_busy "Initializing pacman keyring" - if { pacman-key --init && pacman-key --populate archlinux; } &>/dev/null; then - add_daemon pacman-init - stat_done - else - stat_fail - exit 1 - fi - ;; - - stop) - stat_busy "Removing pacman keyring" - rm -rf /etc/pacman.d/gnupg - rm_daemon pacman-init - stat_done - ;; - - restart) - $0 stop - $0 start - ;; - - *) - echo "usage: $0 {start|stop|restart}" -esac - -exit 0 -- 1.7.11.5
On Sun, Aug 19, 2012 at 12:57:15AM -0300, Gerardo Exequiel Pozzi wrote:
* rewrite automatic_script to work with systemd or completelly in automatic login shell. * research how to avoid systemd to stop archiso mounted filesystem and leave all the work to our special shutdown script in initramfs (just works, but shows lots of resource busy at shutdown)
Just to save you some time on this second point, I asked for this feature upstream and was turned down. If you're going to find a way around this, think dirty ;) /also played with systemd on archiso today
On 08/19/2012 01:10 AM, Dave Reisner wrote:
On Sun, Aug 19, 2012 at 12:57:15AM -0300, Gerardo Exequiel Pozzi wrote:
* rewrite automatic_script to work with systemd or completelly in automatic login shell. * research how to avoid systemd to stop archiso mounted filesystem and leave all the work to our special shutdown script in initramfs (just works, but shows lots of resource busy at shutdown) Just to save you some time on this second point, I asked for this feature upstream and was turned down. If you're going to find a way around this, think dirty ;)
/also played with systemd on archiso today
Other thing I need to test better is boot with PXE with NBD of NFS (since these are persistent, no copytoram is done by default). 1) DHCP is requested again on real-root. I guess, is most cases, there is no issues since is re-assigned the same IP address. (this bug introduced recently since rc.conf enabled "network") Solutions: a) If this happens suggest the to the user use copytoram=y b) Use copytoram=y in NBD/NFS by default (this is always done for HTTP), user can change this behaviour. c) Disable DHCP service from relevant hooks. 2) Stopping network on shutdown, if network is stopped before reach shutdown-initramfs againt this does not look good. Solutions: a) See how to skip network on shutdown. b) Same point (1.b) -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
Am 19.08.2012 21:15, schrieb Gerardo Exequiel Pozzi:
1) DHCP is requested again on real-root. I guess, is most cases, there is no issues since is re-assigned the same IP address. (this bug introduced recently since rc.conf enabled "network")
This is actually necessary. If you don't start a real DHCP daemon on boot, then you won't renew your lease and the DHCP server may give the IP to someone else. Your lease should still be valid when you re-launch DHCP, so you can rely on getting the same IP. You could probably even configure dhcpcd to specifically request the correct IP.
Solutions: a) If this happens suggest the to the user use copytoram=y b) Use copytoram=y in NBD/NFS by default (this is always done for HTTP), user can change this behaviour. c) Disable DHCP service from relevant hooks.
None of these are good solutions.
2) Stopping network on shutdown, if network is stopped before reach shutdown-initramfs againt this does not look good. Solutions: a) See how to skip network on shutdown. b) Same point (1.b)
We must not stop network on shutdown. We can quit dhcpcd without releasing the lease or shutting down the network. If this is not possible with systemd, then something is very wrong.
On Wed, Aug 22, 2012 at 11:55:02AM +0200, Thomas Bächler wrote:
Am 19.08.2012 21:15, schrieb Gerardo Exequiel Pozzi:
1) DHCP is requested again on real-root. I guess, is most cases, there is no issues since is re-assigned the same IP address. (this bug introduced recently since rc.conf enabled "network")
This is actually necessary. If you don't start a real DHCP daemon on boot, then you won't renew your lease and the DHCP server may give the IP to someone else.
Your lease should still be valid when you re-launch DHCP, so you can rely on getting the same IP. You could probably even configure dhcpcd to specifically request the correct IP.
Solutions: a) If this happens suggest the to the user use copytoram=y b) Use copytoram=y in NBD/NFS by default (this is always done for HTTP), user can change this behaviour. c) Disable DHCP service from relevant hooks.
None of these are good solutions.
2) Stopping network on shutdown, if network is stopped before reach shutdown-initramfs againt this does not look good. Solutions: a) See how to skip network on shutdown. b) Same point (1.b)
We must not stop network on shutdown. We can quit dhcpcd without releasing the lease or shutting down the network. If this is not possible with systemd, then something is very wrong.
Both are feasible. Adding the -p flag to dhcpcd to prevent it from ditching the address on exit is easily done. Alternatively, you can arbitrarily change argv[0] by prefixing the binary path for ExecStart with a @, e.g.: ExecStart=@/usr/bin/dhcpcd @dhcpcd -A eth0 The @ prefix on the argv0 then tells systemd to not kill this horribly on shutdown (or should, in theory). d
On 08/22/2012 06:55 AM, Thomas Bächler wrote:
Am 19.08.2012 21:15, schrieb Gerardo Exequiel Pozzi:
1) DHCP is requested again on real-root. I guess, is most cases, there is no issues since is re-assigned the same IP address. (this bug introduced recently since rc.conf enabled "network") This is actually necessary. If you don't start a real DHCP daemon on boot, then you won't renew your lease and the DHCP server may give the IP to someone else.
Your lease should still be valid when you re-launch DHCP, so you can rely on getting the same IP. You could probably even configure dhcpcd to specifically request the correct IP.
Solutions: a) If this happens suggest the to the user use copytoram=y b) Use copytoram=y in NBD/NFS by default (this is always done for HTTP), user can change this behaviour. c) Disable DHCP service from relevant hooks. None of these are good solutions.
2) Stopping network on shutdown, if network is stopped before reach shutdown-initramfs againt this does not look good. Solutions: a) See how to skip network on shutdown. b) Same point (1.b) We must not stop network on shutdown. We can quit dhcpcd without releasing the lease or shutting down the network. If this is not possible with systemd, then something is very wrong.
Anyway I always use copytoram on NBD and NFS like doing actually with HTTP now. They avoid other issues, for example with NBD uses /dev/nbd0 that, on shutdown-initramfs is present on /oldroot/dev/nbd0 (this one node is used) and /dev/nbd0 => we can not umount /oldroot/dev/ directly, we need mount --move /oldroot/dev over /dev and continue.... -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
Am 22.08.2012 11:55, schrieb Thomas Bächler:
Am 19.08.2012 21:15, schrieb Gerardo Exequiel Pozzi:
1) DHCP is requested again on real-root. I guess, is most cases, there is no issues since is re-assigned the same IP address. (this bug introduced recently since rc.conf enabled "network")
This is actually necessary. If you don't start a real DHCP daemon on boot, then you won't renew your lease and the DHCP server may give the IP to someone else.
Your lease should still be valid when you re-launch DHCP, so you can rely on getting the same IP. You could probably even configure dhcpcd to specifically request the correct IP.
Okay, there is more, and I think we need to change things up a little: Originally, Florian found that by using IPAPPEND 1 (or 3), you don't get a DNS server in the initramfs. I just had a short talk with hpa in #syslinux. He gave a few recommendations which lead me to the following findings: 1) Using ipconfig is bad because you don't run a real dhcp client that renews your lease as it should. 'ipconfig' is a compatibility layer that supports the same syntax as the old kernel-level auto-configuration, which is something that made sense in the last century. Nowadays, you can use initramfs and a real dhcp client. 2) Instead, we should * run a real dhcp client in initramfs * kill it at the end (make it not give away the lease), copy over the lease to the real system (or even leave dhcpcd running) This would force us to ask for DHCP more often, but would guarantee that we have a consistent IP in initramfs and after. It doesn't matter if the IP during PXE and during initramfs differ (which is still unlikely to happen).
On 08/22/2012 04:04 PM, Thomas Bächler wrote:
Am 22.08.2012 11:55, schrieb Thomas Bächler:
Am 19.08.2012 21:15, schrieb Gerardo Exequiel Pozzi:
1) DHCP is requested again on real-root. I guess, is most cases, there is no issues since is re-assigned the same IP address. (this bug introduced recently since rc.conf enabled "network") This is actually necessary. If you don't start a real DHCP daemon on boot, then you won't renew your lease and the DHCP server may give the IP to someone else.
Your lease should still be valid when you re-launch DHCP, so you can rely on getting the same IP. You could probably even configure dhcpcd to specifically request the correct IP. Okay, there is more, and I think we need to change things up a little:
Originally, Florian found that by using IPAPPEND 1 (or 3), you don't get a DNS server in the initramfs. I just had a short talk with hpa in #syslinux. He gave a few recommendations which lead me to the following findings:
1) Using ipconfig is bad because you don't run a real dhcp client that renews your lease as it should. 'ipconfig' is a compatibility layer that supports the same syntax as the old kernel-level auto-configuration, which is something that made sense in the last century. Nowadays, you can use initramfs and a real dhcp client.
I guess the same applies for nfsmount command.
2) Instead, we should * run a real dhcp client in initramfs * kill it at the end (make it not give away the lease), copy over the lease to the real system (or even leave dhcpcd running)
This would force us to ask for DHCP more often, but would guarantee that we have a consistent IP in initramfs and after. It doesn't matter if the IP during PXE and during initramfs differ (which is still unlikely to happen).
If leave it running should notify to systemd that there dhcpcd service is already running. PS: Anyway for now, I leave copytoram=y for NBD/NFS (remember that copytoram only copies needed *.sfs, in other works booting in x86_64 does not copies "i686.sfs") -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
Am 22.08.2012 21:29, schrieb Gerardo Exequiel Pozzi:
2) Instead, we should * run a real dhcp client in initramfs * kill it at the end (make it not give away the lease), copy over the lease to the real system (or even leave dhcpcd running)
This would force us to ask for DHCP more often, but would guarantee that we have a consistent IP in initramfs and after. It doesn't matter if the IP during PXE and during initramfs differ (which is still unlikely to happen).
If leave it running should notify to systemd that there dhcpcd service is already running.
PS: Anyway for now, I leave copytoram=y for NBD/NFS (remember that copytoram only copies needed *.sfs, in other works booting in x86_64 does not copies "i686.sfs")
Beware that downloading the files may take longer than the lease time of the network. For example, it is not uncommon to have 15 minute lease times, and downloading files in less than 15 minutes needs > 3MBit/s approximately.
On 08/22/2012 04:51 PM, Thomas Bächler wrote:
2) Instead, we should * run a real dhcp client in initramfs * kill it at the end (make it not give away the lease), copy over the lease to the real system (or even leave dhcpcd running)
This would force us to ask for DHCP more often, but would guarantee that we have a consistent IP in initramfs and after. It doesn't matter if the IP during PXE and during initramfs differ (which is still unlikely to happen).
If leave it running should notify to systemd that there dhcpcd service is already running.
PS: Anyway for now, I leave copytoram=y for NBD/NFS (remember that copytoram only copies needed *.sfs, in other works booting in x86_64 does not copies "i686.sfs") Beware that downloading the files may take longer than the lease time of
Am 22.08.2012 21:29, schrieb Gerardo Exequiel Pozzi: the network. For example, it is not uncommon to have 15 minute lease times, and downloading files in less than 15 minutes needs > 3MBit/s approximately.
mmm I am now confused now... we have already done this for HTTP and I never heard this argument. So in such case system will be broken during usage, Also NFS/NBD methods are more oriented for local networks. -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
Am 22.08.2012 23:04, schrieb Gerardo Exequiel Pozzi:
Beware that downloading the files may take longer than the lease time of the network. For example, it is not uncommon to have 15 minute lease times, and downloading files in less than 15 minutes needs > 3MBit/s approximately.
mmm I am now confused now... we have already done this for HTTP and I never heard this argument.
It is an unlikely scenario, as such short lease times only occur on public networks, which are mostly wifi, not LAN. It is still possible. Still, the safe way is to use a proper DHCP client.
So in such case system will be broken during usage, Also NFS/NBD methods are more oriented for local networks.
Yes, long lease times are more likely in private networks, so most people won't notice problems.
On Wed, Aug 22, 2012 at 09:04:14PM +0200, Thomas Bächler wrote:
Am 22.08.2012 11:55, schrieb Thomas Bächler:
Am 19.08.2012 21:15, schrieb Gerardo Exequiel Pozzi:
1) DHCP is requested again on real-root. I guess, is most cases, there is no issues since is re-assigned the same IP address. (this bug introduced recently since rc.conf enabled "network")
This is actually necessary. If you don't start a real DHCP daemon on boot, then you won't renew your lease and the DHCP server may give the IP to someone else.
Your lease should still be valid when you re-launch DHCP, so you can rely on getting the same IP. You could probably even configure dhcpcd to specifically request the correct IP.
Okay, there is more, and I think we need to change things up a little:
Originally, Florian found that by using IPAPPEND 1 (or 3), you don't get a DNS server in the initramfs. I just had a short talk with hpa in #syslinux. He gave a few recommendations which lead me to the following findings:
1) Using ipconfig is bad because you don't run a real dhcp client that renews your lease as it should. 'ipconfig' is a compatibility layer that supports the same syntax as the old kernel-level auto-configuration, which is something that made sense in the last century. Nowadays, you can use initramfs and a real dhcp client.
2) Instead, we should * run a real dhcp client in initramfs * kill it at the end (make it not give away the lease), copy over the lease to the real system (or even leave dhcpcd running)
Does any of this mean we should think about revamping our NFS support in mkinitcpio? I'm not really happy with stealing bits from the klibc tree, as its a real pain in the butt to maintain (and bump/bugfix).
This would force us to ask for DHCP more often, but would guarantee that we have a consistent IP in initramfs and after. It doesn't matter if the IP during PXE and during initramfs differ (which is still unlikely to happen).
Am 22.08.2012 21:47, schrieb Dave Reisner:
2) Instead, we should * run a real dhcp client in initramfs * kill it at the end (make it not give away the lease), copy over the lease to the real system (or even leave dhcpcd running)
Does any of this mean we should think about revamping our NFS support in mkinitcpio? I'm not really happy with stealing bits from the klibc tree, as its a real pain in the butt to maintain (and bump/bugfix).
The current NFS support in mkinitcpio was a shortcut, because I was too lazy to do it properly and it was completely compatible with the classic kernel NFS setup. Doing it properly is not easy, and I never cared enough. It is certainly not done "the right way". It is simple compatible to the 1990s way of doing things.
On 08/19/2012 12:57 AM, Gerardo Exequiel Pozzi wrote:
* rewrite automatic_script to work with systemd or completelly in automatic login shell. * research how to avoid systemd to stop archiso mounted filesystem and leave all the work to our special shutdown script in initramfs (just works, but shows lots of resource busy at shutdown)
jor for remember: https://github.com/djgera/archiso/compare/master...experimental -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
participants (3)
-
Dave Reisner
-
Gerardo Exequiel Pozzi
-
Thomas Bächler