Git Product home page Git Product logo

mkosi's Introduction

Systemd

System and Service Manager

Semaphore CI 2.0 Build Status
Coverity Scan Status
OSS-Fuzz Status
CIFuzz
CII Best Practices
CentOS CI - CentOS 9
CentOS CI - Arch
CentOS CI - Arch (sanitizers)
Fossies codespell report
Weblate
Coverage Status
Packaging status
OpenSSF Scorecard

Details

Most documentation is available on systemd's web site.

Assorted, older, general information about systemd can be found in the systemd Wiki.

Information about build requirements is provided in the README file.

Consult our NEWS file for information about what's new in the most recent systemd versions.

Please see the Code Map for information about this repository's layout and content.

Please see the Hacking guide for information on how to hack on systemd and test your modifications.

Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.

When preparing patches for systemd, please follow our Coding Style Guidelines.

If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel

Stable branches with backported patches are available in the stable repo.

We have a security bug bounty program sponsored by the Sovereign Tech Fund hosted on YesWeHack

mkosi's People

Contributors

afreof avatar behrmann avatar bluca avatar cmarcelo avatar cornelicorn avatar daandemeyer avatar davide125 avatar dellgreen avatar eliasp avatar fbuihuu avatar foxxx0 avatar fsateler avatar fthiery avatar gdiscry avatar gsegatti avatar keszybz avatar killermoehre avatar l3n41c avatar lucasdemarchi avatar lucaswerkmeister avatar lukeshu avatar malt3 avatar mcassaniti avatar mrc0mmand avatar nekkodroid avatar poettering avatar pyfisch avatar richardmaw-codethink avatar septatrix avatar werkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mkosi's Issues

Debian fails to build due to `apt-get` errors

Debian fails to build due to apt-get errors. Interestingly Ubuntu does not.


mkosi.default

[Distribution]
Distribution=debian
Release=jessie

[Packages]
WithNetwork=true

# mkosi --default mkosi.default -o debian-8

DISTRIBUTION:
          Distribution: debian
               Release: jessie
                Mirror: http://httpredir.debian.org/debian

OUTPUT:
         Output Format: raw_gpt
                Output: /root/mkosi/debian-8/debian-8

PACKAGES:
         Build Sources: /root/mkosi/debian-8
  Scripts with network: yes

PARTITIONS:
        Root Partition: 1.0G
WARNING: The following packages cannot be authenticated!
  libcap-ng0 libdbus-1-3 libexpat1 dbus libpam-systemd
E: There are problems and -y was used without --force-yes

mkosi.default

[Distribution]
Distribution=debian
Release=jessie

[Packages]
WithNetwork=true

# mkosi --default mkosi.default -o debian-8

DISTRIBUTION:
          Distribution: debian
               Release: jessie
                Mirror: http://httpredir.debian.org/debian

OUTPUT:
         Output Format: directory
                Output: /root/mkosi/debian-8/debian-8

PACKAGES:
         Build Sources: /root/mkosi/debian-8
  Scripts with network: yes
...
WARNING: The following packages cannot be authenticated!                           
  libcap-ng0 libdbus-1-3 libexpat1 dbus libpam-systemd                             
E: There are problems and -y was used without --force-yes 
...

mkosi.default

[Distribution]
Distribution=debian
Release=stretch

[Packages]
WithNetwork=true

# mkosi --default mkosi.default -o debian-9

DISTRIBUTION:
          Distribution: debian
               Release: stretch
                Mirror: http://httpredir.debian.org/debian

OUTPUT:
         Output Format: directory
                Output: /root/mkosi/debian-9/debian-9

PACKAGES:

         Build Sources: /root/mkosi/debian-9
  Scripts with network: yes
...
WARNING: The following packages cannot be authenticated!                           
  libdbus-1-3 libexpat1 dbus libpam-systemd                                        
E: There were unauthenticated packages and -y was used without --allow-unauthenticated
...

It's reproducible with

  • latest mkosi from master
  • Ubuntu 16.04: apt 1.2.24 (amd64) and debootstrap 1.0.90ubuntu1
  • Arch Linux (latest): apt 1.4.6 (amd64) and debootstrap 1.0.91

chattr on xfs

trying to build casync, on fedora 25 host.

mkosi build fails due to
chattr +C /home/vbatts/src/github.com/systemd/casync/.mkosi-kbs2v8b4 returns non-zero.
And swallows a message like chattr: Operation not supported while setting flags on /home/vbatts/src/github.com/systemd/casync/.mkosi-kbs2v8b4

systemd version: 231
mkosi version: mkosi-1-1.fc25.noarch

Debian/Ubuntu: usrmerge package not found

sudo mkosi -d debian -r jessie -o ...

...
E: Couldn't find these debs: usrmerge
...

The reason for this error is very simple: usrmerge isn’t in jessie, only in stretch (testing) and sid (unstable) so far. It would be very convenient if mkosi detected this condition and either removed usrmerge from the package list (probably not what you want for “legacy-free images”) or printed a better error message than the current double stack trace (“Debian releases other than ‘testing’ and ‘unstable’ are unsupported at the moment”).

trouble with git worktree

I called mkosi from a git workdir (with .git a symlink to some other place), and got the following tb

‣ Running build script...
['systemd-nspawn', '--image=/var/tmp/.mkosi-aw49u5ok', '--as-pid2', '--private-network', '--register=no', '--bind', '/var/tmp/mkosi-k8yood73/dest:/root/dest', '--setenv=WITH_DOCS=0', '--setenv=DESTDIR=/root/dest', '--setenv=SRCDIR=/root/src', '--chdir=/root/src', '/root/mkosi.build']
Spawning container mkosi-aw49u5ok on /var/tmp/.mkosi-aw49u5ok.
Press ^] three times within 1s to kill container.
+ git clean -dfqx
fatal: Not a git repository (or any of the parent directories): .git
Container mkosi-aw49u5ok failed with error code 128.
Traceback (most recent call last):
  File "../mkosi/mkosi", line 1567, in <module>
    main()
  File "../mkosi/mkosi", line 1563, in main
    build_stuff(args)
  File "../mkosi/mkosi", line 1515, in build_stuff
    run_build_script(args, workspace.name, raw)
  File "../mkosi/mkosi", line 1504, in run_build_script
    subprocess.run(cmdline, check=True)
  File "/usr/lib64/python3.5/subprocess.py", line 711, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['systemd-nspawn', '--image=/var/tmp/.mkosi-aw49u5ok', '--as-pid2', '--private-network', '--register=no', '--bind', '/var/tmp/mkosi-k8yood73/dest:/root/dest', '--setenv=WITH_DOCS=0', '--setenv=DESTDIR=/root/dest', '--setenv=SRCDIR=/root/src', '--chdir=/root/src', '/root/mkosi.build']' returned non-zero exit status 128

Debian/Ubuntu: Too many levels of symbolic links

Hi,

when creating Debian or Ubuntu based directories with e.g.

./mkosi -d debian -r jessie -t directory -o debian-wheezy

The following error message is returned after finishing the installation:

‣ Installing Debian completed.
‣ Linking image file...
‣ Successfully linked /home/stefan/Repositories/mkosi-stefan/debian-wheezy.
Traceback (most recent call last):
  File "./mkosi", line 1475, in <module>
    main()
  File "./mkosi", line 1472, in main
    print_output_size(args)
  File "./mkosi", line 814, in print_output_size
    print_step("Resulting image size is " + format_bytes(dir_size(args.output)) + ".")
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 809, in dir_size
    sum += dir_size(entry.path)
  File "./mkosi", line 806, in dir_size
    if entry.is_file():
OSError: [Errno 40] Too many levels of symbolic links: '/home/stefan/Repositories/mkosi-stefan/debian-wheezy/dev/fd/3/dev/fd/3/dev/fd/3/dev/fd/3/dev/fd/3/dev/fd/3/dev/fd/3/dev/fd/3/dev/fd/3/dev/fd/3/dev/fd/3/dev/fd/3/dev/fd/3/usr/share/man/man1/uncompress.1.gz'

I see these kind of error messages on Arch Linux and Fedora 24.

Bootable flag for raw_btrfs not supported under Debian unstable

I get an unsupported variant error when trying to make a bootable raw_btrfs Debian image using mkosi under Debian unstable.

Here is the full traceback:

Traceback (most recent call last):
  File "/usr/local/bin/mkosi", line 2538, in <module>
    main()
  File "/usr/local/bin/mkosi", line 2534, in main
    build_stuff(args)
  File "/usr/local/bin/mkosi", line 2486, in build_stuff
    raw, tar, root_hash = build_image(args, workspace, run_build_script=False)
  File "/usr/local/bin/mkosi", line 2384, in build_image
    install_distribution(args, workspace.name, run_build_script)
  File "/usr/local/bin/mkosi", line 1015, in install_distribution
    install[args.distribution](args, workspace, run_build_script)
  File "/usr/lib/python3.5/contextlib.py", line 30, in inner
    return func(*args, **kwds)
  File "/usr/local/bin/mkosi", line 833, in install_debian
    install_debian_or_ubuntu(args, workspace, run_build_script, args.mirror)
  File "/usr/local/bin/mkosi", line 778, in install_debian_or_ubuntu
    subprocess.run(cmdline, check=True)
  File "/usr/lib/python3.5/subprocess.py", line 398, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['debootstrap', '--verbose', '--merged-usr', '--variant=minbase,btrfs-tools', '--include=systemd-sysv', '--exclude=sysv-rc,initscripts,startpar,lsb-base,insserv', '--components=main', 'unstable', '/var/tmp/mkosi-94qwlek9/root', 'http://httpredir.debian.org/debian']' returned non-zero exit status 1

running `# mkosi` fails on ext4 filesystem with chattr +C

When I run # mkosi it fails with output:

subprocess.CalledProcessError: Command '['chattr', '+C', '/home/erick/kvms/images/.mkosi-mzuvrf7o']' returned non-zero exit status 1

If I try to make tmp directory and run chattr manually I get:

# chattr +C .mkfoo-rex28
chattr: Operation not supported while setting flags on .mkfoo-rex28

It seems ext4 doesn't support cow (C) attribute?

$ man ext4
   The ext2, ext3, and ext4 filesystems support setting the following file attributes  on  Linux  systems  using  the
   chattr(1) utility:

   a - append only
   A - no atime updates
   d - no dump
   D - synchronous directory updates
   i - immutable
   S - synchronous updates
   u - undeletable
   In addition, the ext3 and ext4 filesystems support the following flag:
   j - data journaling
   Finally, the ext4 filesystem also supports the following flag:
   e - extents format

Commenting out the call to chattr +C in the mkosi script builds an image successfully.

Context:

02:34:56 [root@lenobot:/home/erick/kvms/images] 
$ mount | grep /home
/dev/sda3 on /home type ext4 (rw,relatime,seclabel,data=ordered)

02:35:10 [root@lenobot:/home/erick/kvms/images] 
$ rpm -q mkosi
mkosi-1-1.fc25.noarch

02:35:47 [root@lenobot:/home/erick/kvms/images] 
$ mkosi
DISTRIBUTION:
Distribution: fedora
Release: 25

OUTPUT:
Output Format: raw_gpt
Output: /home/erick/kvms/images/image.raw
Output Checksum: n/a
Output Signature: n/a
Output nspawn Settings: n/a
XZ Compression: no

PACKAGES:
Packages: none
With Documentation: no
Package Cache: none
Extra Trees: none
Build Script: none
Build Sources: /home/erick/kvms/images
Build Packages: none
nspawn Settings: none

PARTITIONS:
Bootable: no
Root Partition: 1.0G
Swap Partition: (disabled)
ESP: (disabled)
/home Partition: (disabled)
/srv Partition: (disabled)

VALIDATION:
Checksum: no
Sign: no
GPG Key: default
Password: default
‣ Detaching namespace...
‣ Detaching namespace complete.
‣ Setting up package cache...
‣ Setting up package cache /home/erick/kvms/images/.mkosi-y87uw8fg completed.
‣ Setting up temporary workspace.
‣ Temporary workspace in /var/tmp/mkosi-h_htd1ma is now set up.
‣ Creating partition table...
Traceback (most recent call last):
File "/bin/mkosi", line 1657, in <module>
main()
File "/bin/mkosi", line 1653, in main
build_stuff(args)
File "/bin/mkosi", line 1613, in build_stuff
raw, tar = build_image(args, workspace, run_build_script=False)
File "/bin/mkosi", line 1542, in build_image
raw = create_image(args, workspace.name)
File "/bin/mkosi", line 124, in create_image
subprocess.run(["chattr", "+C", f.name], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)
File "/usr/lib64/python3.5/subprocess.py", line 398, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['chattr', '+C', '/home/erick/kvms/images/.mkosi-mzuvrf7o']' returned non-zero exit status 1

mkosi-2

I think it'd be about time for a new release... Just a few PRs and bugs outstanding.

Provide a way to provide build scripts for unsupported distros

It would be awesome if mkosi could be made distribution agnostic! What if there were a distro option called "custom"? So that when invoking mkosi with an option like "--distribution=custom", you have to add some mandatory options like e.g. --image-devel-script and --image-final-script which both points to scripts that does the caching and package managing manually?

I just stumbled upon this project, so I do not yet have a full overview how many steps that would need to have a custom script to make this work. I just thought I should throw this suggestion out to get any input before trying to create a patch :)

ctrl-c while donwloading packages destroys /dev/loop* on the host

:: Proceed with installation? [Y/n] 
:: Retrieving packages...
 linux-api-headers-4.10.1-1-x86_64                                            852.4 KiB  64.9K/s 00:13 [############################################################] 100%
 tzdata-2017b-1-any                                                           235.8 KiB  44.3K/s 00:05 [############################################################] 100%
 iana-etc-20170512-1-any                                                      360.9 KiB  47.5K/s 00:08 [############################################################] 100%
 filesystem-2017.03-2-x86_64                                                   10.2 KiB  16.7K/s 00:01 [############################################################] 100%
^C‣ Unmounting Package Cache...                                               540.7 KiB   199K/s 00:40 [###---------------------------------------------------------]   6%

Interrupt signal received

‣ Unmounting Package Cache complete.
‣ Unmounting image...
‣ Unmounting image complete.
‣ Detaching image file...
‣ Detaching image file complete.
Traceback (most recent call last):
  File "/usr/bin/mkosi", line 2764, in <module>
    main()
  File "/usr/bin/mkosi", line 2760, in main
    build_stuff(args)
  File "/usr/bin/mkosi", line 2712, in build_stuff
    raw, tar, root_hash = build_image(args, workspace, run_build_script=False)
  File "/usr/bin/mkosi", line 2567, in build_image
    install_distribution(args, workspace.name, run_build_script, cached)
  File "/usr/bin/mkosi", line 1090, in install_distribution
    install[args.distribution](args, workspace, run_build_script)
  File "/usr/lib/python3.6/contextlib.py", line 53, in inner
    return func(*args, **kwds)
  File "/usr/bin/mkosi", line 988, in install_arch
    subprocess.run(cmdline, check=True)
  File "/usr/lib/python3.6/subprocess.py", line 405, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "/usr/lib/python3.6/subprocess.py", line 828, in communicate
    self.wait()
  File "/usr/lib/python3.6/subprocess.py", line 1439, in wait
    (pid, sts) = self._try_wait(0)
  File "/usr/lib/python3.6/subprocess.py", line 1386, in _try_wait
    (pid, sts) = os.waitpid(self.pid, wait_flags)
KeyboardInterrupt
Traceback (most recent call last):
  File "/usr/lib/python3.6/weakref.py", line 624, in _exitfunc
    f()
  File "/usr/lib/python3.6/weakref.py", line 548, in __call__
    return info.func(*info.args, **(info.kwargs or {}))
  File "/usr/lib/python3.6/tempfile.py", line 797, in _cleanup
    _shutil.rmtree(name)
  File "/usr/lib/python3.6/shutil.py", line 480, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.6/shutil.py", line 418, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/usr/lib/python3.6/shutil.py", line 418, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/usr/lib/python3.6/shutil.py", line 422, in _rmtree_safe_fd
    onerror(os.rmdir, fullname, sys.exc_info())
  File "/usr/lib/python3.6/shutil.py", line 420, in _rmtree_safe_fd
    os.rmdir(name, dir_fd=topfd)
OSError: [Errno 16] Device or resource busy: 'hugepages'

the host lost all of the /dev/loop* device nodes

$ ls -l /dev/loop-control
ls: cannot access '/dev/loop-control': No such file or directory
$ sudo rmmod loop
$ sudo modprobe loop
$ ls -l /dev/loop-control
crw-rw---- 1 root disk 10, 237 Jun 30 22:53 /dev/loop-control

Unable to use package cache on Arch unless a bogus Release is set

Using the following mkosi.default, alongside to a cache folder mkosi.cache, running mkosi results in an error being related to the lack of release in the [Distribution] key.

$ mkdir mkosi.cache
$ cat mkosi.default
[Distribution]
Distribution=arch
$ mkosi
Traceback (most recent call last):
  File "/usr/bin/mkosi", line 2904, in <module>
    main()
  File "/usr/bin/mkosi", line 2885, in main
    args = load_args()
  File "/usr/bin/mkosi", line 2403, in load_args
    find_cache(args)
  File "/usr/bin/mkosi", line 2269, in find_cache
    args.cache_path = "mkosi.cache/" + args.distribution.name + "~" + args.release
TypeError: must be str, not NoneType

Arch being a rolling distro, there is no such thing as a release (except maybe for the date ?) Checking https://github.com/systemd/systemd/blob/master/.mkosi/mkosi.arch does not reveal any specific syntax that would allow the use of the cache folder.

Putting in a random Release, like "Release=2017-09-06" does skip the aforementioned error, should we automatically try to fill the Release key of mkosi.default in the case of arch ? Or just tolerate the absence of args.distribution.name ?

EROFS on -t subvolume + --read-only

$ sudo mkosi -o /var/lib/machines/mkosi-bug -t subvolume --read-only
# ...
‣ Linking image file...                                                                                   
Traceback (most recent call last):                                                                        
  File "/usr/bin/mkosi", line 2764, in <module>                                                           
    main()                                                                                                
  File "/usr/bin/mkosi", line 2760, in main                                                               
    build_stuff(args)                                                                                     
  File "/usr/bin/mkosi", line 2723, in build_stuff                                                        
    tar.name if tar is not None else None)                                                                
  File "/usr/bin/mkosi", line 1668, in link_output                                                        
    os.rename(os.path.join(workspace, "root"), args.output)                                               
OSError: [Errno 30] Read-only file system: '/var/lib/machines/.mkosi-8t9ahlz_/root' -> '/var/lib/machines/mkosi-bug'                                                                                                 
Traceback (most recent call last):                                                                        
  File "/usr/lib/python3.6/weakref.py", line 624, in _exitfunc                                            
    f()                                                                                                   
  File "/usr/lib/python3.6/weakref.py", line 548, in __call__                                             
    return info.func(*info.args, **(info.kwargs or {}))                                                   
  File "/usr/lib/python3.6/tempfile.py", line 797, in _cleanup                                            
    _shutil.rmtree(name)                                                                                  
  File "/usr/lib/python3.6/shutil.py", line 480, in rmtree                                                
    _rmtree_safe_fd(fd, path, onerror)                                                                    
  File "/usr/lib/python3.6/shutil.py", line 418, in _rmtree_safe_fd                                       
    _rmtree_safe_fd(dirfd, fullname, onerror)                                                             
  File "/usr/lib/python3.6/shutil.py", line 422, in _rmtree_safe_fd                                       
    onerror(os.rmdir, fullname, sys.exc_info())                                                           
  File "/usr/lib/python3.6/shutil.py", line 420, in _rmtree_safe_fd                                       
    os.rmdir(name, dir_fd=topfd)                                                                          
OSError: [Errno 30] Read-only file system: 'home'                                                         

sudo mv /var/lib/machines/.mkosi-8t9ahlz_/root /var/lib/machines/mkosi-bug produces the same error message, so it looks like it’s illegal to move a subvolume .mkosi-* which itself has submodules (home is apparently the first one, hence the last line of the stack trace). But I’m not entirely sure what’s going on here, so don’t trust my analysis too much :)

Running mkosi in jenkins environment

Hello there,

I just wanted to ask, if it is possible to build images via mkosi in jenkins. My first tries ended in a problem with "Detaching namespace" while running in a chroot environment.

My setup is at the moment a running Ubuntu 17.04 workstation, there is a folder with the Ubuntu 17.10 base (same architecture). In this environment I can chroot and install mkosi with "apt-get install mkosi". But running without any command line arguments the above error occure

\u2023 Detaching namespace...
mount: /: not mount point or bad option.
Traceback (most recent call last):
  File "/usr/bin/mkosi", line 2764, in <module>
    main()
  File "/usr/bin/mkosi", line 2759, in main
    init_namespace(args)
  File "/usr/lib/python3.6/contextlib.py", line 52, in inner
    return func(*args, **kwds)
  File "/usr/bin/mkosi", line 128, in init_namespace
    subprocess.run(["mount", "--make-rslave", "/"], check=True)
  File "/usr/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['mount', '--make-rslave', '/']' returned non-zero exit status 32.

Is this in any way possible?

Thanks for reading

Michael (aka BakermanLP)

Fedora 25 build fails: AttributeError: 'Namespace' object has no attribute 'root_partno'

Trying to build a Fedora 25 image fails (running latest git master 10a8cf4).
Although I didn't specify to make use of LUKS (which also wouldn't make sense with a directory/tar output), it seems to end up in luks_setup_all():

# mkosi -d fedora -t tar -o fedora
DISTRIBUTION:
          Distribution: fedora
               Release: 25

OUTPUT:
         Output Format: tar
                Output: /var/tmp/machines/fedora
       Output Checksum: n/a
      Output Signature: n/a
Output nspawn Settings: n/a
        XZ Compression: yes
            Encryption: no
                Verity: no

PACKAGES:
              Packages: none
    With Documentation: no
         Package Cache: none
           Extra Trees: none
          Build Script: none
         Build Sources: /var/tmp/machines
        Build Packages: none
     Post Inst. Script: none
       nspawn Settings: none

VALIDATION:
              Checksum: no
                  Sign: no
               GPG Key: default
              Password: default
\u2023 Detaching namespace...
\u2023 Detaching namespace complete.
\u2023 Setting up package cache...
\u2023 Setting up package cache /var/tmp/machines/.mkosi-383jzcvz complete.
\u2023 Setting up temporary workspace.
\u2023 Temporary workspace in /var/tmp/mkosi-_3jb65z3 is now set up.
Traceback (most recent call last):
  File "/usr/bin/mkosi", line 4, in <module>
    __import__('pkg_resources').run_script('mkosi==1', 'mkosi')
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 719, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1517, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/lib/python3.5/site-packages/mkosi-1-py3.5.egg/EGG-INFO/scripts/mkosi", line 2405, in <module>
  File "/usr/lib/python3.5/site-packages/mkosi-1-py3.5.egg/EGG-INFO/scripts/mkosi", line 2401, in main
  File "/usr/lib/python3.5/site-packages/mkosi-1-py3.5.egg/EGG-INFO/scripts/mkosi", line 2353, in build_stuff
  File "/usr/lib/python3.5/site-packages/mkosi-1-py3.5.egg/EGG-INFO/scripts/mkosi", line 2246, in build_image
  File "/usr/lib64/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/usr/lib/python3.5/site-packages/mkosi-1-py3.5.egg/EGG-INFO/scripts/mkosi", line 403, in luks_setup_all
AttributeError: 'Namespace' object has no attribute 'root_partno'

Running this inside a privileged Fedora 25 Docker container on top of Debian 8.6.
The Docker container was started using:

docker run --tty --interactive --name=mkosi --volume=/var/tmp/machines:/var/tmp/machines --cap-add=SYS_ADMIN fedora /bin/bash 

CAP_SYS_ADMIN is required to make unshare() work, otherwise mkosi would fail like this:

\u2023 Detaching namespace...                                                                                                                                                     
Traceback (most recent call last):
  File "/usr/bin/mkosi", line 1657, in <module>
    main()
  File "/usr/bin/mkosi", line 1652, in main
    init_namespace(args)
  File "/usr/bin/mkosi", line 73, in init_namespace
    unshare(CLONE_NEWNS)
  File "/usr/bin/mkosi", line 67, in unshare
    raise OSError(e, os.strerror(e))
PermissionError: [Errno 1] Operation not permitted

mkosi fails on Python 3.4

mkosi can't be executed on Python 3.4-based distributions (e.g. current Debian stable 8.7 which only ships 3.4.2) due to various Python 3.5 specific items:

  • Line 636:
    Code:
    cmdline += ['--', *cmd]
    
    Error: SyntaxError: can use starred expression only as assignment target
  • Line 724
    Code:
    "--disablerepo=*",
    *repos,
    "--setopt=keepcache=1",
    
    Error: SyntaxError: can use starred expression only as assignment target
  • Line 125
    Code:
    subprocess.run(["mount", "--make-rslave", "/"], check=True)
    
    Error: AttributeError: 'module' object has no attribute 'run'
    Note: The run() method in subprocess was introduced in Python 3.5

Either setup.py needs to be adjusted to check for Python >= 3.5 (leaving Distributions without Python 3.5 unsupported) or the offending items need to be changed to also work with Python < 3.5.

opensuse: curl 60 error when refreshing repositories via zypper

In order to create an opensuse image (sudo mkosi -d opensuse -r 42.2 -t directory -o quux), I had to apply the following patch to mkosi

--- a/mkosi
+++ b/mkosi
@@ -1091,7 +1091,7 @@ def install_opensuse(args, workspace, run_build_script):
     #
     # Install the "minimal" package set.
     #
-    subprocess.run(cmdline + ["-t", "pattern", "minimal_base"], check=True)
+    subprocess.run(cmdline + ["patterns-openSUSE-minimal_base"], check=True)
 
     #
     # Now install the additional packages if necessary.

But then I get the following curl error if I call zypper ref

Abort, retry, ignore? [a/r/i/...? shows all options] (a): ^Cquux:/etc/zypp/repos.d # zypper ref
Download (curl) error for 'https://download.opensuse.org/distribution/leap/42.2/repo/oss/media.1/media':
Error code: Curl error 60
Error message: SSL certificate problem: unable to get local issuer certificate

gitignore logic doesn't grok git submodules

  1. theres a typo that breaks postinst:

-- arg.postinst_script = value
++ args.postinst_script = value

  1. the git ls-files does not work with submodules (--recurse-submodules doesnt work with --others):

-- c = subprocess.run(['git', 'ls-files', '-z', '--others', '--cached',
++ c = subprocess.run(['git', 'ls-files', '-z', '--recurse-submodules', '--cached',

pacman cache not working with directory output

When running mkosi with directory output pacstrap ends up doing a bind mount of the root directory which effectively removes the ability to use the package cache we set up. The line in pacstrap is here:
https://github.com/falconindy/arch-install-scripts/blob/master/common#L82

I'm not sure why pacstrap is doing that. @falconindy ?

Since pacstrap is a thin layer over pacman dealing with mountpoints, cache, etc, maybe mkosi could just use pacman directory?

Error when trying to make Debian image without specifying the release

This strange error appears if I try to make Debian image using mkosi under Debian unstable without specifying the release manually:

error

It looks like the default args.release variable is not correctly parsed. This bug is not present under Ubuntu 16.04 on my another machine.

Here is the full traceback:

Traceback (most recent call last):
  File "/usr/local/bin/mkosi", line 2538, in <module>
    main()
  File "/usr/local/bin/mkosi", line 2534, in main
    build_stuff(args)
  File "/usr/local/bin/mkosi", line 2486, in build_stuff
    raw, tar, root_hash = build_image(args, workspace, run_build_script=False)
  File "/usr/local/bin/mkosi", line 2384, in build_image
    install_distribution(args, workspace.name, run_build_script)
  File "/usr/local/bin/mkosi", line 1015, in install_distribution
    install[args.distribution](args, workspace, run_build_script)
  File "/usr/lib/python3.5/contextlib.py", line 30, in inner
    return func(*args, **kwds)
  File "/usr/local/bin/mkosi", line 833, in install_debian
    install_debian_or_ubuntu(args, workspace, run_build_script, args.mirror)
  File "/usr/local/bin/mkosi", line 778, in install_debian_or_ubuntu
    subprocess.run(cmdline, check=True)
  File "/usr/lib/python3.5/subprocess.py", line 398, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['debootstrap', '--verbose', '--merged-usr', '--variant=minbase', '--include=systemd-sysv', '--exclude=sysv-rc,initscripts,startpar,lsb-base,insserv', '--components=main', '"9"', '/var/tmp/mkosi-488qxli3/root', 'http://httpredir.debian.org/debian']' returned non-zero exit status 1

Debian/Ubuntu: dbus not installed

debootstrap does not install dbus, probably because it only installs required dependencies of the --included packages (systemd recommends dbus, but doesn’t require it). This means that the new image can’t be controlled with machinectl shell or machinectl login.

Ubuntu 17.10 Incorrect Debootstrap Script

Building on #84, to get around the '--merged-usr' option I've upgraded Ubuntu to 17.10.

However,

Mkosi simply needs to find the proper script, and I believe this should work.

To reproduce, simply run 'mkosi' on Ubuntu 17.10.

is --build-sources broken?

I use --build-sources $PATHTOSOURCES to point mkosi to the sources. This seems to no longer work, and instead i now additionally have to specify -C $PATHTOSOURCES or else it will not find the sources

openSUSE build does not respect mirror option/config

I noticed this while looking through http(s) URLs in mkosi after #71install_opensuse uses hardcoded URLs, while the other distributions use args.mirror, which is filled in with default URLs in load_args. It seems to me that openSUSE should do this as well.

Wrong release detect

I have Ubuntu 17.04. mkosi fails on my machine because it tries to run debootstrap with "17.04" as a release. If I run debootstrap manually, it's saying E: No such script: /usr/share/debootstrap/scripts/17.04. I'm pretty sure it should be zesty, not "17.04"

opensuse: bad URL

Hi, I tried to make an opensuse image under fedora 26 and got this error message:

Download (curl) error for 'https://download.opensuse.org/update/tumbleweed/repodata/repomd.xml':
Error code:  Bad URL
Error message: Protocol "http" not supported or disabled in libcurl

mkosi from git master. How can I fix that?

Fedora 25 image is not bootable (virtio hard disk drivers missing)

I'm using mkosi as packaged in Fedora 25 (version 1.fc25):

sudo mkosi -d fedora -r 25 -b -t raw_gpt --password root  -o /srv/nspawn/f25.img

Booting this in QEMU (with -bios /usr/share/edk2/ovmf/OVMF_CODE.fd times out waiting for dev-gpt\x2dauto\x2droot.device

Screenshot

/dev/disk/ only has a symlink for sr0 (the CD drive), there are no /sys/block/* devices other than sr0. It seems the generated initramfs is lacking the drivers for the QEMU virtio hard disks?

mkosi -i raises OSError with Format=directory when trying to copy /var/run/minissdpd.sock from cache

To reproduce:

mkosi.default

[Distribution]
Distribution=debian
Release=stretch

[Output]
Format=directory

[Packages]
Packages=

mkosi.build

touch $DESTDIR/share/test

Checked out from master (40df6a3), ran:

mkosi -i

Traceback:

Traceback (most recent call last):
  File "./mkosi", line 2883, in <module>
    main()
  File "./mkosi", line 2879, in main
    build_stuff(args)
  File "./mkosi", line 2825, in build_stuff
    raw, tar, root_hash = build_image(args, workspace, run_build_script=True)
  File "./mkosi", line 2680, in build_image
    cached = reuse_cache_tree(args, workspace.name, run_build_script, for_cache, cached)
  File "./mkosi", line 2644, in reuse_cache_tree
    enumerate_and_copy(fname, os.path.join(workspace, "root"))
  File "./mkosi", line 1270, in enumerate_and_copy
    enumerate_and_copy(source, dest, suffix + "/" + entry.name)
  File "./mkosi", line 1270, in enumerate_and_copy
    enumerate_and_copy(source, dest, suffix + "/" + entry.name)
  File "./mkosi", line 1277, in enumerate_and_copy
    shutil.copy(entry.path, dest_path, follow_symlinks=False)
  File "/usr/lib/python3.5/shutil.py", line 241, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.5/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
OSError: [Errno 6] No such device or address: 'image.cache-pre-dev/var/run/minissdpd.sock'

Host os is debian sid.

mkosi should be made compatible with a host with SELinux enabled

RHBZ#1374427 equally affects mkosi. mkosi was written, in part, for testing modifications to systemd. But this issue means systemd's HACKING instructions do not work, on a default Fedora install.

mkosi does not request installation of selinux support in images, and deliberately disables it. This seems correct when using mkosi to develop systemd or any other software. Any modification to systemd could fail, until the downstream distribution updates their SELinux policy to support it.

However dnf still tries to assign SELinux labels to the installed files. When running the image the labels cause SELinux transitions, e.g. when running passwd. We don't want this, and it causes failures. This behaviour of dnf --installroot under SELinux was included in the above report. Sadly this did not elicit any suggestion of how to use dnf --installroot and get consistent SELinux labels, let alone disable the labelling as mkosi would want.

When a user creates a Fedora image using dnf, they can very simply work around the issue using restorecon or possibly fixfiles. The mkosi tool could do something similar. The files in the image could be relabelled using chcon unconfined_u:object_r:unlabeled_t:s0 -R. unlabeled_t is the value shown for files which have no context xattr. This might be desirable, to avoid unnecessary differences between images generated on systems with SELinux enabled v.s. disabled. (Or it could use default_t, the label assigned when you create a new directory underneath /).

Assigning labels is only possible on the system which has SELinux configured. Therefore this needs to be done conditionally, and not from inside a container. Without SELinux (e.g inside a container):

-bash-4.4# chcon unconfined_u:object_r:unlabeled_t:s0 / 
chcon: invalid context: 'unconfined_u:object_r:unlabeled_t:s0': No such file or directory

In theory, at least the unconfined_u:object_r: part is policy-specific. As is the ability for "unconfined" processes to access unlabeled_t files without interference. So this is not a universal solution for any SELinux policy. However it should make mkosi usable on popular Linux systems and the SELinux reference policy.

Specific failure

$ rpm -q mkosi
mkosi-2-1.fc26.noarch
  1. mkosi
  2. systemd-nspawn -b -i image.raw # oops, I need to set a root password to log in
  3. systemd-nspawn -i image.raw
  4. passwd
-bash-4.4# passwd
passwd: Can not identify you!
-bash-4.4# passwd -u root
passwd: Unknown user name 'root'.

AVC denial:

  • SELinux is preventing passwd from read access on the file passwd.
  • Source Context unconfined_u:unconfined_r:passwd_t:s0-s0:c0.c1023
  • Target Context system_u:object_r:unlabeled_t:s0
-bash-4.4# ls -Z /etc/passwd
system_u:object_r:unlabeled_t:s0 /etc/passwd
-bash-4.4# ls -Z /usr/bin/passwd
system_u:object_r:passwd_exec_t:s0 /usr/bin/passwd

login failed with user password set using mkosi.postinst

I'm trying to build an image with a user/password already set using mkosi.postinst. I thought that this file worked fine, since the container I had already built seems to have everything ok (user home directory correctly created); but in the container I could not test the password login, since I need to log in the container as root (right?) and then I switch to the user with su.

As you can see in this branch, I've now added to my project a new file to generate a full VM image with a desktop environment included. I've built the image and launched it with qemu. The login appears and I see the user (dev) created by the postinst script. So far so good. But when I enter the password, I get "login failed".

What might be wrong?

Thanks in advance

Purging the machine-id is incompatible with bootloader installation

Commit f5cafba removed machine-id. The next step, installation of the kernel in boot, fails:

‣ Installing boot loader...
Could not determine your machine ID from /etc/machine-id.
Please run 'systemd-machine-id-setup' as root. See man:machine-id(5)

Those options are fundamentally incompatible. Should we disable machine-id purging if bootable=yes?

Traceback: TypeError: chmod: path should be string, bytes, os.PathLike or integer, not NoneType

I use mkosi git master (currently at commit a499812) on Fedora 26.

The traceback happens when running mkosi -if:

‣ Installing cache copy ...        
Traceback (most recent call last): 
  File "/usr/bin/mkosi", line 2904, in <module>                       
    main()                         
  File "/usr/bin/mkosi", line 2900, in main                           
    build_stuff(args)              
  File "/usr/bin/mkosi", line 2833, in build_stuff                    
    args.cache_pre_dev)            
  File "/usr/bin/mkosi", line 1751, in save_cache                     
    os.chmod(raw, 0o666 & ~args.original_umask)                       
TypeError: chmod: path should be string, bytes, os.PathLike or integer, not NoneType

My mkosi.default:

[Distribution]
Distribution=fedora
Release=26

[Output]
ReadOnly=yes

[Validation]
Password=something-else

image cache files are being copied into the target image if not running from a git project

That one's pretty fun:

            if use_git:
                copy_git_files(args.build_sources, target, git_files=args.git_files)
            else:
                ignore = shutil.ignore_patterns('.git', '.mkosi-*')
                shutil.copytree(args.build_sources, target, symlinks=True, ignore=ignore)

This means that in a non-git folder, raw images are being copied into it, resulting in an out of space error.

$ ls
$ image.raw.cache-pre-dev  image.raw.cache-pre-inst  mkosi.build  mkosi.default
$ sudo mkosi -if
...
‣ Detaching image file complete.
...
[Errno 28] No space left on device'

mkosi.default syntax requires documentation

Got confused trying to understand how to convert CLI arguments (e.g. --with-network) to the config file syntax (WithNetwork=yes), documentation should be improved a bit.

Support physical devices

At the moment, mkosi can't operate physical devices directly. Running mkosi -o /dev/sdX will give an error in the final stage (Linking image...) because of the way image creation is implemented in mkosi.

Being able to write to physical devices, mkosi can have many useful applications, from creating live USBs to bare-metal server provisioning. At the same time, it shouldn't be hard to implement, as with physical devices we don't need all that loopback stuff.

Surely it is possible to dd an image to the disk, but there's no good solution for large disks. You'll either end up with a huge (probably TB-sized) image, or you can build smaller image and resize GPT+partitions+filesystems afterwards (and any additional manual steps like these could be undesirable from the point of view of automation).

Source copying is borked when there are modified symlinks

May be related to #123? Steps to reproduce:

% git clone https://github.com/systemd/systemd.git
% cd systemd
% ln -sf .mkosi/mkosi.debian mkosi.default
% sudo mkosi
# snip lots of output
‣ Copying in build script and sources...
Cloning into '/var/tmp/mkosi-3nz7dw74/root/root/src'...
warning: --depth is ignored in local clones; use file:// instead.
done.
‣ Unmounting Package Cache...
‣ Unmounting Package Cache complete.
‣ Unmounting image...
‣ Unmounting image complete.
‣ Detaching image file...
‣ Detaching image file complete.
Traceback (most recent call last):
  File "/usr/bin/mkosi", line 2904, in <module>
    main()
  File "/usr/bin/mkosi", line 2900, in main
    build_stuff(args)
  File "/usr/bin/mkosi", line 2846, in build_stuff
    raw, tar, root_hash = build_image(args, workspace, run_build_script=True)
  File "/usr/bin/mkosi", line 2706, in build_image
    install_build_src(args, workspace.name, run_build_script, for_cache)
  File "/usr/bin/mkosi", line 1361, in install_build_src
    copy_git_files(args.build_sources, target, git_files=args.git_files)
  File "/usr/bin/mkosi", line 1339, in copy_git_files
    shutil.copy2(src_path, dest_path, follow_symlinks=False)
  File "/usr/lib/python3.5/shutil.py", line 257, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.5/shutil.py", line 118, in copyfile
    os.symlink(os.readlink(src), dst)
FileExistsError: [Errno 17] File exists: '.mkosi/mkosi.debian' -> '/var/tmp/mkosi-3nz7dw74/root/root/src/mkosi.default'

cc @lucasdemarchi

`mkosi -d debian -t directory -o debian-jessie-base` fails due to "debootstrap" issue

Trying to create a Debian filesystem image using:

mkosi -d debian -t directory -o debian-jessie-base

It ends up failing like this:

I: Extracting liblzma5...
I: Extracting zlib1g...
W: Failure trying to run: chroot /var/tmp/machines/.mkosi-rpqjha2m/root dpkg-deb -f /var/cache/apt/archives/dpkg_1.18.23_amd64.deb Version
W: See /var/tmp/machines/.mkosi-rpqjha2m/root/debootstrap/debootstrap.log for details
W: Failure trying to run: chroot /var/tmp/machines/.mkosi-rpqjha2m/root mount -t proc proc /proc
W: See /var/tmp/machines/.mkosi-rpqjha2m/root/debootstrap/debootstrap.log for details
‣ Unmounting Package Cache...
‣ Unmounting Package Cache complete.
Traceback (most recent call last):
  File "/root/mkosi/mkosi", line 2533, in <module>
    main()
  File "/root/mkosi/mkosi", line 2529, in main
    build_stuff(args)
  File "/root/mkosi/mkosi", line 2481, in build_stuff
    raw, tar, root_hash = build_image(args, workspace, run_build_script=False)
  File "/root/mkosi/mkosi", line 2379, in build_image
    install_distribution(args, workspace.name, run_build_script)
  File "/root/mkosi/mkosi", line 1012, in install_distribution
    install[args.distribution](args, workspace, run_build_script)
  File "/usr/lib64/python3.5/contextlib.py", line 30, in inner
    return func(*args, **kwds)
  File "/root/mkosi/mkosi", line 832, in install_debian
    install_debian_or_ubuntu(args, workspace, run_build_script, args.mirror)
  File "/root/mkosi/mkosi", line 777, in install_debian_or_ubuntu
    subprocess.run(cmdline, check=True)
  File "/usr/lib64/python3.5/subprocess.py", line 398, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['debootstrap', '--verbose', '--variant=minbase', '--include=systemd-sysv', '--exclude=sysv-rc,initscripts,startpar,lsb-base,insserv', '--components=main', 'unstable', '/var/tmp/machines/.mkosi-rpqjha2m/root', 'http://httpredir.debian.org/debian']' returned non-zero exit status 1

Running it manually and then inspecting the log shows this:

--2017-03-25 00:46:05--  http://httpredir.debian.org/debian/pool/main/z/zlib/zlib1g_1.2.8.dfsg-5_amd64.deb
Resolving httpredir.debian.org (httpredir.debian.org)... 140.211.166.202, 149.20.4.15, 5.153.231.4, ...
Connecting to httpredir.debian.org (httpredir.debian.org)|140.211.166.202|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://cdn-fastly.deb.debian.org/debian/pool/main/z/zlib/zlib1g_1.2.8.dfsg-5_amd64.deb [following]
--2017-03-25 00:46:06--  http://cdn-fastly.deb.debian.org/debian/pool/main/z/zlib/zlib1g_1.2.8.dfsg-5_amd64.deb
Resolving cdn-fastly.deb.debian.org (cdn-fastly.deb.debian.org)... 151.101.12.204, 2a04:4e42:3::204
Connecting to cdn-fastly.deb.debian.org (cdn-fastly.deb.debian.org)|151.101.12.204|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 87522 (85K) [application/x-debian-package]
Saving to: ‘/var/tmp/machines/.mkosi-rpqjha2m/root//var/cache/apt/archives/partial/zlib1g_1%3a1.2.8.dfsg-5_amd64.deb’

     0K .......... .......... .......... .......... .......... 58% 4.16M 0s
    50K .......... .......... .......... .....                100% 20.0M=0.01s

2017-03-25 00:46:06 (6.20 MB/s) - ‘/var/tmp/machines/.mkosi-rpqjha2m/root//var/cache/apt/archives/partial/zlib1g_1%3a1.2.8.dfsg-5_amd64.deb’ saved [87522/87522]

dpkg-deb (subprocess): unable to execute tar (tar): No such file or directory
dpkg-deb: error: subprocess tar returned error exit status 2
chroot: failed to run command ‘mount’: No such file or directory

Running debootstrap manually a 2nd time succeds, so this seems to be some kind of weird issue where $PATH isn't re-hashed during an update and doesn't find tar or so, but I can't really make any sense of it… I'm not even sure whether this is purely an upstream issue or related to the way mkosi runs debootstrap.

OS: Fedora 25
mkosi git master @ d5ad357

Support NetworkManager on Arch images

Currently, systemd-networkd is unconditionally used when installing an Arch system; i am deploying NetworkManager inside my image, so i don't want networkd or resolved to be setup.

RFE: Support setting hostname, locale and timezone

At the moment, generated image ends up with the following settings:

  • hostname: localhost
    This comes from /etc/hostname which belongs to systemd RPM and contains "localhost" (however may be specific to my distro, Mageia). If the image is used as a systemd-nspawn bootable container, this static hostname prevents the transient hostname (= machine name) to be set correctly (as of systemd-230). Hence, the hostname may need to be set for VMs and to be unset for containers;
  • locale: (not set)
  • timezone: inherited from the build machine (?)

It would be nice to have an ability to configure this all on the image building stage. However, this can be tricky, since hostnamectl/localectl/timedatectl all require running systemd inside the image.

Is there any use for luks support?

I have created a fork and added basic luks support in order to boostrap images that are fulldiskencrypted. I'm using mkosi to bootstrap images which i can later copy on bare metal machines (or VMs). I'm aware of the fact, that systemd-nspawn doesn't support luks partitions and i'm not sure if it makes any sense to use encrypted partitions in containers. I just wanted to mention my fork and ask if it makes sense beyond bootstraping bare metal images. If so, i could clean up my code and create a pull request.

run_workspace_command runs in a private network, breaking apt-get

Commit 305b6e4 introduced run_workspace_command. This function sets --private-network, and thus breaks the apt-get command in install_debian_or_ubuntu.

I wonder why is it important to set --private-network? Or should the function have an optional parameter specifying whether the network should be private?

RFE: add another hook script, that can install python/perl/php packages, i.e. those not covered by RPM/DEB

Some python packages are not provided by distros but are rather installed via pip and friends. I think the same apply for npm but I don't use it so don't really know.

How would be the proper way to install them on the image?

  1. Package them on the distro: it'd be good, but the chances of getting outdated packages is high since the python packages are controlled by upstream
  2. Have a PythonPackages section in the config and --python-packages switch that will a) add the corresponding pip package for the distro and install them after the normal distro packages are installed
  3. Use a prefix for packages: pip:pymavlink, for example, would install pymavlink using pip; pip2:pymavlink would install pymavlink using pip2. There could be a key in the configuration to tell what command to use to install packages with each external package manager, like: ExternalPackageManager = pip:'pip install {}'

Thoughts?

Failing to run mkosi on Fedora 24

I installed mkosi by cloning the repo and running python setup.py install. But when I try to run it, fails like this

[root@systemd-dev systemd]# mkosi
DISTRIBUTION:
          Distribution: fedora
               Release: 24

OUTPUT:
         Output Format: raw_btrfs
                Output: /root/systemd/image.raw
       Output Checksum: n/a
      Output Signature: n/a
Output nspawn Settings: n/a
             Read-only: no
        FS Compression: no
        XZ Compression: no

PACKAGES:
              Packages: none
    With Documentation: no
         Package Cache: /var/tmp/dnf-cache
           Extra Trees: none
          Build Script: /root/systemd/mkosi.build
         Build Sources: /root/systemd
        Build Packages: audit-libs-devel
                        autoconf
                        automake
                        bzip2-devel
                        cryptsetup-devel
                        dbus-devel
                        docbook-style-xsl
                        elfutils-devel
                        gcc
                        git
                        gnu-efi
                        gnu-efi-devel
                        gnutls-devel
                        gperf
                        intltool
                        iptables-devel
                        kmod-devel
                        libacl-devel
                        libblkid-devel
                        libcap-devel
                        libcurl-devel
                        libgcrypt-devel
                        libidn-devel
                        libmicrohttpd-devel
                        libmount-devel
                        libseccomp-devel
                        libselinux-devel
                        libtool
                        libxkbcommon-devel
                        libxslt
                        lz4-devel
                        make
                        pam-devel
                        pkgconfig
                        python3-devel
                        python3-lxml
                        qrencode-devel
                        xz-devel
       nspawn Settings: none

PARTITIONS:
              Bootable: yes
        Root Partition: 2.0G
        Swap Partition: (disabled)
                   ESP: 256.0M
       /home Partition: (disabled)
        /srv Partition: (disabled)

VALIDATION:
              Checksum: no
                  Sign: no
               GPG Key: default
‣ Detaching namespace...
Traceback (most recent call last):
  File "/usr/bin/mkosi", line 4, in <module>
    __import__('pkg_resources').run_script('mkosi==1', 'mkosi')
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 724, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1657, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/lib/python2.7/site-packages/mkosi-1-py2.7.egg/EGG-INFO/scripts/mkosi", line 1380, in <module>

  File "/usr/lib/python2.7/site-packages/mkosi-1-py2.7.egg/EGG-INFO/scripts/mkosi", line 1375, in main

  File "/usr/lib/python2.7/site-packages/mkosi-1-py2.7.egg/EGG-INFO/scripts/mkosi", line 59, in init_namespace

AttributeError: 'module' object has no attribute 'run'

Should I install mkosi in some other way?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.