radxa-repo / rbuild

Radxa Image Builder (Maintenance mode)
https://radxa-repo.github.io/rbuild/
GNU General Public License v3.0
53 stars 44 forks source link

shrink-image It doesn't work. It's always 6.0G. #63

Closed zhang-wenchao closed 1 week ago

zhang-wenchao commented 1 week ago
# debian @ cloud-testing in ~/Build/Radxa/rbuild on git:main o [2:53:21] 
$ ls -alh
total 7.7G
drwxr-xr-x 10 debian debian 4.0K Jul  9 02:25 .
drwxr-xr-x  3 debian debian 4.0K Apr 25 08:22 ..
-rw-r--r--  1 debian debian 3.5K Apr 25 08:22 action.yaml
-rw-r--r--  1 debian debian  583 Apr 25 08:22 book.toml
drwxr-xr-x  6 debian debian 4.0K Jul  9 02:52 common
drwxr-xr-x  2 debian debian 4.0K Apr 25 08:22 configs
drwxr-xr-x  5 debian debian 4.0K Apr 25 08:22 docs
drwxr-xr-x  8 debian debian 4.0K Jul  8 08:07 .git
drwxr-xr-x  3 debian debian 4.0K Apr 25 08:22 .github
-rw-r--r--  1 debian debian   99 Apr 25 08:22 .gitignore
-rw-r--r--  1 debian debian  35K Apr 25 08:22 LICENSE
drwxr-xr-x  2 debian debian 4.0K Apr 25 08:22 po
-rwxr-xr-x  1 debian debian  24K Jul  8 08:07 rbuild
-rw-r--r--  1 debian debian 1.7K Apr 25 08:22 README.md
-rw-r--r--  1 debian debian 6.0G Jul  8 08:28 rock-pi-4b-plus_debian_bookworm_cli.img
-rw-r--r--  1 debian debian  170 Jul  8 08:29 rock-pi-4b-plus_debian_bookworm_cli.img.sha512
-rw-r--r--  1 debian debian 6.0G Jul  9 02:52 rock-pi-s_debian_bookworm_cli.img
-rw-r--r--  1 debian debian  164 Jul  9 02:26 rock-pi-s_debian_bookworm_cli.img.sha512
-rw-r--r--  1 debian debian 6.0G Jul  9 02:03 rock-s0_debian_bookworm_cli.img
-rw-r--r--  1 debian debian  162 Jul  9 00:57 rock-s0_debian_bookworm_cli.img.sha512
drwxr-xr-x  2 debian debian 4.0K Apr 25 08:48 .rootfs
-rw-r--r--  1 debian root   4.0G Jul  9 02:16 .swap.img
drwxr-xr-x  4 debian debian 4.0K Apr 25 08:22 theme

# debian @ cloud-testing in ~/Build/Radxa/rbuild on git:main o [2:53:27] 
$ ./rbuild shrink-image ./rock-pi-s_debian_bookworm_cli.img
Partition 3 is root partition.
e2fsck 1.46.2 (28-Feb-2021)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
rootfs: 50006/145728 files (0.3% non-contiguous), 400419/569713 blocks
569711 of 569713 blocks are in use.
e2fsck 1.46.2 (28-Feb-2021)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
rootfs: 50006/145728 files (0.3% non-contiguous), 400419/569713 blocks
resize2fs 1.46.2 (28-Feb-2021)
Resizing the filesystem on /dev/mapper/loop0p3 to 569711 (4k) blocks.
The filesystem on /dev/mapper/loop0p3 is now 569711 (4k) blocks long.

Root filesystem has been shrinked to 569711 blocks.
loop deleted : /dev/loop0

# debian @ cloud-testing in ~/Build/Radxa/rbuild on git:main o [2:53:37] C:127
$ ls -alh                                                  
total 7.7G
drwxr-xr-x 10 debian debian 4.0K Jul  9 02:25 .
drwxr-xr-x  3 debian debian 4.0K Apr 25 08:22 ..
-rw-r--r--  1 debian debian 3.5K Apr 25 08:22 action.yaml
-rw-r--r--  1 debian debian  583 Apr 25 08:22 book.toml
drwxr-xr-x  6 debian debian 4.0K Jul  9 02:53 common
drwxr-xr-x  2 debian debian 4.0K Apr 25 08:22 configs
drwxr-xr-x  5 debian debian 4.0K Apr 25 08:22 docs
drwxr-xr-x  8 debian debian 4.0K Jul  8 08:07 .git
drwxr-xr-x  3 debian debian 4.0K Apr 25 08:22 .github
-rw-r--r--  1 debian debian   99 Apr 25 08:22 .gitignore
-rw-r--r--  1 debian debian  35K Apr 25 08:22 LICENSE
drwxr-xr-x  2 debian debian 4.0K Apr 25 08:22 po
-rwxr-xr-x  1 debian debian  24K Jul  8 08:07 rbuild
-rw-r--r--  1 debian debian 1.7K Apr 25 08:22 README.md
-rw-r--r--  1 debian debian 6.0G Jul  8 08:28 rock-pi-4b-plus_debian_bookworm_cli.img
-rw-r--r--  1 debian debian  170 Jul  8 08:29 rock-pi-4b-plus_debian_bookworm_cli.img.sha512
-rw-r--r--  1 debian debian 6.0G Jul  9 02:53 rock-pi-s_debian_bookworm_cli.img
-rw-r--r--  1 debian debian  164 Jul  9 02:26 rock-pi-s_debian_bookworm_cli.img.sha512
-rw-r--r--  1 debian debian 6.0G Jul  9 02:03 rock-s0_debian_bookworm_cli.img
-rw-r--r--  1 debian debian  162 Jul  9 00:57 rock-s0_debian_bookworm_cli.img.sha512
drwxr-xr-x  2 debian debian 4.0K Apr 25 08:48 .rootfs
-rw-r--r--  1 debian root   4.0G Jul  9 02:16 .swap.img
drwxr-xr-x  4 debian debian 4.0K Apr 25 08:22 theme

# debian @ cloud-testing in ~/Build/Radxa/rbuild on git:main o [2:53:39] 

My rock-pi-s has 1G of SD NAND, the downloaded img is 2.5G too big to use, I tried to compile it myself and couldn't reduce the size.

zhang-wenchao commented 1 week ago

@RadxaYuntian Need help. Thank you.

RadxaYuntian commented 1 week ago

Your run ends here where you can see there are additional commands and logs after it. Please check if you are missing any additional run time dependencies.

You can run bash -x ./rbuild shrink-image ./rock-pi-s_debian_bookworm_cli.img to see which command failed.

zhang-wenchao commented 1 week ago

What I found was that I was missing parted, but after shrink it was 2.5G , which doesn't meet the requirements. It needs to be less than 1G.

RadxaYuntian commented 1 week ago

The system can barely fit under 1G after heavy customization, but it is very minimal. You should look for Yocto for such use case, but ROCK S0 is yet to be supported.