ghanjiboy Posted August 13, 2019 Posted August 13, 2019 Hi, I wanted to know if there was an easy way to customize an existing released image or rebuild a released image. I know you can use the customize image option when building, but I would like to not build the latest nightly, but instead just build whatever was released. The customization I am looking to do is installing additional packages, downloading some personal python code, setting timezone and other similar settings. I searched the forums, but didn't see anything helpful, any info would be appreciated. Thanks.
lanefu Posted August 14, 2019 Posted August 14, 2019 you could mount the image as loopback and chroot (from an arm box) Spoiler root@cranbone:/mnt/linuxmirror/armbianImages# ls -ltrh total 965M drwxrwsr-x 1 lane sudo 396 May 20 02:02 backgroundpoll -rw-rw-r-- 1 root bin 1.1G Aug 6 23:21 Armbian_5.93_Orangepipc2_Ubuntu_bionic_next_4.19.65.img -rw-r--r-- 1 root sudo 26 Aug 9 02:15 robots.txt root@cranbone:/mnt/linuxmirror/armbianImages# losetup -f -P Armbian_5.93_Orangepipc2_Ubuntu_bionic_next_4.19.65.img root@cranbone:/mnt/linuxmirror/armbianImages# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 1.1G 0 loop └─loop0p1 259:0 0 1.1G 0 loop mmcblk0 179:0 0 29.8G 0 disk ├─mmcblk0p1 179:1 0 64M 0 part /boot └─mmcblk0p2 179:2 0 29.5G 0 part / zram0 254:0 0 50M 0 disk /var/log zram1 254:1 0 998.5M 0 disk [SWAP] root@cranbone:/mnt/linuxmirror/armbianImages# mount /dev/loop0 loop0 loop0p1 root@cranbone:/mnt/linuxmirror/armbianImages# mount /dev/loop0p1 /mnt/tmp root@cranbone:/mnt/linuxmirror/armbianImages# chroot /mnt/tmp /bin/bash root@cranbone:/# echo Im in the image now Im in the image now root@cranbone:/# apt install iftop -y Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libpcap0.8 The following NEW packages will be installed: iftop libpcap0.8 0 upgraded, 2 newly installed, 0 to remove and 9 not upgraded. Need to get 141 kB of archives. After this operation, 386 kB of additional disk space will be used. Get:1 http://ports.ubuntu.com bionic/main arm64 libpcap0.8 arm64 1.8.1-6ubuntu1 [104 kB] Get:2 http://ports.ubuntu.com bionic/universe arm64 iftop arm64 1.0~pre4-4 [36.6 kB] Fetched 141 kB in 1s (251 kB/s) dpkg-preconfigure: unable to re-open stdin: No such file or directory E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory) Selecting previously unselected package libpcap0.8:arm64. (Reading database ... 31546 files and directories currently installed.) Preparing to unpack .../libpcap0.8_1.8.1-6ubuntu1_arm64.deb ... Unpacking libpcap0.8:arm64 (1.8.1-6ubuntu1) ... Selecting previously unselected package iftop. Preparing to unpack .../iftop_1.0~pre4-4_arm64.deb ... Unpacking iftop (1.0~pre4-4) ... Processing triggers for libc-bin (2.27-3ubuntu1) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... Setting up libpcap0.8:arm64 (1.8.1-6ubuntu1) ... Setting up iftop (1.0~pre4-4) ... Processing triggers for libc-bin (2.27-3ubuntu1) ... root@cranbone:/# exit exit root@cranbone:/mnt/linuxmirror/armbianImages# umount /mnt/tmp root@cranbone:/mnt/linuxmirror/armbianImages# losetup -D
ghanjiboy Posted August 16, 2019 Author Posted August 16, 2019 Thanks for sharing this. I got to mount the image and when I was trying to install iftop as in your example, apt gets stuck on Waiting for headers as in the following - any apt command, even apt update gets stuck waiting for headers. Is this just a temporary issue or is something else wrong: root@NanoPi-M4:/# apt install iftop -y Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libpcap0.8 The following NEW packages will be installed: iftop libpcap0.8 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 171 kB of archives. After this operation, 414 kB of additional disk space will be used. 0% [Waiting for headers]^C
lanefu Posted August 16, 2019 Posted August 16, 2019 11 minutes ago, ghanjiboy said: Thanks for sharing this. I got to mount the image and when I was trying to install iftop as in your example, apt gets stuck on Waiting for headers as in the following - any apt command, even apt update gets stuck waiting for headers. Is this just a temporary issue or is something else wrong: root@NanoPi-M4:/# apt install iftop -y Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libpcap0.8 The following NEW packages will be installed: iftop libpcap0.8 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 171 kB of archives. After this operation, 414 kB of additional disk space will be used. 0% [Waiting for headers]^C hmmm.. that's odd. try apt clean and then possibly check on the contents of /etc/resolv.conf and make sure its got a usable DNS server. otherwise don't really have any ideas.
Recommended Posts