progmaticltd / homebox

A set of ansible scripts to build a personal mail server / private cloud / etc.
https://homebox.space/
GNU General Public License v3.0
461 stars 52 forks source link

Building iso fails, apt-key must be run as root #351

Closed besendorf closed 3 years ago

besendorf commented 3 years ago

I tired building an iso today but the installation failed with the following error:

Step 18/21 : RUN cd /tmp/build-homebox && ./build-mirror.sh
 ---> Running in f3866c1f04ed
+ DIST=stretch
+ LOCALE=de_DE                                                                                                                                                                       
+ MIRROR=http://ftp2.de.debian.org/debian//debian/                                                                                                                                   
+ COMMON_OPTS='--debian-mirror http://ftp2.de.debian.org/debian//debian/ --locale de_DE --dist stretch --debug'                                                                      
+ cp /usr/share/keyrings/debian-archive-keyring.gpg /home/cdbuild/                                                                                                                   
+ apt-key --keyring /home/cdbuild/debian-archive-keyring.gpg del ED6D65271AACF0FF15D123036FB2A1C265FFB764                                                                            
E: This command can only be used by root.                                                                                                                                            
+ MIRROR_OPTIONS='--do-mirror --debian-mirror http://ftp2.de.debian.org/debian//debian/ --locale de_DE --dist stretch --debug --mirror-only --keyring ~/debian-archive-keyring.gpg'  
+ simple-cdd --do-mirror --debian-mirror http://ftp2.de.debian.org/debian//debian/ --locale de_DE --dist stretch --debug --mirror-only --keyring '~/debian-archive-keyring.gpg'      
2020-11-01 20:26:56,980 DEBUG Reading configuration...                                                                                                                               
2020-11-01 20:26:56,981 WARNING keyring file ~/debian-archive-keyring.gpg does not exist                                                                                             
2020-11-01 20:26:56,981 DEBUG Checking configuration...                                                                                                                              
2020-11-01 20:26:57,077 DEBUG Creating build environment in /tmp/build-mail...                                                                                                       
2020-11-01 20:26:57,078 WARNING keyring file ~/debian-archive-keyring.gpg does not exist
2020-11-01 20:26:57,082 DEBUG Building local Debian mirror for debian-cd...
2020-11-01 20:26:57,083 DEBUG downloading: /tmp/build-mail/tmp/mirror/extrafiles
Traceback (most recent call last):
  File "/usr/bin/simple-cdd", line 658, in <module>
    scdd.build_mirror()
  File "/usr/bin/simple-cdd", line 270, in build_mirror
    self.run_tool("mirror", tool)
  File "/usr/bin/simple-cdd", line 367, in run_tool
    tool.run()
  File "/usr/lib/python3/dist-packages/simple_cdd/tools/mirror_wget.py", line 64, in run
    _download(download_extrafiles_file, extrafiles_file_inlinesig)
  File "/usr/lib/python3/dist-packages/simple_cdd/tools/mirror_wget.py", line 55, in _download
    request.urlretrieve(url, filename=output)
  File "/usr/lib/python3.5/urllib/request.py", line 188, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "/usr/lib/python3.5/urllib/request.py", line 163, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.5/urllib/request.py", line 472, in open
    response = meth(req, response)
  File "/usr/lib/python3.5/urllib/request.py", line 582, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.5/urllib/request.py", line 510, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 590, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
ERROR: Service 'cdbuild' failed to build : The command '/bin/sh -c cd /tmp/build-homebox && ./build-mirror.sh' returned a non-zero code: 1
chgrp: die Gruppe von '/tmp/homebox-images' wird geändert: Die Operation ist nicht erlaubt
Unable to find image 'cdbuild:latest' locally
docker: Error response from daemon: Get "https://registry-1.docker.io/v2/library/cdbuild/manifests/latest": EOF.
See 'docker run --help'.

system.yml:


---
# Example file to create an ISO image installer with Debian preseed.

# 1. Setup SSH authentication:
# Copy your public key in "preseed/misc/root/.ssh/authorized_key".
# This key will be copied into the /root/.ssh/authorized_keys for you to connect to your linux server

# 2. Customisation:
# Copy this file to common.yml, and modify the values accordingly
# You can use a dedicated Linux machine as an ISO image builder, or use your workstation.
# Associated with libvirt, and snapshots, it can be used as a development environment for the mail server.

# 3. Build the ISO image
# Example of a command to run to build the ISO image
# ansible-playbook -v -i ../config/hosts.yml playbooks/build-cd.yml
# This will create the ISO images in /tmp folder. Use the DVD one for automatic installation.

# 4. Use a physical server or a VM to run the Debian installer.
# The whole installation should be automatic, with LVM and software RAID
# For LVM, there is a volume called "reserved" you can remove. This will let
# you resize the other volumes according to your needs.

# 5. See the documentation and the Ansible scripts into the install folder to install the mail server platform.

# Remember: http://imgs.xkcd.com/comics/security.png
# So, here some good passphrases:
# - Can I have some water, please?
# - I am tired, I want to sleep.
# - I will not give you my password.
# - etc...

# System configuration sample 1: Encrypted hard drive
# system:
#   hostname: mail
#   preseed: luks
#   version: 9.6
#   arch: amd64
#   boot_timeout: 5   # In seconds
#   passphrase: I will not give you my password
#   hw:
#     disks:
#       - name: vda
#         size: 500G

# System configuration sample 2: Software RAID
# WORK IN PROGRESS, NOT FULLY TESTED YET
# TODO: Add encryption support (ecryptfs?)
# system:
#   hostname: mail
#   preseed: raid
#   version: 9.6
#   arch: amd64
#   boot_timeout: 5   # In seconds
#   hw:
#     disks:
#       - name: vda
#         size: 500G
#       - name: vdb
#         size: 500G

#System configuration sample 3: Simple LVM WORK IN PROGRESS, NOT FULLY TESTED YET
system:
  hostname: mail
  preseed: lvm
  version: 9.6
  arch: amd64
  boot_timeout: 5   # In seconds
  hw:
    disks:
      - name: vda
        size: 100G

# The proxy is optional. When specified, it is used to configure apt
network:
  # proxy:               # something like http://proxy.example.com:3128/
  domain: example.com
  iface: auto            # or use eth0, ens3, etc...

# Country and locales definition
country:
  code: de
  timezone: Europe/Berlin

locale:
  id: de_DE
  language: de
  country: DE
  charset: UTF-8
  keymap: de

# Repository specific values
repo:
  release: stretch
  main:  ftp2.de.debian.org/debian/
  security: security.debian.org
  sections: main contrib non-free

# Clock parameters
clock:
  utc: true
  ntp: true

# Accounts informations
# You can choose a strong password here,
root:
  password: xxx

# Where to put the ISO image once built. If You are doing development, you can copy it to
# the libvirt/images folder.
# You should have the right to write in ths folder.
# cdimage:
#   destination: '/var/lib/libvirt/images/'

# Debug: As it states
debug: true
arodier commented 3 years ago

Yes, the command that runs to build the ISO image need to activate some repositories. Try to comment the line?

arodier commented 3 years ago

I will try to build the ISO myself.

besendorf commented 3 years ago

Could you figure something out?

arodier commented 3 years ago

No, we can have a call tomorrow, with a screen share. Send an email to me at a‎nd‎re‎‎@‎ro‎di‎er‎.m‎e to organise it.

arodier commented 3 years ago

I can reproduce the error if the user I run the docker command is not in the docker group. Make sure your user is in the docker group, with the following command, as root:

# adduser besendorf docker

Then, logout of the session (or even reboot your computer) and try again.