MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.87k stars 496 forks source link

Image | ROCK Pi 4 #2445

Closed tenrek closed 4 years ago

tenrek commented 5 years ago

ADMIN EDIT

Testing image available: https://github.com/MichaIng/DietPi/issues/2445#issuecomment-528088922

Many thanks for @canabino for creating this! πŸ‘ ❀️


So, any plans for support / make an DietPi for ROCK Pi 4 ?

Debian Desktop download

Admin edit: Vote for it on FeatHub: https://feathub.com/MichaIng/DietPi/+35

MichaIng commented 5 years ago

@tenrek Thanks for your request. Feel free to add it to our FeatHub page to collect votes: https://feathub.com/MichaIng/DietPi

If we get a developer sample or @Fourdee is willing to buy one, we can create one.

Official Debian Stretch desktop image available: https://wiki.radxa.com/Rockpi4/downloads


Hmm what I don't like when reading the website:

Fourdee commented 5 years ago

@MichaIng

subtly mimic it and giving the impression it would be an upgraded RPi version.

Yep, although ASUS TB has the same form factor as a RPi 3. However, seems the Chinese companies can go much further to "copy and promote a copy" without their copyright laws lol.

MichaIng commented 5 years ago

@Fourdee Jep nothing against identical form factor. I am fans of standards, so e.g. SBC cases can fit for many different SBCs. But ROCK Pi goes a bid too far here. Calling it RPi 4 and also v1.3 on top of Raspberry Pi 3B being v1.2. This is not about standards only, at least all is pointing in this direction to use a bid more careful wording πŸ˜‰.

I guess they do not even break any copyright here, but the aim or result is quite clear.

Positive thing related:

MichaIng commented 5 years ago

I was reading a bid the forum: https://forum.radxa.com/c/community

@Fourdee Perhaps they will send you a developer sample, when asking? πŸ˜ƒ

MichaIng commented 5 years ago

PR up to do initial definitions: https://github.com/MichaIng/DietPi/pull/2933 User image incoming for testing and further implementing into DietPi: https://dietpi.com/phpbb/viewtopic.php?p=18445#p18445

canabino commented 5 years ago

@MichaIng Hi there so, please walk me through creating this image. I have the script you sent. I have an eMMC module and microSD card. Which one should I use? After I installed the Armbian image with the 5.1 kernel on the RockPi. Should I run the DietPi-PREP? Then what? Take out the eMMC/microSD place it in my windows pc running what OS on a virtual machine? Then run the script? Thanks

canabino commented 5 years ago

I installed the latest Armbian with the 5.1 kernel and ran the DietPi-PREP script. It came up with the following errors.

#### Details:
- Date           | Thu  6 Jun 15:39:03 UTC 2019
- Bug report     | N/A
- DietPi version | v6.24.1 (MichaIng/master)
- Img creator    | n/a
- Pre-image      | n/a
- SBC device     | NULL (index=22)
- Kernel version | #5.88 SMP Thu Jun 6 17:19:49 CEST 2019
- Distro         | stretch (index=4)
- Command        | G_AGUP
- Exit code      | 100
- Software title | DietPi-PREP

#### Extra details:
<!-- Please post any extra details that might help solve the issue -->
- ...

#### Additional logs:
Log file contents:
Ign:1 https://apt.armbian.com stretch InRelease
Ign:2 https://cdn-aws.deb.debian.org/debian stretch InRelease
Hit:3 https://cdn-aws.deb.debian.org/debian stretch-updates InRelease
Hit:4 https://cdn-aws.deb.debian.org/debian-security stretch/updates InRelease
Hit:5 https://cdn-aws.deb.debian.org/debian stretch-backports InRelease
Hit:6 https://cdn-aws.deb.debian.org/debian stretch Release
Err:7 https://apt.armbian.com stretch Release
  server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
Reading package lists...
E: The repository 'http://apt.armbian.com stretch Release' does no longer have a Release file.
MichaIng commented 5 years ago

@canabino Please try:

curl -sSL https://apt.armbian.com/armbian.key | apt-get add -
apt update

Ah or is it the HTTPS certificate? In this case:

apt-get install --reinstall ca-certificates
apt update
canabino commented 5 years ago

I changed the repository in /etc/apt/sources.list.d/armbian.list And it is working now.

MichaIng commented 5 years ago

@canabino Ah, what was the error with this repo? "https://apt.armbian.com stretch Release" above at least looks like it should.

I am a bid too tired now to write down to go through the DietPi-PREP steps, need to sleep, will check back tomorrow.

Just quick note about above: Since I just added the ROCK Pi 4 definition into dev branch, you might want to run the script from that branch + install dev DietPi:

cd /tmp
wget https://raw.githubusercontent.com/MichaIng/DietPi/dev/PREP_SYSTEM_FOR_DIETPI.sh
chmod +x PREP_SYSTEM_FOR_DIETPI.sh
./PREP_SYSTEM_FOR_DIETPI.sh
canabino commented 5 years ago

I changed it from "https://apt.armbian.com to https://mirrors.tuna.tsinghua.edu.cn/armbian following a google search.

I will run the code you sent. Sleep well and chat tomorrow.

canabino commented 5 years ago

I changed back to https://apt.armbian.com and apt-get update is working fine now. Maybe the server was down at the time. I ran your script and chose "dev" I was able to choose ROCKPi 4 from the list. πŸ‘ It first came up with errors.

Log file contents:
Failed to enable unit: File dietpi-firstboot.service: No such file or directory

I ran it again and it was successful. πŸ‘ Let me know what the next step is.

MichaIng commented 5 years ago

@canabino Found a bug in our new env vars implementation. The chosen Git info was overwritten by master branch. Fixed: https://github.com/MichaIng/DietPi/commit/e3f97a0d40ca01f97e894257bf90621fb2831bbf

Ah you second try seems to have been shortly after I fixed it, great.

Okay, next is to shutdown the system (of course) and plug SDcard or eMMC onto an external system. If you want to spin up a VM, take our VM images πŸ™‚: https://dietpi.com/#download

There:

cd /tmp
wget https://github.com/MichaIng/DietPi/blob/dev/.meta/dietpi-imager
chmod +x dietpi-imager
./dietpi-imager

Hmm, I see now that dd runs as first step. I added this as last step on the minimised partition/file system, but @Fourdee switched this. Ups and downs:

canabino commented 5 years ago

Okay I dowloaded and installed VirtualBox. Then I downloaded your DietPi_VirtualBox-x86_64-Stretch.ova It booted up and and I did all the installations for DietPi. I added the usb device with microSD from the RockPi to the VM. It shows as /dev/sdb/ when I ran fdisk -l Can I run your script like this? image

MichaIng commented 5 years ago

@canabino Jep, the script asks you which drive to pick.

canabino commented 5 years ago

ok πŸ‘

canabino commented 5 years ago

It came up with errors image

MichaIng commented 5 years ago

@canabino Ah me dumb, sorry wrong download link. This one: wget https://raw.githubusercontent.com/MichaIng/DietPi/dev/.meta/dietpi-imager

It did download the html page when opening the file on GitHub πŸ˜‰.

canabino commented 5 years ago

It got a new name after I downloaded.

MichaIng commented 5 years ago

@canabino It was saved to "dietpi-imager.1" since wget does not automatically overwrite files:

mv dietpi-imager.1 dietpi-imager
chmod +x dietpi-imager
./dietpi-imager
canabino commented 5 years ago

ok

canabino commented 5 years ago

I'm in πŸ‘

canabino commented 5 years ago

image

MichaIng commented 5 years ago

@canabino Would be nice to have disk size in this menu, at least for me this is always the best indicator to know which drive is which.

canabino commented 5 years ago

You are right it would be nice.

canabino commented 5 years ago

Just a quick mention I loaded the Armbian with the 5.1 kernel on my system using the same script and everything was working fine. NordVPN and Jackett.

canabino commented 5 years ago

Where will it store the image?

MichaIng commented 5 years ago

@canabino To /root/DietPi_XXXX_XXX.img and /root/DietPi_XXXX_XXX.7z (the archive).

canabino commented 5 years ago

Oh, thanks

canabino commented 5 years ago

It's done. image

MichaIng commented 5 years ago

@canabino You ran out of disk space sadly. This was the initial dd to create a raw image which will be resized then. It should require as much space as the SDcard size, so 15 GiB.

I think we should at least add the option to reduce the file system and partition size on the SDcard first and run dd afterwards, which requires then muuuuch less space πŸ€”. But if something fails then, once might need to reflash and run DietPi-PREP again πŸ€”.

canabino commented 5 years ago

Oh should I make the VM's drive bigger?

canabino commented 5 years ago

image

MichaIng commented 5 years ago

@canabino Ah of course did not think about that. Before doing so, do:

rm /root/myimage.img
systemctl enable dietpi-fs_partition_resize

This enables the partition resize service for next boot.

canabino commented 5 years ago

image

canabino commented 5 years ago

I rebooted. But the partition is still 8GB

canabino commented 5 years ago

I adjusted it in the VirtualBox image

canabino commented 5 years ago

Now it doesn't want to boot. Give me a moment to set it up again.

canabino commented 5 years ago

I have adjusted it to 32GB and will start again.

root@DietPi:~# fdisk -l
Disk /dev/sda: 32.2 GiB, 34611757056 bytes, 67601088 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x13ced30f

Device     Boot Start      End  Sectors Size Id Type
/dev/sda1  *     2048 16775167 16773120   8G 83 Linux

Disk /dev/sdb: 14.9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9df16f21

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdb1       32768 30805119 30772352 14.7G 83 Linux
MichaIng commented 5 years ago

@canabino Note that the partition still needs to be extended, hence the systemctl enable dietpi-fs_partition_resize + reboot.

canabino commented 5 years ago

ok

canabino commented 5 years ago

I ran the partition resize code and rebooted. I started the DietPi-Imager script again but it still ran out of space.

root@DietPi:/tmp# systemctl enable dietpi-fs_partition_resize
Created symlink /etc/systemd/system/local-fs.target.wants/dietpi-fs_partition_resize.service β†’ /etc/systemd/system/dietpi-fs_partition_resize.service.
root@DietPi:/tmp# reboot
root@DietPi:/tmp# wget https://raw.githubusercontent.com/MichaIng/DietPi/dev/.meta/dietpi-imager
--2019-06-25 01:56:08--  https://raw.githubusercontent.com/MichaIng/DietPi/dev/.meta/dietpi-imager
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.4.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.4.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7312 (7.1K) [text/plain]
Saving to: β€˜dietpi-imager’

dietpi-imager                       100%[=================================================================>]   7.14K  --.-KB/s    in 0s

2019-06-25 01:56:08 (219 MB/s) - β€˜dietpi-imager’ saved [7312/7312]

root@DietPi:/tmp# chmod +x dietpi-imager
root@DietPi:/tmp# ./dietpi-imager
[  OK  ] DietPi-Imager | Root access verified.
[  OK  ] DietPi-Imager | RootFS R/W access verified.
6553194496 bytes (6.6 GB, 6.1 GiB) copied, 1764.03 s, 3.7 MB/s
dd: error writing '/root/myimage.img': No space left on device
1600498+0 records in
1600497+0 records out
6555635712 bytes (6.6 GB, 6.1 GiB) copied, 1764.72 s, 3.7 MB/s
root@DietPi:/tmp#
MichaIng commented 5 years ago

@canabino Strange, as it stops at the same point, the expansion seems to not have worked:

parted /dev/sdb print
cat /var/tmp/dietpi/logs/fs_partition_resize.log
canabino commented 5 years ago
root@DietPi:~# parted /dev/sda print
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 34.6GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  8589MB  8588MB  primary  ext4         boot

root@DietPi:~# cat /var/tmp/dietpi/logs/fs_partition_resize.log
Removed /etc/systemd/system/local-fs.target.wants/dietpi-fs_partition_resize.service.
/var/lib/dietpi/services/fs_partition_resize.sh: line 45: cannot create temp file for here-document: No space left on device
resize2fs 1.43.4 (31-Jan-2017)
The filesystem is already 2096640 (4k) blocks long.  Nothing to do!

I used the DietPi-Drivemanager to resize to maximum. image

Now it shows the right size.

root@DietPi:~# parted /dev/sda print
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 34.6GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  34.6GB  34.6GB  primary  ext4         boot

I am running the Imager now.

MichaIng commented 5 years ago

@canabino Lol was a snake biting its tail. Some part of the resizing script failed because there was no space left πŸ˜„. Okay great it worked now.

canabino commented 5 years ago

🐍 🀣 It is almost finished, do you want the archive or the img? Where should I upload to?

MichaIng commented 5 years ago

@canabino The archive, please, lets not stress bandwidth more then required πŸ˜„. Sounds funny but misusing the survey/bugreport user to upload to the DietPi server directly is easiest:

curl -T <archive_name>.7z sftp://dietpi-survey:upload2dietpi@ssh.dietpi.com/bugreport/

And would be great if you could then flash this image onto the SDcard again to test boot and firstrun setup. I am thinking if it's easier to use dd again from within the VM (backwards) or if I should provide you the link to the online archive, once I put it into an appropriate download directory.

The shared folder function of VirtualBox is actually helpful here to easily transfer files between host and guest, however requires guest extensions etc πŸ˜‰.

canabino commented 5 years ago

It's asking: Is /root/myimage.img a GPT filesystem?

Yes or cancel?

MichaIng commented 5 years ago

@canabino Γ„hhm good question, let me see.


Next ToDo: GPT auto detection.

MichaIng commented 5 years ago

@canabino

Disklabel type: dos

No GPT, select "Cancel" => Should be called "No".