To content | To menu | To search

Saturday, October 1 2022

Pogoplug に Debian GNU/Linux をインストールする

技研ベースさんで開催された「技研フリマ」で購入した、ジャンク扱いの Pogoplug に Debian GNU/Linux をインストールした。とりあえず USB メモリからの起動まで。

個体は Pogoplug POGO-P25 。こちら で紹介されているものと恐らく同じ。

ジャンク扱いで買ったのでアカウントは無し。

Continue reading...

Friday, September 30 2022

Xilinx Vivado のプロジェクトのクリーンアップ

tcl コンソールでreset_project をするといいらしい。

Monday, September 26 2022

Windows でのパーティションの冗長化とバックアップの検討

しばらく何も起きなかったので、しばらく何も対策していなかったら、ディスクがクラッシュして3か月分のメールと一部のドキュメントが無くなった。ので、久しぶりにちゃんと考えてみる。

環境はとりあえず Windows 10 Pro 64bit 。とりあえず仕事の環境(会社では特に規定は無い)。

ローカルは未対策だった。ファイルサーバーは対策されている(らしい)ものの、容量はいつも不足気味。


今回は HDD が壊れたので、そのレベルでの対策はしたい。

全部 RAID6 にすれば多分早いものの、できるだけ安価に済ませたい。

となるとやはり Windows では記憶域スペースになりそう。自分の中ではソフトウェア RAID +αという認識。

とりあえず手元の 1GB HDD 1台、使用量が少なかったのでその内容を待避。追加の 1GB HDD と外付け USB HDD ケース(2台入るもの)を購入。

記憶域プールは一度設定すると回復性の設定は変えられないらしい。難しいのは分かる。今回は2台で双方向ミラー。


ファイルシステムレベルでは Windows for Workstation にアップグレードして ReFS を使うのがいいらしい。今回は保留。


冗長性を持ったドライブに何を入れよう。

調べた範囲では、ホームのフォルダまるごと指定とはいかないようで、ドキュメントやピクチャなどを一つずつ指定するしかないらしい。

とりあえず Documents、Pictures、Videos は使う可能性があるのでこっちに移動。

メーラーの Thunderbird はプロファイルディレクトリの指定ができるのでそれで切り替え。

全く推奨されない手順だけれど、C:\Users\ユーザー名\AppData\Roaming\Thunderbird にあるinstalls.ini とprofile.ini にある、プロファイルのフォルダをこっちに *コピー* して、各ファイルに書かれているフォルダ名を書き換え。

とは単純には行かなかった。フォルダ区切りは \ じゃなく / なので、そのままパスをコピーすると、元のプロファイルが全て移動され、新しくそこにプロファイルが作られる罠があった。消されたかと思って驚いた。Thunderbird を起動し直すと Profile manager が起動するので、新しいプロファイルを作成、その際にコピーしたプロファイルのディレクトリを指定すると良い。

開発系は頭が痛い。いちいち容量を喰うので全部はいれられない。作業には使えないので、バージョン管理システムのリポジトリを置くのがやっとか。

そのバージョン管理システムに何を使うか考えなければ。


バックアップも考えよう。

まず内容。

大昔にやろうとしたときは全部の履歴をとろうとしていたけれど、それはきっと無駄。最新と、せいぜいあと1回昔のがあれば多分いいと思う。

ツールやバッチを帰り際に実行して終わったら自動的にシャットダウン、という流れならまだやってられるか。自動化しないことには続かない。

コミットしてない作業をリストアップしてくれれば上出来。

メモ。robocopy コピー元 コピー先 /E /XJ /V /Log:log.txt でシンボリックリンクをスキップ。


ファイルの置き方も実のところ適当でいつも困ってたので、これも何とかするべきだろう。

Tuesday, September 20 2022

HDD が壊れたので復旧させようとした話

今年4月頃に購入した、東芝の 3.5インチ SATA HDD MN08ADA800/JP が壊れたよう。

二つのパーティションを作っていたうち片方が Windows 上でエラーになり、自動復旧にまかせていたものの、最終的には Windows 起動時に HDD にアクセスしっぱなしになり起動できなくなった。

内部の SATA 接続だったので、後から接続して OS から認識させる、ということもできない(外付け HDD ケースはあったので、横着しただけ)。

とりあえず同じ容量(偶然同じ型番)の HDD を購入し、外付け HDD ケースで USB 接続。

Ubuntu Desktop を LiveDVD で起動し、ddrescue で問題の HDD から新しい HDD へコピー。

参考にしたのは「HDDを救済するぞ(Windows+Cygwin+ddrescue編)」。リトライはこの状況では増やしても意味が無さそうだったので、2回目は同じように -r1 を指定しても良かったと思う。

8TB で、1回目が26時間ほど、2回目も8時間以上かかった。エラーはこの時点で 4MB 程。

ddrescueview もインストールすると、HDD 内の問題のマップも見られる。

問題の HDD を UEFI で切り離し、外付け HDD も一旦電源を切る。

Windows を起動した後外付け HDD を接続してしばらくすると、同じパーティションに問題がある(問題付きでコピーしてくれたから当然だ)、とメッセージがでてきたので、修復を指示。ただし再起動時ではなくその場で修復させた。

念のためもう一つのパーティションもチェックをかけた後再起動したら、とりあえず Windows の起動に支障はなくなった模様。

Tuesday, September 6 2022

Petalinux のための vagrant 環境のスクリプトを作った

検索しても参照されていないようなのでこちらから。

takagiwa/petalinuxenv

Continue reading...

Tuesday, August 30 2022

matomo でログインしようとすると「フォームのセキュリティに失敗しました。」エラーになった

環境は FreeBSD 13.1-RELEASE-p1 と nginx/1.22.0 。

Jail を使って、host と hosted の両方に nginx を入れて reverse proxy を構成。

Continue reading...

Wednesday, August 24 2022

Raspberry Pi のデスクトップを BeOS 風にする

参考にしたサイトは Make Linux look like BeOS から [Xfce4] BeOS-r5-XFCE など。

2022/Sep/18 修正。

2024/Jan27 新しいページ

2024/Feb/17 さらに更新

Continue reading...

Tuesday, August 23 2022

Zybo Z7 の Petalinux で USBメモリを使いたい

Zybo Z7 には限らないけれど

petalinux 2018.2 添加u盘 ここの通りにやってできた。

petalinux-config を終えたら project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi を編集。

/include/ "system-conf.dtsi"
/ {
};
/{
usb_phy0: usb_phy@0 {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
};
};

&usb0 {
dr_mode = "host";
usb-phy = <&usb_phy0>;
};

(念のためもう一度 petalinux-config をしたけど不要だと思う)

そして petalinux-build をしたイメージで起動したら USBメモリが認識された。

Zybo Z7 向け BSP を使うときの問題

まずはうち固有で git のポートがファイアウォールで塞がれて time out になる場合。参考

  • project-spec/meta-user/recipes-apps/digilent-apps/gpioutil/gpioutil.bb
  • project-spec/meta-user/recipes-apps/digilent-apps/libpwm/libpwm.bb
  • project-spec/meta-user/recipes-apps/digilent-apps/libuio/libuio.bb
  • project-spec/meta-user/recipes-apps/digilent-apps/kmsdemo/kmsdemo.bb
  • project-spec/meta-user/recipes-apps/digilent-apps/libgpio/libgpio.bb
  • project-spec/meta-user/recipes-apps/digilent-apps/pwmdemo/pwmdemo.bb
  • project-spec/meta-user/recipes-apps/digilent-apps/libvrc/libvrc.bb

これらのファイルを編集。

SRC_URI = "git://github.com/digilent/pwmdemo.git \

これをこんな風に。

SRC_URI = "git://github.com/digilent/pwmdemo.git;protocol=https \

次は U-BOOT 関係でエラーがでる。参考

WARNING: u-boot-xlnx-v2017.01-xilinx-v2017.4+gitAUTOINC+42deb242f9-r0 do_fetch: Failed to fetch URL git://github.com/digilent/u-boot-digilent.git;protocol=https;branch=master, attempting MIRRORS if available
ERROR: u-boot-xlnx-v2017.01-xilinx-v2017.4+gitAUTOINC+42deb242f9-r0 do_fetch: Fetcher failure: Unable to find revision 42deb242f961ce317366566666cbbddfb198bc9f in branch master even from upstream
ERROR: u-boot-xlnx-v2017.01-xilinx-v2017.4+gitAUTOINC+42deb242f9-r0 do_fetch: Fetcher failure for URL: 'git://github.com/digilent/u-boot-digilent.git;protocol=https;branch=master'. Unable to fetch URL from any source.
ERROR: u-boot-xlnx-v2017.01-xilinx-v2017.4+gitAUTOINC+42deb242f9-r0 do_fetch: Function failed: base_do_fetch
ERROR: Logfile of failure stored in: /home/vagrant/SimplePS2/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/u-boot-xlnx/v2017.01-xilinx-v2017.4+gitAUTOINC+42deb242f9-r0/temp/log.do_fetch.27803
ERROR: Task (/home/vagrant/petalinux/2017.4/components/yocto/source/arm/layers/meta-xilinx/recipes-bsp/u-boot/u-boot-xlnx_2017.01.bb:do_fetch) failed with exit code '1'

ディレクトリを間違えてエラーになったりする。

あとはさっきのコメントにあった sstate-cache の対応もやっておくといい。

Thursday, August 18 2022

Petalinux のインストールが「Failed to install Yocto SDK for aarch64」で失敗する

または petalinux-config がエラーで失敗する。

petalinux のインストールログを見れば書いてあった。

=================================================
ERROR: The installer requires python, please install it first
*********************************************
ERROR: Failed to install Yocto SDK for aarch64.
*********************************************
Please refer to the PetaLinux Tools Installation Guide.

「python」そのものはなかった。

$ python
python2.7   python3     python3.6   python3.6m  python3m
$ sudo ln -s /usr/bin/python2.7 /usr/bin/python
$ sudo ln -s /usr/bin/python2.7 /usr/bin/python2

のあとでインストールしなおしたら完了できた。

python2 は petalinux-config 対策。

$ ls */*.log
build/bitbake-cookerdaemon.log  build/config.log
$ cat build/config.log

Ubuntu では update-alternatives コマンドを使うのが正攻法らしい。

Sunday, April 17 2022

パソコンアップグレード

CPU : Intel Core i7 12700K

マザーボード : GIGABYTE Z690 UD

メモリ : CORSAIR VENGEANCE DDR5 64GB 5200MHz

SSD : KIOXIA EXCERIA PLUG G2 (M.2 2280 PCIe Gen3 x4)

HDD : Toshiba MN08ADA800

グラフィックカード : ASUS TUF Gaming GeForce RTX 3080 OC Edition 12GB

CPUクーラー : Noctua NH-U12A

Blu-ray : Pioneer BDR-213JBK

HDMIキャプチャ : AVerMedia Live Gamer 4K GC573

電源 : Thermaltake TOUGHPOWER GF1 GOLD (PS-TPD-1000FNFAGJ-1)

シャーシ : Thermaltake Versa H26 (スペック参考)

OS : Windows 11 Pro

Thursday, March 31 2022

HashiCorp Packer で作った仮想マシンを Vagrant 向けの box ファイルで出力してインポートして起動

ubuntu.pkr.hcl の build の範囲を書き換えた。

build {
    sources = [
      "sources.virtualbox-iso.ubuntu"
    ]
    provisioner "shell" {
      # execute_command = "echo {{.ssh_password}} | sudo bash {{.Path}}"
      execute_command = "bash {{.Path}}"
      script = "scripts/setkey.sh"
    }
    post-processors {  
      post-processor "artifice" {
        files = [
          "build/packer-virtualbox/ubuntu18041-disk001.vmdk",
          "build/packer-virtualbox/ubuntu18041.ovf"
        ]
      }
      post-processor "vagrant" {
        keep_input_artifact = true
        provider_override   = "virtualbox"
      }  
    }
}

シェルスクリプトから sudo が必要なやつはカットして、キーを登録するところだけに集中。

#!/bin/bash

# https://www.gun.io/blog/building-vagrant-machines-with-packer
# set -e

# apt update -y -qq > /dev/null
# apt install -y linux-headers-$(uname -r) build-essential dkms nfs-common
# apt install -y curl git

# https://www.covermymeds.com/main/insights/articles/repeatable-vagrant-builds-with-packer/
# setup insecure vagrant user ssh key
/bin/mkdir /home/vagrant/.ssh
/bin/chmod 700 /home/vagrant/.ssh
/usr/bin/curl -L -o /home/vagrant/.ssh/id_rsa https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant
/usr/bin/curl -L -o /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
/bin/chown -R vagrant:vagrant /home/vagrant/.ssh
/bin/chmod 0600 /home/vagrant/.ssh/*

これで通った。

https://discuss.hashicorp.com/t/virtualbox-iso-no-tty-present-and-no-askpass-program-specified/19513

https://www.packer.io/docs/debugging

https://acloudguru.com/hands-on-labs/formatting-a-packer-template-in-hcl2

https://www.gun.io/blog/building-vagrant-machines-with-packer

https://www.covermymeds.com/main/insights/articles/repeatable-vagrant-builds-with-packer/

https://lab.unicast.ne.jp/2013/09/09/troubleshooting-create-vagrant-box-with-packer/

https://qiita.com/mitzi2funk/items/c963483a11a1912e3c44

https://www.packer.io/docs/communicators/ssh

Tuesday, March 29 2022

HashiCorp Packer で作った仮想マシンを Vagrant 向けの box ファイルで出力してインポートして起動(失敗)

pkr.hcl を書き換え。


variable "boot_wait" {
    default = "5s"
}

variable "http_directory" {
    default = "./http"
}

variable "build_directory" {
    default = "./build"
}

variable "provider_name" {
    default = "virtualbox"
}

variable "ssh_timeout" {
    default = "45m"
}

variable "preseed" {
    default = ""
}

variable "boot_command" {
    default = "autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/"
}

# refer to https://github.com/boxcutter/ubuntu/blob/master/ubuntu.json

variable "boot_command_prefix" {
    default = "<enter><enter><f6><esc><wait>"
}

variable "cleanup_pause" {
    default = ""
}

variable "cpus" {
    default = "1"
}

variable "custom_script" {
    default = "custom-script.sh"
}

variable "desktop" {
    default = "false"
}

variable "disk_size" {
    default = "65536"
}

variable "ftp_proxy" {
    # {{env `ftp_proxy`}}
    default = ""
}

variable "headless" {
    default = "false"
}

variable "http_proxy" {
    # {{env `http_proxy`}}
    default = ""
}

variable "https_proxy" {
    # {{env `https_proxy`}}
    default = ""
}

variable "install_vagrant_key" {
    default = "true"
}

variable "iso_checksum" {
    default = "sha256:d1f2bf834bbe9bb43faf16f9be992a6f3935e65be0edece1dee2aa6eb1767423"
}

variable "iso_name" {
    default = "ubuntu-20.04.1-live-server-amd64.iso"
}

variable "iso_path" {
    default = "/Volumes/Storage/software/ubuntu"
}

variable "iso_url" {
    default = "http://releases.ubuntu.com/20.04/ubuntu-20.04.2-live-server-amd64.iso"
}

variable "memory" {
    default = "512"
}

variable "no_proxy" {
    # {{env `no_proxy`}}
    default = ""
}

variable "parallels_guest_os_type" {
    default = "ubuntu"
}

variable "rsync_proxy" {
    # {{env `rsync_proxy`}}
    default = ""
}

variable "hostname" {
    default = "vagrant"
}

variable "ssh_fullname" {
    default = "vagrant"
}

variable "ssh_password" {
    default = "vagrant"
}

variable "ssh_username" {
    default = "vagrant"
}

variable "update" {
    default = "false"
}

variable "vagrantfile_template" {
    default = ""
}

variable "version" {
    default = "0.1.0"
}

variable "virtualbox_guest_os_type" {
    default = "Ubuntu_64"
}

variable "vm_name" {
    default = "ubuntu2004"
}

variable "vmware_guest_os_type" {
    default = "ubuntu-64"
}

source "virtualbox-iso" "ubuntu" {

    boot_command = [
        "${var.boot_command_prefix}",
        "${var.boot_command}",
        " ${var.preseed}",
        " --- <wait>",
        " <enter><wait>"
    ]

    #boot_command = [
    #    "<enter><wait>",
    #    "<esc><wait>",
    #    "<enter><wait>",
    #    "/install/vmlinuz<wait>",
    #    " file=/cdrom/preseed/ubuntu-server.seed vga=788 initrd=/install/initrd.gz",
    #    " auto-install/enable=true",
    #    " debconf/priority=critical",
    #    " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu18.04.1.cfg",
    #    " --- <wait>",
    #    "<enter><wait>"
    #]

    boot_wait              = var.boot_wait
    cpus                   = var.cpus
    disk_size              = var.disk_size
    guest_os_type          = var.virtualbox_guest_os_type
    hard_drive_interface   = "sata"
    headless               = var.headless
    http_directory         = var.http_directory
    iso_url                = var.iso_url
    iso_checksum           = var.iso_checksum
    memory                 = var.memory
    output_directory       = "${var.build_directory}/packer-${var.provider_name}"
    shutdown_command       = "echo '${var.ssh_username}' | sudo -S shutdown -P now"
    ssh_timeout            = var.ssh_timeout
    ssh_username           = var.ssh_username
    ssh_password           = var.ssh_password
    vm_name                = var.vm_name
    guest_additions_path   = "VBoxGuestAdditions_{{.Version}}.iso"
    post_shutdown_delay    = "1m"
    ssh_wait_timeout       = var.ssh_timeout
    ssh_handshake_attempts = "200"
}

build {
    sources = [
      "sources.virtualbox-iso.ubuntu"
    ]
    post-processors {  
      post-processor "artifice" {
        files = [
          "build/packer-virtualbox/ubuntu18041-disk001.vmdk",
          "build/packer-virtualbox/ubuntu18041.ovf"
        ]
      }
      post-processor "vagrant" {
        keep_input_artifact = true
        provider_override   = "virtualbox"
      }  
    }
}

これで実行したら、カレントディレクトリに、どこから名前を作ったか分からないものの、packer_ubuntu_virtualbox.box というファイルが生成された。

vagrant box add bionic1-test packer_ubuntu_virtualbox.box

として、bionic1-test という名前で box ファイルを登録。

>mkdir test
>cd test
\test>vagrant init bionic1-test
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

\test>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bionic1-test'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: test_default_1648544752485_71620
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
^C
\test>==> default: Waiting for cleanup before exiting...
Vagrant exited after cleanup due to external interrupt.

というわけで Vagrant から SSH でアクセスできなかった模様。

でも TeraTerm で localhost:2222 に SSH してユーザー名&パスワードでアクセスする分にはログインできた。

https://www.vagrantup.com/docs/boxes/base

https://www.vagrantup.com/docs/providers/virtualbox/boxes

https://www.packer.io/plugins/post-processors/vagrant/vagrant


2022/Mar/30 追記

https://lab.unicast.ne.jp/2013/09/09/troubleshooting-create-vagrant-box-with-packer/

ここの /home/vagrant/.ssh/authorized_keys の問題だった。ただ curl だと取れなかったので、別のブラウザで https://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub を開いて /home/vagrant/.ssh/authorized_keys に保存したほうが良さそう。

あとはこれをどう Packer で自動化すればいいのか。

Thursday, March 24 2022

bad lexical cast: source type value could not be interpreted as target while executing

2022/Mar/30 追記:パッチがでていた

https://support.xilinx.com/s/article/76960

Continue reading...

Tuesday, February 8 2022

Windows 上の HashiCorp Packer で Ubuntu Server と Preseed

動いた。Ubuntu(というか Xubuntu)Desktop では動かせていないものの、Ubuntu Server では素直に動いた。

ubuntuserver18.04.1.pkr.hcl

variable "build_directory" {
    default = "./build"
}

variable "boot_wait" {
    default = "10s"
}

variable "cpus" {
    default = 1
}

variable "disk_size" {
    default = 50000
}

variable "headless" {
    default = false
}

variable "http_directory" {
    default = "./http"
}

variable "iso_url" {
    type = string
}

variable "iso_checksum" {
    type = string
}

variable "memory" {
    default = 1024
}

variable "username" {
    default = "vagrant"
}

variable "vm_name" {
    type = string
}

variable "provider_name" {
    default = "virtualbox"
}

variable "ssh_timeout" {
    default = "45m"
}

source "virtualbox-iso" "ubuntuserver18041" {

    boot_command = [
        "<enter><wait>",
        "<esc><wait>",
        "<enter><wait>",
        "/install/vmlinuz<wait>",
        " file=/cdrom/preseed/ubuntu-server.seed vga=788 initrd=/install/initrd.gz",
        " auto-install/enable=true",
        " debconf/priority=critical",
        " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntuserver18.04.1.cfg",
        " --- <wait>",
        "<enter><wait>"
    ]

    boot_wait            = var.boot_wait
    cpus                 = var.cpus
    disk_size            = var.disk_size
    guest_os_type        = "Ubuntu_64"
    hard_drive_interface = "sata"
    headless             = var.headless
    http_directory       = var.http_directory
    iso_url              = var.iso_url
    iso_checksum         = var.iso_checksum
    memory               = var.memory
    output_directory     = "${var.build_directory}/packer-${var.provider_name}"
    shutdown_command     = "echo '${var.username}' | sudo -S shutdown -P now"
    ssh_timeout          = var.ssh_timeout
    ssh_username         = var.username
    ssh_password         = var.username
    vm_name              = var.vm_name
}

build {
    sources = ["sources.virtualbox-iso.ubuntuserver18041"]
}

ubuntuserver18.04.1.pkrvars.hcl

iso_url="file://f:/iso/ubuntu-18.04.1-server-amd64.iso"
iso_checksum="md5:e8264fa4c417216f4304079bd94f895e"
vm_name="UbuntuServer18.04.1"
username="vagrant"

ubuntuserver18.04.1.cfg (仮)

d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/wireless_wep string
d-i mirror/country string manual
d-i mirror/http/hostname string archive.ubuntu.com
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string
d-i passwd/user-fullname string vagrant
d-i passwd/username string vagrant
d-i passwd/user-password password vagrant
d-i passwd/user-password-again password vagrant
d-i passwd/user-uid string 1000
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false
d-i clock-setup/utc boolean true
d-i time/zone string US/Eastern
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/choose_recipe select atomic
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
tasksel tasksel/first standard
d-i pkgsel/include string openssh-server build-essential
d-i pkgsel/update-policy select none
d-i pkgsel/install-language-support boolean false
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i finish-install/reboot_in_progress note

cfg ファイルを http フォルダにおいて、

packer build --force -var-file=ubuntuserver18.04.1.pkrvars.hcl ubuntuserver18.04.1.pkr.hcl

で動いてくれた。内容とか適当で、言語とキーボードの選択がまだ残ってたのでいろいろと調整が必要。

インストールが終わると build フォルダに vmware 用のが出力されたので、この辺ももう少し調査がいるか。

Monday, February 7 2022

メモ。Packer で起動した Ubuntu で Pressed が動かない

そもそも Ubuntu (というか Xubuntu) Desktop で Pressed が動くのかどうかよくわからない。検索すると、デスクトップ環境が欲しいなら Ubuntu Server インストール後に Desktop のパッケージを入れれば良い、という情報もある。

Pressed のファイルは、live OS 上のブラウザからもアクセスできるし、起動ログにもロードしたらしい情報があるのに動いてくれないので、次は Ubuntu Server で試してみるしかなさそう。

この辺でうごいてくれたら、Packer 関係無く Ubuntu の話だ。

試した Packer ファイルはこちら

variable "build_directory" {
    default = "./build"
}

variable "boot_wait" {
    default = "5s"
}

variable "cpus" {
    default = 1
}

variable "disk_size" {
    default = 50000
}

variable "headless" {
    default = false
}

variable "http_directory" {
    default = "./http"
}

variable "iso_url" {
    type = string
}

variable "iso_checksum" {
    type = string
}

variable "memory" {
    default = 1024
}

variable "username" {
    default = "vagrant"
}

variable "vm_name" {
    type = string
}

variable "provider_name" {
    default = "virtualbox"
}

variable "ssh_timeout" {
    default = "45m"
}

source "virtualbox-iso" "ubuntu20041" {

    boot_command = [
        "<esc><wait>",
        "<esc><wait>",
        "<esc><wait>",
        "<enter><wait>",
        "/casper/vmlinuz<wait>",
        " file=/cdrom/preseed/xubuntu.seed boot=casper initrd=/casper/initrd",
        " noninteractive",
        " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed_2.cfg",
        " -- <wait>",
        "<enter><wait>"
    ]

    boot_wait            = var.boot_wait
    cpus                 = var.cpus
    disk_size            = var.disk_size
    guest_os_type        = "Ubuntu_64"
    hard_drive_interface = "sata"
    headless             = var.headless
    http_directory       = var.http_directory
    iso_url              = var.iso_url
    iso_checksum         = var.iso_checksum
    memory               = var.memory
    output_directory     = "${var.build_directory}/packer-${var.provider_name}"
    shutdown_command     = "echo '${var.username}' | sudo -S shutdown -P now"
    ssh_timeout          = var.ssh_timeout
    ssh_username         = var.username
    ssh_password         = var.username
    vm_name              = var.vm_name
}

build {
    sources = ["sources.virtualbox-iso.ubuntu20041"]
}

boot_command に対しては、いろいろ書いてみたけどわからない(全部一気に書いたわけではない)。

        " auto-install/enable=true",
        " debconf/priority=critical",
        " ksdevice=enp0s3 interface=enp0s3",
        " debug-ubiquity automatic-ubiquity only-ubiquity noninteractive",

そもそも起動するまでも紆余曲折だった。

boot_wait を 10s に設定していたら、boot_command が始まるのが間に合わなかったので 5s に短縮。これは実機合わせが必要だと思う。

boot_command の最初の

        "<esc><wait>",
        "<esc><wait>",
        "<esc><wait>",
        "<enter><wait>",

これも実際に動かして確認。

        "/casper/vmlinuz<wait>",
        " file=/cdrom/preseed/xubuntu.seed boot=casper initrd=/casper/initrd",

ここはしばらくかかった。ISO で起動したときの boot オプションを参照しなければいけない。けど Ubuntu18 のインストーラは vmlinuz 書いてないからわからなかった。古いやつなら /install/vmlinuz でいいはず。実際に ISO をマウントして確認したパスを設定。なので、ここも実際の ISO を確認しながら作っていかなければいけない。

Thursday, February 3 2022

Windows 上の HashiCorp Packer で VirtualBox 向けの Ubuntu イメージを作成

Packer は今回は 1.7.10 を使用。

あらかじめ VirtualBox をインストールしておく。今回は 6.1.32r149290 (Qt5.6.2) を使用。

カレントディレクトリには

  • xubuntu.pkr.hcl
  • xubuntu.pkrvars.hcl

そしてカレントディレクトリには http というディレクトリを作っておく。

ISO ファイルは F:\iso フォルダに格納。MD5 は

> certutil -hashfile <ISO ファイル名> MD5

で生成。

xubuntu.pkr.hcl の内容は

variable "build_directory" {
    default = "./build"
}

variable "boot_wait" {
    default = "10s"
}

variable "cpus" {
    default = 1
}

variable "disk_size" {
    default = 50000
}

variable "headless" {
    default = false
}

variable "http_directory" {
    default = "./http"
}

variable "iso_url" {
    type = string
}

variable "iso_checksum" {
    type = string
}

variable "memory" {
    default = 1024
}

variable "username" {
    default = "vagrant"
}

variable "vm_name" {
    type = string
}

variable "provider_name" {
    default = "virtualbox"
}

variable "ssh_timeout" {
    default = "45m"
}

source "virtualbox-iso" "ubuntu" {

    boot_command = [
        "<up><tab><wait>",
        " <enter>",
    ]

    boot_wait            = var.boot_wait
    cpus                 = var.cpus
    disk_size            = var.disk_size
    guest_os_type        = "Ubuntu_64"
    hard_drive_interface = "sata"
    headless             = var.headless
    http_directory       = var.http_directory
    iso_url              = var.iso_url
    iso_checksum         = var.iso_checksum
    memory               = var.memory
    output_directory     = "${var.build_directory}/packer-${var.provider_name}"
    shutdown_command     = "echo '${var.username}' | sudo -S shutdown -P now"
    ssh_timeout          = var.ssh_timeout
    ssh_username         = var.username
    ssh_password         = var.username
    vm_name              = var.vm_name
}

build {
    sources = ["sources.virtualbox-iso.ubuntu20041"]
}

xubuntu.pkrvars.hcl の内容は

iso_url="file://f:/iso/xubuntu-18.04.1-desktop-amd64.iso"
iso_checksum="md5:bb0636b2bfdf43e3aefbb8dc073c3396"
vm_name="test2"

これでコマンドプロンプトで

>packer.exe build --force -var-file=xubuntu.pkrvars.hcl xubuntu.pkr.hcl

とすることでひとまず VirtualBox の仮想環境の構築と起動ができた。ただこのままだと Ubuntu の自動セットアップもされず Packer が SSH アクセスを待つだけになるので、次は preseed file を使って Ubuntu が自動的にセットアップされるようにしなければいけない。

それがうまくいったら、次は Vagrant 向けの box ファイルに仕立てる予定。

いろんなサイトを参考にした。

  • https://help.ubuntu.com/lts/installation-guide/amd64/apbs02.html
  • https://www.packer.io/guides/automatic-operating-system-installs/preseed_ubuntu
  • https://corymollet.com/posts/packer-virtualbox-iso-builder/
  • https://ts0818.hatenablog.com/entry/2020/03/22/232329
  • https://www.packer.io/docs/templates/hcl_templates/blocks
  • https://help.ubuntu.com/lts/installation-guide/amd64/apbs01.html
  • https://help.ubuntu.com/lts/installation-guide/amd64/ch05s01.html
  • https://wiki.ubuntulinux.jp/UbuntuTips/Others/BootOptions
  • https://www.infracloud.io/blogs/deploy-ubuntu-packer-image-bare-metal/
  • https://devopscube.com/packer-tutorial-for-beginners/
  • https://eric.mink.li/publications/preseeding.html
  • https://wiki.ubuntu.com/DesktopCDOptions
  • https://wiki.ubuntu.com/UbiquityAutomation

Friday, January 14 2022

Ubuntu のインストールメディアの起動で「(initramfs) Unable to find a medium containing a live file system」となってインストールできない

環境は、

  • Ubuntu 18.04.1 (ubuntu-18.04.1-desktop-amd64.iso)
  • EPSON MR8300-M (Core i3-10100、512GB SATA SSD、メーカーオプションのDVD-ROM ドライブ内蔵)

元々内蔵されていた SSD は取り外し、新しく SATA SSD を接続して Ubuntu のメディアを起動したら、

(initramfs) Unable to find a medium containing a live file system

と表示されてどうにもできなくなってしまった。

Secure Boot 有効のままで、結局別に USB 接続の DVD-ROM ドライブ(今回は Lenovo 0A33988?0A34254)で起動したら問題無くセットアップできた。

Sunday, November 7 2021

メモ:OpenWrt の OpenVPN の .ovpn ファイル

そのまま .ovpn ファイルを読み込んでもエラーになる。

/etc/config/openvpn

を参考にするのがよさそう。

Monday, October 18 2021

Petalinux が対応しているホスト OS バージョン

https://www.xilinx.com/support/documentation-navigation/see-all-versions.html?xlnxproducttypes=Design%20Tools&xlnxdocumentid=UG1144

こちらより。

ただツールバージョンまで考えるとキリが無い

Continue reading...

- page 2 of 8 -