Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package virtme for openSUSE:Factory checked in at 2024-04-02 16:40:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/virtme (Old) and /work/SRC/openSUSE:Factory/.virtme.new.1905 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "virtme" Tue Apr 2 16:40:15 2024 rev:12 rq:1163552 version:1.23 Changes: -------- --- /work/SRC/openSUSE:Factory/virtme/virtme.changes 2024-03-28 14:32:51.070300840 +0100 +++ /work/SRC/openSUSE:Factory/.virtme.new.1905/virtme.changes 2024-04-02 16:40:30.497020729 +0200 @@ -1,0 +2,14 @@ +Fri Mar 29 14:17:01 UTC 2024 - Michael Vetter <[email protected]> + +- Update to 1.23: + * Fix breakage with QEMU 8.2.2 + * Change behaviour of --kconfig, that will always override + the .config if present (since there is not reason to use + --kconfig and not update the .config). + * It is now possible to force the legacy cgroup v1 using the + option -a "SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE=1": the vng + init script will mimic systemd behavior and mount cgroup v1, + instead of v2. +- Drop qemu-remove-unnecessary-serial-none-arg.patch + +------------------------------------------------------------------- Old: ---- qemu-remove-unnecessary-serial-none-arg.patch virtme-ng-1.22.tar.xz New: ---- virtme-ng-1.23.tar.xz BETA DEBUG BEGIN: Old: instead of v2. - Drop qemu-remove-unnecessary-serial-none-arg.patch BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ virtme.spec ++++++ --- /var/tmp/diff_new_pack.uy7afD/_old 2024-04-02 16:40:31.097042841 +0200 +++ /var/tmp/diff_new_pack.uy7afD/_new 2024-04-02 16:40:31.101042988 +0200 @@ -22,14 +22,13 @@ %global pythons python311 %endif Name: virtme -Version: 1.22 +Version: 1.23 Release: 0 Summary: Tools for virtualize the running distro or a rootfs License: GPL-2.0-only Group: Development/Tools/Other URL: https://github.com/arighi/virtme-ng Source0: %{name}-ng-%{version}.tar.xz -Patch0: qemu-remove-unnecessary-serial-none-arg.patch BuildRequires: %{pythons}-argcomplete BuildRequires: %{pythons}-requests BuildRequires: %{pythons}-setuptools ++++++ _service ++++++ --- /var/tmp/diff_new_pack.uy7afD/_old 2024-04-02 16:40:31.125043873 +0200 +++ /var/tmp/diff_new_pack.uy7afD/_new 2024-04-02 16:40:31.129044020 +0200 @@ -3,7 +3,7 @@ <param name="url">https://github.com/arighi/virtme-ng.git</param> <param name="scm">git</param> <param name="submodules">enable</param> - <param name="revision">v1.22</param> + <param name="revision">v1.23</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> <param name="versionrewrite-replacement">\1</param> ++++++ virtme-ng-1.22.tar.xz -> virtme-ng-1.23.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/virtme-ng-1.22/README.md new/virtme-ng-1.23/README.md --- old/virtme-ng-1.22/README.md 2024-02-24 10:00:32.000000000 +0100 +++ new/virtme-ng-1.23/README.md 2024-03-29 09:06:04.000000000 +0100 @@ -320,11 +320,11 @@ - Run virtme-ng inside a docker container: ``` - $ docker run -it ubuntu:22.04 /bin/bash + $ docker run -it --privileged ubuntu:23.10 /bin/bash # apt update # echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections # apt install --yes git qemu-kvm udev iproute2 busybox-static \ - coreutils python3-requests libvirt-clients kbd kmod file rsync zstd udev + coreutils python3-requests libvirt-clients kbd kmod file rsync zstd virtiofsd # git clone --recursive https://github.com/arighi/virtme-ng.git # ./virtme-ng/vng -r v6.6 -- uname -r 6.6.0-060600-generic @@ -448,6 +448,19 @@ $ udevadm trigger --subsystem-match --action=change ``` + - To mount the legacy cgroup filesystem (v1) layout, add + `SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE=1` to the kernel boot options: +``` +$ vng -r --append "SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE=1" -- 'df -T /sys/fs/cgroup/*' +Filesystem Type 1K-blocks Used Available Use% Mounted on +blkio cgroup 0 0 0 - /sys/fs/cgroup/blkio +cpu cgroup 0 0 0 - /sys/fs/cgroup/cpu +cpuacct cgroup 0 0 0 - /sys/fs/cgroup/cpuacct +devices cgroup 0 0 0 - /sys/fs/cgroup/devices +memory cgroup 0 0 0 - /sys/fs/cgroup/memory +pids cgroup 0 0 0 - /sys/fs/cgroup/pids +``` + Contributing ============ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/virtme-ng-1.22/setup.py new/virtme-ng-1.23/setup.py --- old/virtme-ng-1.22/setup.py 2024-02-24 10:00:32.000000000 +0100 +++ new/virtme-ng-1.23/setup.py 2024-03-29 09:06:04.000000000 +0100 @@ -24,7 +24,7 @@ build_virtme_ng_init = int(os.environ.get("BUILD_VIRTME_NG_INIT", 0)) # Make sure virtme-ng-init submodule has been cloned -if build_virtme_ng_init and not os.path.exists("virtme_ng_init"): +if build_virtme_ng_init and not os.path.exists("virtme_ng_init/Cargo.toml"): sys.stderr.write("WARNING: virtme-ng-init submodule not available, trying to clone it\n") check_call("git submodule update --init --recursive", shell=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/virtme-ng-1.22/virtme/commands/configkernel.py new/virtme-ng-1.23/virtme/commands/configkernel.py --- old/virtme-ng-1.22/virtme/commands/configkernel.py 2024-02-24 10:00:32.000000000 +0100 +++ new/virtme-ng-1.23/virtme/commands/configkernel.py 2024-03-29 09:06:04.000000000 +0100 @@ -38,6 +38,12 @@ help="Use a custom config snippet file to override specific config options", ) + parser.add_argument( + "--no-update", + action="store_true", + help="Skip if the config file already exists", + ) + g = parser.add_argument_group(title="Mode").add_mutually_exclusive_group() g.add_argument( @@ -289,6 +295,8 @@ maketarget = arch.defconfig_target updatetarget = "olddefconfig" elif args.update: + if args.no_update: + arg_fail("--update and --no-update cannot be used together") maketarget = None updatetarget = "olddefconfig" else: @@ -306,18 +314,24 @@ if config_dir and os.path.isdir(config_dir): config = os.path.join(config_dir, config) - if not os.path.exists(config): - # Set up an initial config - if maketarget is None: - maketarget = arch.defconfig_target + if os.path.exists(config): + if args.no_update: + print(f"{config} file exists: no modifications have been done") + return 0 + else: + if args.update: + print(f"Error: {config} file is missing") + return 1 + + if maketarget is not None: try: subprocess.check_call(["make"] + archargs + [maketarget]) except Exception as exc: raise SilentError() from exc - # Append virtme configs - with open(config, "ab") as conffile: - conffile.write("\n".join(conf).encode("utf-8")) + # Append virtme configs + with open(config, "ab") as conffile: + conffile.write("\n".join(conf).encode("utf-8")) # Run the update target try: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/virtme-ng-1.22/virtme/commands/run.py new/virtme-ng-1.23/virtme/commands/run.py --- old/virtme-ng-1.22/virtme/commands/run.py 2024-02-24 10:00:32.000000000 +0100 +++ new/virtme-ng-1.23/virtme/commands/run.py 2024-03-29 09:06:04.000000000 +0100 @@ -1001,7 +1001,6 @@ if args.graphics is None and not args.script_sh and not args.script_exec: qemuargs.extend(["-echr", "1"]) - qemuargs.extend(["-serial", "none"]) if args.verbose: # Check if we have permission to access the current stderr. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/virtme-ng-1.22/virtme/guest/virtme-init new/virtme-ng-1.23/virtme/guest/virtme-init --- old/virtme-ng-1.22/virtme/guest/virtme-init 2024-02-24 10:00:32.000000000 +0100 +++ new/virtme-ng-1.23/virtme/guest/virtme-init 2024-03-29 09:06:04.000000000 +0100 @@ -188,7 +188,21 @@ mount -t securityfs securityfs /sys/kernel/security &>/dev/null # Set up cgroup mount points (mount cgroupv2 hierarchy by default) -mount -t cgroup2 cgroup2 /sys/fs/cgroup +# +# If SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE=1 is passed we can mimic systemd's +# behavior and mount the legacy cgroup v1 layout. +if cat /proc/cmdline |grep -q -E '(^| )SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE=1($| )'; then + mount -t tmpfs cgroup /sys/fs/cgroup + sybsys=(cpu cpuacct blkio memory devices pids) + for s in "${sybsys[@]}"; do + mkdir -p "/sys/fs/cgroup/${s}" + # Don't treat failure as critical here, since the kernel may not + # support all the legacy cgroups. + mount -t cgroup "${s}" -o "${s}" "/sys/fs/cgroup/${s}" || true + done +else + mount -t cgroup2 cgroup2 /sys/fs/cgroup +fi # Set up filesystems that live in /dev mkdir -p -m 0755 /dev/shm /dev/pts @@ -374,6 +388,8 @@ install -d -m 0755 /tmp/roothome export HOME=/tmp/roothome mount --bind /tmp/roothome /root +else + export HOME=/root fi # $XDG_RUNTIME_DIR defines the base directory relative to which user-specific diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/virtme-ng-1.22/virtme_ng/run.py new/virtme-ng-1.23/virtme_ng/run.py --- old/virtme-ng-1.22/virtme_ng/run.py 2024-02-24 10:00:32.000000000 +0100 +++ new/virtme-ng-1.23/virtme_ng/run.py 2024-03-29 09:06:04.000000000 +0100 @@ -157,7 +157,7 @@ "--kconfig", "-k", action="store_true", - help="Only generate the kernel .config without building/running anything", + help="Only override the kernel .config without building/running anything", ) parser.add_argument( @@ -408,7 +408,8 @@ "--force", action="store_true", help="Force reset git repository to target branch or commit " - "(warning: this may drop uncommitted changes)", + "(warning: this may drop uncommitted changes), " + "and force kernel config override", ) parser.add_argument( @@ -565,7 +566,9 @@ def config(self, args): """Perform a make config operation on a kernel source directory.""" arch = args.arch - cmd = "virtme-configkernel --update" + cmd = "virtme-configkernel --defconfig" + if not args.force and not args.kconfig: + cmd += " --no-update" if arch is not None: if arch not in ARCH_MAPPING: arg_fail(f"unsupported architecture: {arch}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/virtme-ng-1.22/virtme_ng/version.py new/virtme-ng-1.23/virtme_ng/version.py --- old/virtme-ng-1.22/virtme_ng/version.py 2024-02-24 10:00:32.000000000 +0100 +++ new/virtme-ng-1.23/virtme_ng/version.py 2024-03-29 09:06:04.000000000 +0100 @@ -3,7 +3,7 @@ """virtme-ng version""" -VERSION = "1.22" +VERSION = "1.23" if __name__ == '__main__': print(VERSION) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/virtme-ng-1.22/virtme_ng_init/src/main.rs new/virtme-ng-1.23/virtme_ng_init/src/main.rs --- old/virtme-ng-1.22/virtme_ng_init/src/main.rs 2024-02-24 10:00:32.000000000 +0100 +++ new/virtme-ng-1.23/virtme_ng_init/src/main.rs 2024-03-29 09:06:04.000000000 +0100 @@ -108,13 +108,6 @@ flags: 0, fsdata: "", }, - MountInfo { - source: "cgroup2", - target: "/sys/fs/cgroup", - fs_type: "cgroup2", - flags: 0, - fsdata: "", - }, ]; const SYSTEM_MOUNTS: &[MountInfo] = &[ @@ -415,6 +408,25 @@ } } +fn mount_cgroupfs() { + // If SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE=1 is passed we can mimic systemd's behavior and mount + // the legacy cgroup v1 layout. + let cmdline = std::fs::read_to_string("/proc/cmdline").unwrap(); + if cmdline.contains("SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE=1") { + utils::do_mount("cgroup", "/sys/fs/cgroup", "tmpfs", 0, ""); + let subsystems = vec!["cpu", "cpuacct", "blkio", "memory", "devices", "pids"]; + for subsys in &subsystems { + let target = format!("/sys/fs/cgroup/{}", subsys); + utils::do_mkdir(&target); + // Don't treat failure as critical here, since the kernel may not + // support all the legacy cgroups. + utils::do_mount(subsys, &target, "cgroup", 0, subsys); + } + } else { + utils::do_mount("cgroup2", "/sys/fs/cgroup", "cgroup2", 0, ""); + } +} + fn mount_virtme_overlays() { for (key, path) in env::vars() { if key.starts_with("virtme_rw_overlay") { @@ -741,6 +753,8 @@ utils::do_mkdir("/tmp/roothome"); utils::do_mount("/tmp/roothome", "/root", "", libc::MS_BIND as usize, ""); env::set_var("HOME", "/tmp/roothome"); + } else { + env::set_var("HOME", "/root"); } } @@ -781,6 +795,12 @@ } fn configure_terminal(consdev: &str, uid: u32) { + // Set proper user ownership on the default console device + utils::do_chown(&consdev, uid, None).ok(); + + // Redirect stdout/stderr to the new console device. + redirect_console(&consdev); + if let Ok(params) = env::var("virtme_stty_con") { let output = Command::new("stty") .args(params.split_whitespace()) @@ -791,11 +811,6 @@ .output(); log!("{}", String::from_utf8_lossy(&output.unwrap().stderr)); } - // Set proper user ownership on the default console device - utils::do_chown(&consdev, uid, None).ok(); - - // Redirect stdout/stderr to the new console device. - redirect_console(&consdev); } fn detach_from_terminal(tty_fd: libc::c_int) { @@ -988,6 +1003,7 @@ configure_environment(); configure_hostname(); mount_kernel_filesystems(); + mount_cgroupfs(); configure_limits(); mount_virtme_overlays(); mount_sys_filesystems();
