ArchLinux packages manager for Porteus

Here is a place for your projects which are not officially supported by the Porteus Team. For example: your own kernel patched with extra features; desktops not included in the standard ISO like Gnome; base modules that are different than the standard ISO, etc...
neko
DEV Team
DEV Team
Posts: 2107
Joined: 09 Feb 2013, 09:55
Distribution: APorteus-FVWM-ja-x86_64.iso
Location: japan

ArchLinux packages manager for Porteus

Post#676 by neko » 07 Oct 2021, 03:13

(Please refer to the third article. ArchLinux packages manager for Porteus (Post by neko #36689))

==== Language: Thai, English (th) ====
APorteus-BUDGIE_th-v21.10.02-x86_64.iso (676 M)

==== Language: Taiwan, English (zh-TW) ====
APorteus-BUDGIE_zh-v21.10.02-x86_64.iso (687 M)


kernel v5.15-rc4 with AUFS patch (AUFS_VERSION "5.x-rcN-20210927")
Archlinux packages are the most recent version at 2021.10.02.

APorteus-BUDGIE_th-v21.10.02-x86_64.iso & APorteus-BUDGIE_zh-v21.10.02-x86_64.iso
include the most recent version 21.10.06 "Kernel Builder".


These ISO have already been removed from upload site.

Thanks.

neko
DEV Team
DEV Team
Posts: 2107
Joined: 09 Feb 2013, 09:55
Distribution: APorteus-FVWM-ja-x86_64.iso
Location: japan

ArchLinux packages manager for Porteus

Post#677 by neko » 18 Oct 2021, 14:03

(Please refer to the third article. ArchLinux packages manager for Porteus (Post by neko #36689))
Kernel version: 5.15-rc6 with AUFS patch "5.x-rcN-20211018"
Archlinux packages are the most recent version at 2021.10.18.

1. "APorteus ISO Builder" is updated to v21.10.18.
APorteus-v21.10.18-i486.iso (567 M)
APorteus-v21.10.18-x86_64.iso (568 M)


2. Example of ISOs that were created by "APorteus ISO builder"
==== Language: Japanese, English ====
APorteus-CINNAMON_ja-v21.10.18-i486.iso (693 M)
APorteus-CINNAMON_ja-v21.10.18-x86_64.iso (693 M)


These 4 ISOs include the most recent "Kernel Builder"(Version 21.10.17).


Thanks.

neko
DEV Team
DEV Team
Posts: 2107
Joined: 09 Feb 2013, 09:55
Distribution: APorteus-FVWM-ja-x86_64.iso
Location: japan

ArchLinux packages manager for Porteus

Post#678 by neko » 21 Oct 2021, 13:19

APorteus-CINNAMON_ja-v21.10.18-x86_64.iso utilities


1. kdeconnect for APorteus-CINNAMON_ja-v21.10.18-x86_64.iso
kdeconnect: A communication tool with ANDROID smartphone.

Fixed the bug of 004-kdeconnect.xzm
004-kdeconnect6.xzm (16 M)
https://www.mediafire.com/file/k4trct24 ... nnect6.xzm
md5sum: 92e2cbb337b5f4691849a2d08620bec9 004-kdeconnect6.xzm

2. Brave Browser for APorteus-CINNAMON_ja-v21.10.18-x86_64.iso
004-brave-nightly-bin-1.33.23-x86_64-1.xzm


Note:
APorteus-CINNAMON_ja-v21.10.18-x86_64.iso
refer to ArchLinux packages manager for Porteus (Post by neko #36689)
004-brave-nightly-bin-1.33.23-x86_64-1.xzm
refer to Brave Browser (Post by neko #84923)


Thanks.

neko
DEV Team
DEV Team
Posts: 2107
Joined: 09 Feb 2013, 09:55
Distribution: APorteus-FVWM-ja-x86_64.iso
Location: japan

ArchLinux packages manager for Porteus

Post#679 by neko » 26 Oct 2021, 03:23

(Please refer to the third article. ArchLinux packages manager for Porteus (Post by neko #36689))
Kernel version: 5.15-rc7 with AUFS patch "5.x-rcN-20211018"
Archlinux packages are the most recent version at 2021.10.24.

1. "APorteus ISO Builder" is updated to v21.10.24.
APorteus-v21.10.24-i486.iso (567 M)
APorteus-v21.10.24-x86_64.iso (568 M)


2. [Example of ISOs that were created by "APorteus ISO builder"]
==== Language: Japanese, English ====
APorteus-XFCE_ja-v21.10.24-i486.iso (705 M)
APorteus-XFCE_ja-v21.10.24-x86_64.iso (707 M)


These XFCE ISOs include the communication tool with ANDROID smartphone.


Thanks.

neko
DEV Team
DEV Team
Posts: 2107
Joined: 09 Feb 2013, 09:55
Distribution: APorteus-FVWM-ja-x86_64.iso
Location: japan

ArchLinux packages manager for Porteus

Post#680 by neko » 26 Oct 2021, 04:51

Example of ISOs that were created by "APorteus ISO builder";
APorteus-XFCE_ja-v21.10.24-i486.iso
and
APorteus-XFCE_ja-v21.10.24-x86_64.iso
include "004-kdeconnect.xzm".

[Example transfer a file from Smartphone to PC]
1. conect PC and Smartphone to same LAN

<Smartphone>
2. install "KDE Connect" by "Play store".
3. execute "KDE Connect"

<PC>
4. GUI menue ---> Settings ---> "KDE Connect Settings"
[Config -- KDE Connect Settings] window
5. select(double click) device(Smartphone)
6. Request pair(single click)

<Smartphone>
7. select (touch) abable PC
8. allow requir from PC
9. select (touch) "transfer file"
10. select file of Smartphone

<PC>
11. /home/guest/Downloads/the file from Smartphone


Thanks.

neko
DEV Team
DEV Team
Posts: 2107
Joined: 09 Feb 2013, 09:55
Distribution: APorteus-FVWM-ja-x86_64.iso
Location: japan

ArchLinux packages manager for Porteus

Post#681 by neko » 01 Nov 2021, 08:22

(Please refer to the third article. ArchLinux packages manager for Porteus (Post by neko #36689))
Kernel version: 5.15 with AUFS patch "5.x-rcN-20211018"
Archlinux packages are the most recent version at 2021.10.24.

1. "APorteus ISO Builder" is updated to v21.10.24.
APorteus-v21.10.24.2-i486.iso (567 M)
APorteus-v21.10.24.2-x86_64.iso (568 M)


2. [Example of ISOs that were created by "APorteus ISO builder"]
==== Language: Japanese, English ====
APorteus-LXDE_ja-v21.10.24.2-i486.iso (649 M)
APorteus-LXDE_ja-v21.10.24.2-x86_64.iso (649 M)


These 2 LXDE ISOs include "004-kdeconnect.xzm" which is the communication tool with ANDROID smartphone.


Thanks.

raja
Shogun
Shogun
Posts: 434
Joined: 02 May 2017, 09:51
Distribution: v3.2.2-32 and Porteus-Artix-64
Location: Chennai,India

ArchLinux packages manager for Porteus

Post#682 by raja » 02 Nov 2021, 19:20

neko,

Did you make any progress after this discussion with Tomas, on clean shutdown of live systems using systemd?

https://www.slax.org/en/blog/24229-Clea ... stemd.html

I gave' umount -l -a' command. All busy mounts were unmounted. But sadly, there is nothing exists in the OS to execute shutdown or poweroff.

Hard shutdown is the only way. Even alt+prtsc+reiso does not function. I have to find out if this saves writing of "dirty bits" in mounted disks.
Linux Kernel-4.4.272 -32 bit; Linux Kernel-5.4.185 - 64 bit

Rapha_
Shogun
Shogun
Posts: 238
Joined: 12 Jun 2021, 21:59
Distribution: Xfce 4.12 - 5.rc3 - x86_64
Location: France

ArchLinux packages manager for Porteus

Post#683 by Rapha_ » 03 Nov 2021, 12:06

The cheatcodes "copy2ram rammod=000;001;002" hate my computer ** !

it frozen 2 times , one minute after a boot (only the "Top" like opened and a window resized) > impossible to reboot (Alt+print+b), can only stop by Power off

Tested APorteus* yesterday, for the first time
(* APorteus-v21.10.24.2-x86_64.iso )

I removed copy2ram rammod=000;001;002 it seems to work fine now


**
OptiPlex 740
AMD Athlon 64 X2 Dual Core Processor 4850e
Current Speed: 2500 MHz
Memory 4 GB

neko
DEV Team
DEV Team
Posts: 2107
Joined: 09 Feb 2013, 09:55
Distribution: APorteus-FVWM-ja-x86_64.iso
Location: japan

ArchLinux packages manager for Porteus

Post#684 by neko » 04 Nov 2021, 23:54

Would you help me?

1.The problem of shutdown
@raja
"Did you make any progress.....?"
-->
No, I don't.

If you have an idea, please remake the ISO and upload it.
I don't have the skill to fix this issue.
Would you help me.

2.The problem of the cheatcodes "copy2ram"
@Rapha_
Freezen at boot dosen't happen in my environment.
If you have a time, please modify the initrd.zstd in the ISO and upload it.
Would you help me.


Thanks.

beny
Full of knowledge
Full of knowledge
Posts: 2083
Joined: 02 Jan 2011, 11:33
Location: italy

ArchLinux packages manager for Porteus

Post#685 by beny » 05 Nov 2021, 12:54

hi neko, i apologize first but in your Archlinux SPM i think is better to comeback to build module xzm in automatic way when you choose merge option, btw at reboot i have the software ready to use,Aporteus the shutdown in ram option work well but not with changes i don't use it.
the shutdown log after live system is ready now starting porteus
failed umounting /mnt/sdi1
failed umounting /mnt/live
pivot_root failed to change root from ',' to union invalid argument
but after this message the shutdown is ok.

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

ArchLinux packages manager for Porteus

Post#686 by Rava » 06 Nov 2021, 05:21

beny wrote:
05 Nov 2021, 12:54
failed umounting /mnt/sdi1
that means at least /dev/sdi1 has its dirty bits set and needs a fsck.
When /dev/sdi1 being an internal ntfs that could be an issue…

What's the difference between Porteus and APorteus system-wise in regards to that? Porteus usually has no issue umounting at shutdown or reboot.
Cheers!
Yours Rava

raja
Shogun
Shogun
Posts: 434
Joined: 02 May 2017, 09:51
Distribution: v3.2.2-32 and Porteus-Artix-64
Location: Chennai,India

ArchLinux packages manager for Porteus

Post#687 by raja » 06 Nov 2021, 11:54

APorteus uses systemd init, designed for installed systems in mind . So live OS running from memory have problems.Solutions are to be found.

That is why I am trying to unmount all devices manually before powering off.With my last attempt,since I have unmounted all under /mnt, no dirty bits were written .but it is crude .

Expert programmers can view sysv & systemd source to see if 'systemd source could be modified to act like sysv init. systemd.shutdown is compiled to execute faster.

sysV-rc.6

Code: Select all

#!/bin/bash
#
# rc.6		This file is executed by init when it goes into runlevel
#		0 (halt) or runlevel 6 (reboot). It kills all processes,
#		unmounts file systems and then either halts or reboots.

PATH=/sbin:/bin:/usr/sbin:/usr/bin

# If there are SystemV init scripts for this runlevel, run them:
[ -x /etc/rc.d/rc.sysvinit ] &&  . /etc/rc.d/rc.sysvinit

# Run rc.local_shutdown:
[ -x /etc/rc.d/rc.local_shutdown ] && /etc/rc.d/rc.local_shutdown

# See how the script was called and set the command to do that:
[ "$0" = "/etc/rc.d/rc.0" ] && command="poweroff" || command="reboot"

# Store random-seed to a file:
dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr `cat /proc/sys/kernel/random/poolsize` / 8) 2>/dev/null
chmod 600 /etc/random-seed

# Write what's going to happen in wtmp:
$command -w

# Deactivate all porteus modules activated from /union:
deactivate `grep ^devpts -A500 /proc/mounts | grep '.xzm ' | cut -d" " -f2` >/dev/null 2>&1

# Close magic-folders encrypted containers:
for x in `ls /dev/mapper/magic* 2>/dev/null`; do
    umount `grep -w /dev/mapper/$x /proc/mounts | cut -d " " -f2`
    cryptsetup luksClose $x
done

# Detach loop devices used in /union:
losetup -a | grep /loop3 -A500 | grep -v '.xzm)' | cut -d: -f1 | xargs -n1 losetup -d 2>/dev/null
sync; echo

# Stop acpid/dbus/udev/nfsd:
udevadm control --exit 2>/dev/null
killall acpid dbus-daemon udevd 2>/dev/null
pidof nfsd >/dev/null && sh /etc/rc.d/rc.nfsd stop

# Turn off swap:
swapoff -a

# Some filesystems needs to be unmounted later:
echo "Unmounting local file systems"
sync
umount -at no,aufs,devtmpfs,proc,sysfs 2>/dev/null

# Sync what's left in buffers:
sync

# Deactivate LVM volume groups:
if [ -e /mnt/live/tmp/lvm ]; then
    echo "Deactivating LVM volume groups"
    vgchange -an --ignorelockingfailure
fi

# Deactivate RAID arrays:
if [ -e /mnt/live/tmp/raid ]; then
    echo "Deactivating RAID arrays"
    mdadm -S /dev/md/* 2>/dev/null
fi

# Run the cleanup script:
cd /mnt/live/
exec ./cleanup $command <dev/console >dev/console 2>&1

# Do halt or reboot depending on how the script was called:
$command -f >/dev/null 2>&1
systemd.shutdown:

Code: Select all

#include <errno.h>
#include <getopt.h>
#include <linux/reboot.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/reboot.h>
#include <sys/stat.h>
#include <unistd.h>

#include "alloc-util.h"
#include "async.h"
#include "binfmt-util.h"
#include "cgroup-setup.h"
#include "cgroup-util.h"
#include "def.h"
#include "exec-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "killall.h"
#include "log.h"
#include "parse-util.h"
#include "process-util.h"
#include "reboot-util.h"
#include "rlimit-util.h"
#include "signal-util.h"
#include "string-util.h"
#include "switch-root.h"
#include "sysctl-util.h"
#include "terminal-util.h"
#include "umount.h"
#include "util.h"
#include "virt.h"
#include "watchdog.h"

#define SYNC_PROGRESS_ATTEMPTS 3
#define SYNC_TIMEOUT_USEC (10*USEC_PER_SEC)

static char* arg_verb;
static uint8_t arg_exit_code;
static usec_t arg_timeout = DEFAULT_TIMEOUT_USEC;

static int parse_argv(int argc, char *argv[]) {
        enum {
                ARG_LOG_LEVEL = 0x100,
                ARG_LOG_TARGET,
                ARG_LOG_COLOR,
                ARG_LOG_LOCATION,
                ARG_LOG_TIME,
                ARG_EXIT_CODE,
                ARG_TIMEOUT,
        };

        static const struct option options[] = {
                { "log-level",     required_argument, NULL, ARG_LOG_LEVEL    },
                { "log-target",    required_argument, NULL, ARG_LOG_TARGET   },
                { "log-color",     optional_argument, NULL, ARG_LOG_COLOR    },
                { "log-location",  optional_argument, NULL, ARG_LOG_LOCATION },
                { "log-time",      optional_argument, NULL, ARG_LOG_TIME     },
                { "exit-code",     required_argument, NULL, ARG_EXIT_CODE    },
                { "timeout",       required_argument, NULL, ARG_TIMEOUT      },
                {}
        };

        int c, r;

        assert(argc >= 1);
        assert(argv);

        /* "-" prevents getopt from permuting argv[] and moving the verb away
         * from argv[1]. Our interface to initrd promises it'll be there. */
        while ((c = getopt_long(argc, argv, "-", options, NULL)) >= 0)
                switch (c) {

                case ARG_LOG_LEVEL:
                        r = log_set_max_level_from_string(optarg);
                        if (r < 0)
                                log_error_errno(r, "Failed to parse log level %s, ignoring: %m", optarg);

                        break;

                case ARG_LOG_TARGET:
                        r = log_set_target_from_string(optarg);
                        if (r < 0)
                                log_error_errno(r, "Failed to parse log target %s, ignoring: %m", optarg);

                        break;

                case ARG_LOG_COLOR:

                        if (optarg) {
                                r = log_show_color_from_string(optarg);
                                if (r < 0)
                                        log_error_errno(r, "Failed to parse log color setting %s, ignoring: %m", optarg);
                        } else
                                log_show_color(true);

                        break;

                case ARG_LOG_LOCATION:
                        if (optarg) {
                                r = log_show_location_from_string(optarg);
                                if (r < 0)
                                        log_error_errno(r, "Failed to parse log location setting %s, ignoring: %m", optarg);
                        } else
                                log_show_location(true);

                        break;

                case ARG_LOG_TIME:

                        if (optarg) {
                                r = log_show_time_from_string(optarg);
                                if (r < 0)
                                        log_error_errno(r, "Failed to parse log time setting %s, ignoring: %m", optarg);
                        } else
                                log_show_time(true);

                        break;

                case ARG_EXIT_CODE:
                        r = safe_atou8(optarg, &arg_exit_code);
                        if (r < 0)
                                log_error_errno(r, "Failed to parse exit code %s, ignoring: %m", optarg);

                        break;

                case ARG_TIMEOUT:
                        r = parse_sec(optarg, &arg_timeout);
                        if (r < 0)
                                log_error_errno(r, "Failed to parse shutdown timeout %s, ignoring: %m", optarg);

                        break;

                case '\001':
                        if (!arg_verb)
                                arg_verb = optarg;
                        else
                                log_error("Excess arguments, ignoring");
                        break;

                case '?':
                        return -EINVAL;

                default:
                        assert_not_reached();
                }

        if (!arg_verb)
                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
                                       "Verb argument missing.");

        return 0;
}

static int switch_root_initramfs(void) {
        if (mount("/run/initramfs", "/run/initramfs", NULL, MS_BIND, NULL) < 0)
                return log_error_errno(errno, "Failed to mount bind /run/initramfs on /run/initramfs: %m");

        if (mount(NULL, "/run/initramfs", NULL, MS_PRIVATE, NULL) < 0)
                return log_error_errno(errno, "Failed to make /run/initramfs private mount: %m");

        /* switch_root with MS_BIND, because there might still be processes lurking around, which have open file descriptors.
         * /run/initramfs/shutdown will take care of these.
         * Also do not detach the old root, because /run/initramfs/shutdown needs to access it.
         */
        return switch_root("/run/initramfs", "/oldroot", false, MS_BIND);
}

/* Read the following fields from /proc/meminfo:
 *
 *  NFS_Unstable
 *  Writeback
 *  Dirty
 *
 * Return true if the sum of these fields is greater than the previous
 * value input. For all other issues, report the failure and indicate that
 * the sync is not making progress.
 */
static int sync_making_progress(unsigned long long *prev_dirty) {
        _cleanup_fclose_ FILE *f = NULL;
        unsigned long long val = 0;
        int ret;

        f = fopen("/proc/meminfo", "re");
        if (!f)
                return log_warning_errno(errno, "Failed to open /proc/meminfo: %m");

        for (;;) {
                _cleanup_free_ char *line = NULL;
                unsigned long long ull = 0;
                int q;

                q = read_line(f, LONG_LINE_MAX, &line);
                if (q < 0)
                        return log_warning_errno(q, "Failed to parse /proc/meminfo: %m");
                if (q == 0)
                        break;

                if (!first_word(line, "NFS_Unstable:") && !first_word(line, "Writeback:") && !first_word(line, "Dirty:"))
                        continue;

                errno = 0;
                if (sscanf(line, "%*s %llu %*s", &ull) != 1) {
                        if (errno != 0)
                                log_warning_errno(errno, "Failed to parse /proc/meminfo: %m");
                        else
                                log_warning("Failed to parse /proc/meminfo");

                        return false;
                }

                val += ull;
        }

        ret = *prev_dirty > val;
        *prev_dirty = val;
        return ret;
}

static void sync_with_progress(void) {
        unsigned long long dirty = ULLONG_MAX;
        unsigned checks;
        pid_t pid;
        int r;

        BLOCK_SIGNALS(SIGCHLD);

        /* Due to the possibility of the sync operation hanging, we fork a child process and monitor
         * the progress. If the timeout lapses, the assumption is that the particular sync stalled. */

        r = asynchronous_sync(&pid);
        if (r < 0) {
                log_error_errno(r, "Failed to fork sync(): %m");
                return;
        }

        log_info("Syncing filesystems and block devices.");

        /* Start monitoring the sync operation. If more than
         * SYNC_PROGRESS_ATTEMPTS lapse without progress being made,
         * we assume that the sync is stalled */
        for (checks = 0; checks < SYNC_PROGRESS_ATTEMPTS; checks++) {
                r = wait_for_terminate_with_timeout(pid, SYNC_TIMEOUT_USEC);
                if (r == 0)
                        /* Sync finished without error.
                         * (The sync itself does not return an error code) */
                        return;
                else if (r == -ETIMEDOUT) {
                        /* Reset the check counter if the "Dirty" value is
                         * decreasing */
                        if (sync_making_progress(&dirty) > 0)
                                checks = 0;
                } else {
                        log_error_errno(r, "Failed to sync filesystems and block devices: %m");
                        return;
                }
        }

        /* Only reached in the event of a timeout. We should issue a kill
         * to the stray process. */
        log_error("Syncing filesystems and block devices - timed out, issuing SIGKILL to PID "PID_FMT".", pid);
        (void) kill(pid, SIGKILL);
}

static int read_current_sysctl_printk_log_level(void) {
        _cleanup_free_ char *sysctl_printk_vals = NULL, *sysctl_printk_curr = NULL;
        int current_lvl;
        const char *p;
        int r;

        r = sysctl_read("kernel/printk", &sysctl_printk_vals);
        if (r < 0)
                return log_debug_errno(r, "Cannot read sysctl kernel.printk: %m");

        p = sysctl_printk_vals;
        r = extract_first_word(&p, &sysctl_printk_curr, NULL, 0);
        if (r < 0)
                return log_debug_errno(r, "Failed to split out kernel printk priority: %m");
        if (r == 0)
                return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Short read while reading kernel.printk sysctl");

        r = safe_atoi(sysctl_printk_curr, &current_lvl);
        if (r < 0)
                return log_debug_errno(r, "Failed to parse kernel.printk sysctl: %s", sysctl_printk_vals);

        return current_lvl;
}

static void bump_sysctl_printk_log_level(int min_level) {
        int current_lvl, r;

        /* Set the logging level to be able to see messages with log level smaller or equal to min_level */

        current_lvl = read_current_sysctl_printk_log_level();
        if (current_lvl < 0 || current_lvl >= min_level + 1)
                return;

        r = sysctl_writef("kernel/printk", "%i", min_level + 1);
        if (r < 0)
                log_debug_errno(r, "Failed to bump kernel.printk to %i: %m", min_level + 1);
}

static void init_watchdog(void) {
        const char *s;
        int r;

        s = getenv("WATCHDOG_DEVICE");
        if (s) {
                r = watchdog_set_device(s);
                if (r < 0)
                        log_warning_errno(r, "Failed to set watchdog device to %s, ignoring: %m", s);
        }

        s = getenv("WATCHDOG_USEC");
        if (s) {
                usec_t usec;

                r = safe_atou64(s, &usec);
                if (r < 0)
                        log_warning_errno(r, "Failed to parse watchdog timeout '%s', ignoring: %m", s);
                else
                        (void) watchdog_setup(usec);
        }
}

int main(int argc, char *argv[]) {
        bool need_umount, need_swapoff, need_loop_detach, need_dm_detach, need_md_detach, in_container, can_initrd;
        _cleanup_free_ char *cgroup = NULL;
        char *arguments[3];
        int cmd, r, umount_log_level = LOG_INFO;
        static const char* const dirs[] = {SYSTEM_SHUTDOWN_PATH, NULL};

        /* The log target defaults to console, but the original systemd process will pass its log target in through a
         * command line argument, which will override this default. Also, ensure we'll never log to the journal or
         * syslog, as these logging daemons are either already dead or will die very soon. */

        log_set_target(LOG_TARGET_CONSOLE);
        log_set_prohibit_ipc(true);
        log_parse_environment();

        if (getpid_cached() == 1)
                log_set_always_reopen_console(true);

        r = parse_argv(argc, argv);
        if (r < 0)
                goto error;

        log_open();

        umask(0022);

        if (getpid_cached() != 1) {
                log_error("Not executed by init (PID 1).");
                r = -EPERM;
                goto error;
        }

        if (streq(arg_verb, "reboot"))
                cmd = RB_AUTOBOOT;
        else if (streq(arg_verb, "poweroff"))
                cmd = RB_POWER_OFF;
        else if (streq(arg_verb, "halt"))
                cmd = RB_HALT_SYSTEM;
        else if (streq(arg_verb, "kexec"))
                cmd = LINUX_REBOOT_CMD_KEXEC;
        else if (streq(arg_verb, "exit"))
                cmd = 0; /* ignored, just checking that arg_verb is valid */
        else {
                log_error("Unknown action '%s'.", arg_verb);
                r = -EINVAL;
                goto error;
        }

        (void) cg_get_root_path(&cgroup);
        in_container = detect_container() > 0;

        /* If the logging messages are going to KMSG, and if we are not running from a container, then try to
         * update the sysctl kernel.printk current value in order to see "info" messages; This current log
         * level is not updated if already big enough.
         */
        if (!in_container &&
            IN_SET(log_get_target(),
                   LOG_TARGET_AUTO,
                   LOG_TARGET_JOURNAL_OR_KMSG,
                   LOG_TARGET_SYSLOG_OR_KMSG,
                   LOG_TARGET_KMSG))
                bump_sysctl_printk_log_level(LOG_WARNING);

        init_watchdog();

        /* Lock us into memory */
        (void) mlockall(MCL_CURRENT|MCL_FUTURE);

        /* Synchronize everything that is not written to disk yet at this point already. This is a good idea so that
         * slow IO is processed here already and the final process killing spree is not impacted by processes
         * desperately trying to sync IO to disk within their timeout. Do not remove this sync, data corruption will
         * result. */
        if (!in_container)
                sync_with_progress();

        disable_coredumps();
        disable_binfmt();

        log_info("Sending SIGTERM to remaining processes...");
        broadcast_signal(SIGTERM, true, true, arg_timeout);

        log_info("Sending SIGKILL to remaining processes...");
        broadcast_signal(SIGKILL, true, false, arg_timeout);

        need_umount = !in_container;
        need_swapoff = !in_container;
        need_loop_detach = !in_container;
        need_dm_detach = !in_container;
        need_md_detach = !in_container;
        can_initrd = !in_container && !in_initrd() && access("/run/initramfs/shutdown", X_OK) == 0;

        /* Unmount all mountpoints, swaps, and loopback devices */
        for (;;) {
                bool changed = false;

                (void) watchdog_ping();

                /* Let's trim the cgroup tree on each iteration so
                   that we leave an empty cgroup tree around, so that
                   container managers get a nice notify event when we
                   are down */
                if (cgroup)
                        (void) cg_trim(SYSTEMD_CGROUP_CONTROLLER, cgroup, false);

                if (need_umount) {
                        log_info("Unmounting file systems.");
                        r = umount_all(&changed, umount_log_level);
                        if (r == 0) {
                                need_umount = false;
                                log_info("All filesystems unmounted.");
                        } else if (r > 0)
                                log_info("Not all file systems unmounted, %d left.", r);
                        else
                                log_error_errno(r, "Failed to unmount file systems: %m");
                }

                if (need_swapoff) {
                        log_info("Deactivating swaps.");
                        r = swapoff_all(&changed);
                        if (r == 0) {
                                need_swapoff = false;
                                log_info("All swaps deactivated.");
                        } else if (r > 0)
                                log_info("Not all swaps deactivated, %d left.", r);
                        else
                                log_error_errno(r, "Failed to deactivate swaps: %m");
                }

                if (need_loop_detach) {
                        log_info("Detaching loop devices.");
                        r = loopback_detach_all(&changed, umount_log_level);
                        if (r == 0) {
                                need_loop_detach = false;
                                log_info("All loop devices detached.");
                        } else if (r > 0)
                                log_info("Not all loop devices detached, %d left.", r);
                        else
                                log_error_errno(r, "Failed to detach loop devices: %m");
                }

                if (need_md_detach) {
                        log_info("Stopping MD devices.");
                        r = md_detach_all(&changed, umount_log_level);
                        if (r == 0) {
                                need_md_detach = false;
                                log_info("All MD devices stopped.");
                        } else if (r > 0)
                                log_info("Not all MD devices stopped, %d left.", r);
                        else
                                log_error_errno(r, "Failed to stop MD devices: %m");
                }

                if (need_dm_detach) {
                        log_info("Detaching DM devices.");
                        r = dm_detach_all(&changed, umount_log_level);
                        if (r == 0) {
                                need_dm_detach = false;
                                log_info("All DM devices detached.");
                        } else if (r > 0)
                                log_info("Not all DM devices detached, %d left.", r);
                        else
                                log_error_errno(r, "Failed to detach DM devices: %m");
                }

                if (!need_umount && !need_swapoff && !need_loop_detach && !need_dm_detach
                            && !need_md_detach) {
                        log_info("All filesystems, swaps, loop devices, MD devices and DM devices detached.");
                        /* Yay, done */
                        break;
                }

                if (!changed && umount_log_level == LOG_INFO && !can_initrd) {
                        /* There are things we cannot get rid of. Loop one more time
                         * with LOG_ERR to inform the user. Note that we don't need
                         * to do this if there is an initrd to switch to, because that
                         * one is likely to get rid of the remaining mounts. If not,
                         * it will log about them. */
                        umount_log_level = LOG_ERR;
                        continue;
                }

                /* If in this iteration we didn't manage to
                 * unmount/deactivate anything, we simply give up */
                if (!changed) {
                        log_info("Cannot finalize remaining%s%s%s%s%s continuing.",
                                 need_umount ? " file systems," : "",
                                 need_swapoff ? " swap devices," : "",
                                 need_loop_detach ? " loop devices," : "",
                                 need_dm_detach ? " DM devices," : "",
                                 need_md_detach ? " MD devices," : "");
                        break;
                }

                log_debug("Couldn't finalize remaining %s%s%s%s%s trying again.",
                          need_umount ? " file systems," : "",
                          need_swapoff ? " swap devices," : "",
                          need_loop_detach ? " loop devices," : "",
                          need_dm_detach ? " DM devices," : "",
                          need_md_detach ? " MD devices," : "");
        }

        /* We're done with the watchdog. */
        watchdog_free_device();

        arguments[0] = NULL;
        arguments[1] = arg_verb;
        arguments[2] = NULL;
        (void) execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS);

        (void) rlimit_nofile_safe();

        if (can_initrd) {
                r = switch_root_initramfs();
                if (r >= 0) {
                        argv[0] = (char*) "/shutdown";

                        (void) setsid();
                        (void) make_console_stdio();

                        log_info("Successfully changed into root pivot.\n"
                                 "Returning to initrd...");

                        execv("/shutdown", argv);
                        log_error_errno(errno, "Failed to execute shutdown binary: %m");
                } else
                        log_error_errno(r, "Failed to switch root to \"/run/initramfs\": %m");
        }

        if (need_umount || need_swapoff || need_loop_detach || need_dm_detach || need_md_detach)
                log_error("Failed to finalize%s%s%s%s%s ignoring.",
                          need_umount ? " file systems," : "",
                          need_swapoff ? " swap devices," : "",
                          need_loop_detach ? " loop devices," : "",
                          need_dm_detach ? " DM devices," : "",
                          need_md_detach ? " MD devices," : "");

        /* The kernel will automatically flush ATA disks and suchlike on reboot(), but the file systems need to be
         * sync'ed explicitly in advance. So let's do this here, but not needlessly slow down containers. Note that we
         * sync'ed things already once above, but we did some more work since then which might have caused IO, hence
         * let's do it once more. Do not remove this sync, data corruption will result. */
        if (!in_container)
                sync_with_progress();

        if (streq(arg_verb, "exit")) {
                if (in_container) {
                        log_info("Exiting container.");
                        return arg_exit_code;
                }

                cmd = RB_POWER_OFF; /* We cannot exit() on the host, fallback on another method. */
        }

        switch (cmd) {

        case LINUX_REBOOT_CMD_KEXEC:

                if (!in_container) {
                        /* We cheat and exec kexec to avoid doing all its work */
                        log_info("Rebooting with kexec.");

                        r = safe_fork("(sd-kexec)", FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_LOG|FORK_WAIT, NULL);
                        if (r == 0) {
                                const char * const args[] = {
                                        KEXEC, "-e", NULL
                                };

                                /* Child */

                                execv(args[0], (char * const *) args);

                                /* execv failed (kexec binary missing?), so try simply reboot(RB_KEXEC) */
                                (void) reboot(cmd);
                                _exit(EXIT_FAILURE);
                        }

                        /* If we are still running, then the kexec can't have worked, let's fall through */
                }

                cmd = RB_AUTOBOOT;
                _fallthrough_;

        case RB_AUTOBOOT:
                (void) reboot_with_parameter(REBOOT_LOG);
                log_info("Rebooting.");
                break;

        case RB_POWER_OFF:
                log_info("Powering off.");
                break;

        case RB_HALT_SYSTEM:
                log_info("Halting system.");
                break;

        default:
                assert_not_reached();
        }

        (void) reboot(cmd);
        if (errno == EPERM && in_container) {
                /* If we are in a container, and we lacked
                 * CAP_SYS_BOOT just exit, this will kill our
                 * container for good. */
                log_info("Exiting container.");
                return EXIT_SUCCESS;
        }

        r = log_error_errno(errno, "Failed to invoke reboot(): %m");

  error:
        log_emergency_errno(r, "Critical error while doing system shutdown: %m");
        freeze();
}
Linux Kernel-4.4.272 -32 bit; Linux Kernel-5.4.185 - 64 bit

beny
Full of knowledge
Full of knowledge
Posts: 2083
Joined: 02 Jan 2011, 11:33
Location: italy

ArchLinux packages manager for Porteus

Post#688 by beny » 06 Nov 2021, 17:34

Code: Select all

  guest@porteus:~$ systemctl list-units
  UNIT                                                                         >
  proc-sys-fs-binfmt_misc.automount                                            >
  sys-devices-pci0000:00-0000:00:02.0-0000:01:00.1-sound-card1-controlC1.device>
  sys-devices-pci0000:00-0000:00:07.0-0000:03:00.0-ata5-host4-target4:0:0-4:0:0>
  sys-devices-pci0000:00-0000:00:07.0-0000:03:00.0-ata5-host4-target4:0:0-4:0:0>
  sys-devices-pci0000:00-0000:00:07.0-0000:03:00.0-ata6-host5-target5:0:0-5:0:0>
  sys-devices-pci0000:00-0000:00:07.0-0000:03:00.0-ata6-host5-target5:0:0-5:0:0>
  sys-devices-pci0000:00-0000:00:0a.0-0000:05:00.0-net-enp5s0.device           >
  sys-devices-pci0000:00-0000:00:11.0-ata2-host1-target1:0:0-1:0:0:0-block-sda->
  sys-devices-pci0000:00-0000:00:11.0-ata2-host1-target1:0:0-1:0:0:0-block-sda.>
  sys-devices-pci0000:00-0000:00:11.0-ata3-host2-target2:0:0-2:0:0:0-block-sdb->
  sys-devices-pci0000:00-0000:00:11.0-ata3-host2-target2:0:0-2:0:0:0-block-sdb.>
  sys-devices-pci0000:00-0000:00:11.0-ata4-host3-target3:0:0-3:0:0:0-block-sdc->
  sys-devices-pci0000:00-0000:00:11.0-ata4-host3-target3:0:0-3:0:0:0-block-sdc.>
  sys-devices-pci0000:00-0000:00:12.0-usb3-3\x2d2-3\x2d2:1.2-host8-target8:0:0->
  sys-devices-pci0000:00-0000:00:12.0-usb3-3\x2d2.device                       >
  sys-devices-pci0000:00-0000:00:12.0-usb3-3\x2d3-3\x2d3:1.0-bluetooth-hci0.dev>
  sys-devices-pci0000:00-0000:00:12.2-usb1-1\x2d4-1\x2d4:1.0-host9-target9:0:0->
  sys-devices-pci0000:00-0000:00:12.2-usb1-1\x2d4-1\x2d4:1.0-host9-target9:0:0->
  sys-devices-pci0000:00-0000:00:13.1-usb6-6\x2d3.device                       >
  sys-devices-pci0000:00-0000:00:14.1-ata7-host6-target6:0:0-6:0:0:0-block-sdf->
  sys-devices-pci0000:00-0000:00:14.1-ata7-host6-target6:0:0-6:0:0:0-block-sdf.>
  sys-devices-pci0000:00-0000:00:14.1-ata7-host6-target6:0:1-6:0:1:0-block-sdg->
  sys-devices-pci0000:00-0000:00:14.1-ata7-host6-target6:0:1-6:0:1:0-block-sdg.>
  sys-devices-pci0000:00-0000:00:14.2-sound-card0-controlC0.device             >
  sys-devices-platform-serial8250-tty-ttyS1.device                             >
  sys-devices-platform-serial8250-tty-ttyS2.device                             >
  sys-devices-platform-serial8250-tty-ttyS3.device                             >
  sys-devices-pnp0-00:06-tty-ttyS0.device                                      >
  sys-devices-virtual-block-loop0.device                                       >
  sys-devices-virtual-block-loop1.device                                       >
  sys-devices-virtual-block-loop10.device                                      >
  sys-devices-virtual-block-loop11.device                                      >
  sys-devices-virtual-block-loop12.device                                      >
  sys-devices-virtual-block-loop13.device                                      >
  sys-devices-virtual-block-loop14.device                                      >
  sys-devices-virtual-block-loop2.device                                       >
  sys-devices-virtual-block-loop3.device                                       >
  sys-devices-virtual-block-loop4.device                                       >
  sys-devices-virtual-block-loop5.device                                       >
  sys-devices-virtual-block-loop6.device                                       >
  sys-devices-virtual-block-loop7.device                                       >
  sys-devices-virtual-block-loop8.device                                       >
  sys-devices-virtual-block-loop9.device                                       >
  sys-devices-virtual-misc-rfkill.device                                       >
  sys-module-configfs.device                                                   >
  sys-module-fuse.device                                                       >
  sys-subsystem-bluetooth-devices-hci0.device                                  >
  sys-subsystem-net-devices-enp5s0.device                                      >
  -.mount                                                                      >
  dev-mqueue.mount                                                             >
  mnt-live-dev.mount                                                           >
  mnt-live-memory-changes.mount                                                >
  mnt-live-memory-images-000\x2dkernel.xzm.mount                               >
  mnt-live-memory-images-001\x2dcore.xzm.mount                                 >
  mnt-live-memory-images-001\x2dz.core.xzm.mount                               >
  mnt-live-memory-images-002\x2dxorg.xzm.mount                                 >
  mnt-live-memory-images-002\x2dz.xorg.xzm.mount                               >
  mnt-live-memory-images-003\x2dxfce.xzm.mount                                 >
  mnt-live-memory-images-003\x2dz.xfce.xzm.mount                               >
  mnt-live-memory-images-004\x2dbuildiso\x2d21.09.12.xzm.mount                 >
  mnt-live-memory-images-004\x2dopera\x2d79.0.4143.22\x2dx86_64\x2d1DUOWiF.xzm.>
  mnt-live-memory-images-05\x2ddevel.xzm.mount                                 >
  mnt-live-memory-images-06\x2dcrippled_sources\x2d5.15.1\x2d64bit.xzm.mount   >
  mnt-live-memory-images-abiword.xzm.mount                                     >
  mnt-live-memory-images-acetoneiso2.xzm.mount                                 >
  mnt-live-memory-images-archcommunity\x2d1636216179\x2dspm\x2d21.09.06\x2dx86_>
  mnt-live-memory-images-archcore\x2d1636216179\x2dspm\x2d21.09.06\x2dx86_64\x2>
  mnt-live-memory-images-archextra\x2d1636216179\x2dspm\x2d21.09.06\x2dx86_64\x>
  mnt-live-memory-images-catfish.xzm.mount                                     >
  mnt-live-memory-images-claws\x2dmail.xzm.mount                               >
  mnt-live-memory-images-firefox.xzm.mount                                     >
  mnt-live-memory-images-kodi.xzm.mount                                        >
  mnt-live-memory-images-libreoffice\x2dfresh.xzm.mount                        >
  mnt-live-memory-images-mkKernel\x2d21.10.17\x2dnoarch\x2d1.xzm.mount         >
  mnt-live-memory-images-mplayer.xzm.mount                                     >
  mnt-live-memory-images-pcsclite.xzm.mount                                    >
  mnt-live-proc.mount                                                          >
  mnt-live-sys.mount                                                           >
  mnt-live.mount                                                               >
  mnt-sda1.mount                                                               >
  mnt-sdb1.mount                                                               >
  mnt-sdc1.mount                                                               >
  mnt-sdd1.mount                                                               >
  mnt-sde1.mount                                                               >
  mnt-sdf1.mount                                                               >
  mnt-sdg1.mount                                                               >
  mnt-sdi1.mount                                                               >
  run-credentials-systemd\x2dsysusers.service.mount                            >
  run-user-1000-gvfs.mount                                                     >
  run-user-1000.mount                                                          >
  sys-fs-fuse-connections.mount                                                >
  sys-kernel-config.mount                                                      >
  sys-kernel-debug.mount                                                       >
  tmp.mount                                                                    >
  systemd-ask-password-console.path                                            >
  systemd-ask-password-wall.path                                               >
  init.scope                                                                   >
  session-c1.scope                                                             >
  alsa-restore.service                                                         >
  avahi-daemon.service                                                         >
  dbus.service                                                                 >
  kmod-static-nodes.service                                                    >
  ldconfig.service                                                             >
  lvm2-monitor.service                                                         >
  lxdm.service                                                                 >
  NetworkManager.service                                                       >
  polkit.service                                                               >
  rtkit-daemon.service                                                         >
  systemd-hwdb-update.service                                                  >
  systemd-journal-catalog-update.service                                       >
  systemd-journal-flush.service                                                >
  systemd-journald.service                                                     >
  systemd-logind.service                                                       >
  systemd-modules-load.service                                                 >
  systemd-random-seed.service                                                  >
  systemd-remount-fs.service                                                   >
  systemd-sysctl.service                                                       >
  systemd-sysusers.service                                                     >
  systemd-tmpfiles-setup-dev.service                                           >
  systemd-tmpfiles-setup.service                                               >
  systemd-udev-trigger.service                                                 >
  systemd-udevd.service                                                        >
  systemd-update-done.service                                                  >
  systemd-update-utmp.service                                                  >
  systemd-user-sessions.service                                                >
  udisks2.service                                                              >
  upower.service                                                               >
  user-runtime-dir@1000.service                                                >
  user@1000.service                                                            >
  -.slice                                                                      >
  system-getty.slice                                                           >
  system-modprobe.slice                                                        >
  system.slice                                                                 >
  user-1000.slice                                                              >
  user.slice                                                                   >
  avahi-daemon.socket                                                          >
  dbus.socket                                                                  >
  dm-event.socket                                                              >
  lvm2-lvmpolld.socket                                                         >
  systemd-coredump.socket                                                      >
  systemd-journald-dev-log.socket                                              >
  systemd-journald.socket                                                      >
  systemd-rfkill.socket                                                        >
  systemd-udevd-control.socket                                                 >
  systemd-udevd-kernel.socket                                                  >
  basic.target                                                                 >
  bluetooth.target                                                             >
  cryptsetup.target                                                            >
  getty.target                                                                 >
  graphical.target                                                             >
  local-fs-pre.target                                                          >
  local-fs.target                                                              >
  multi-user.target                                                            >
  network.target                                                               >
  paths.target                                                                 >
  printer.target                                                               >
  remote-fs.target                                                             >
  slices.target                                                                >
  smartcard.target                                                             >
  sockets.target                                                               >
  sound.target                                                                 >
  swap.target                                                                  >
  sysinit.target                                                               >
  timers.target                                                                >
  veritysetup.target                                                           >
  logrotate.timer                                                              >
  man-db.timer                                                                 >
  shadow.timer                                                                 >
  systemd-tmpfiles-clean.timer                                                 >

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
169 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
    
hi neko you have this on systemd list unit? i have modified the initrd and all the mount list where i shutdown start red but after a while are green and poweroff i can't see a log of shutdown if you have any idea to check it ps: i am not skilled so.....

neko
DEV Team
DEV Team
Posts: 2107
Joined: 09 Feb 2013, 09:55
Distribution: APorteus-FVWM-ja-x86_64.iso
Location: japan

ArchLinux packages manager for Porteus

Post#689 by neko » 10 Nov 2021, 02:43

@Ed_P

["buildiso" module]
This module can be used only in APorteus ISO.
Especially in "APorteus ISO builder" ISO, its perpose (building ISO) will be done.

Recent version:
"APorteus ISO builder" ISO: APorteus-v21.11.08-x86_64.iso
"buildiso" module: 004-buildiso-21.11.04.xzm

Therefor it cann't be used in Porteus ISO.
If you would like study "buildiso" module,
you can analyze it as following procedure.

In running APorteus-v21.11.08-x86_64.iso environment:

Code: Select all

% su
# ls
# cp -a /mnt/live/memory/images/004-buildiso-21.11.04.xzm 004-buildiso-21.11.04
# sep2pkg 004-buildiso-21.11.04
# ls
pkgs.004-buildiso
# ls pkgs.004-buildiso/
buildiso-21.10.20-noarch-1  mkapl-17.07.27-noarch-1  mklocale-21.10.02-noarch-1  pkg.desktopDB
# ls pkgs.004-buildiso/pkg.desktopDB
mkAPbudgie-21.06.10-noarch-1    mkAPede-17.08.25-noarch-1      mkAPlumina-19.05.28-noarch-1  mkAPxfce-21.06.10-noarch-1
mkAPcinnamon-21.06.10-noarch-1  mkAPenlight-21.04.12-noarch-1  mkAPlxde-21.07.29-noarch-1    mkAPxfce_plus-21.07.03-noarch-1
mkAPdraco-19.06.16-noarch-1     mkAPfvwm-21.05.31-noarch-1     mkAPlxqt-21.04.12-noarch-1
mkAPe16-19.07.17-noarch-1       mkAPkde-21.03.02-noarch-1      mkAPmate-21.06.08-noarch-1
#
buildiso-21.10.20-noarch-1: ISO build package
mkapl-17.07.27-noarch-1: application build package
mklocale-21.10.02-noarch-1: locale build package
mkAPXXXX: XXXX desktop build package


Thanks.

User avatar
Ed_P
Contributor
Contributor
Posts: 8315
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

ArchLinux packages manager for Porteus

Post#690 by Ed_P » 10 Nov 2021, 04:42

neko wrote:
10 Nov 2021, 02:43
This module can be used only in APorteus ISO.
neko wrote:
10 Nov 2021, 02:43
Therefor it cann't be used in Porteus ISO.
Sorry to hear neko.

I've tried APorteus-v21.11.08-x86_64.iso and it doesn't support my WiFi or my touchpad.
Ed

Post Reply