Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Bootable 64-bit RPi3/Pi4 Gentoo image (OpenRC/Xfce/VC4) Pt 2
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3 ... 10, 11, 12, 13, 14  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
Sakaki
Guru
Guru


Joined: 21 May 2014
Posts: 409

PostPosted: Thu Jun 25, 2020 1:35 am    Post subject: Reply with quote

Hello,

I've just posted a v1.6.0 release of my bootable 64-bit Gentoo image for the RPi4 B / RPi3 B & B+ on GitHub (here, includes full download instructions).

As always, you can burn the image (~1,961MiB compressed) to a microSD card (>=16GB), then boot your RPi3 or RPi4 from it directly (the root partition will be automatically resized to fill the card on first boot). Full instructions for download and use are provided on the project's GitHub page. As before, a 'lite' (CLI-only) image is also provided.

A screenshot of the image running on a dual-display RPi4 B may be viewed here.

A changelog from the prior release image (with upgrade instructions) may be viewed here, but in summary:
  • Switched kernel branch, from rpi-4.19.y to rpi-5.4.y, with the shipped kernels upgraded to bcm{rpi3,2711}-kernel-bis-bin-5.4.45.20200616, and boot firmware to sys-boot/rpi3-64bit-firmware-1.20200601_p64, respectively (the rpi3 name in the latter being an historical artifact; code for both the RPi3 and RPi4 is provided). This migration is slightly in advance of RPi engineers switching to rpi-5.4.y as their default branch, but stability now appears to be good, and a 5.4 kernel is already used in the beta version of PIOS64.
  • Following upstream, migrated from consolekit to elogind. As a result of this change, a large number of userland packages have had to be rebuilt wrt their v1.5.4 release versions.
  • As the new kernels make each of HDMI-1, HDMI-2 and headphone outputs its own ALSA device, added a small, USE-flag gated workaround to media-sound/pulseaudio to counter an initialization issue (hopefully will be properly resolved soon - if you are a pulseaudio guru, please feel free to dig in!), whereby pulse can only use two of the three independent streams at any time (thanks to Gavinmc42 for reporting). The workaround allows audio on HDMI-1 (the HDMI0 port, confusingly!) and the headphone port so, if you are only using a single monitor, be sure to plug it into the HDMI0 socket (the one nearer the USB-C power connector); and if using two monitors, bear in mind that only the HDMI0-connected one will be able to play sound. (If your application requires sound out of both monitors, then disable the pi4-workaround USE flag on media-sound/pulseaudio and re-emerge it; your headphone port will then be disabled, and HDMI-1 and HDMI-2 enabled.) Note that the use of e.g. additional headset-to-USB adaptors etc is not affected by this workaround, and they should be fully useable.
  • Added the net-analyzer/etherape and net-analyzer/wireshark packages (a network traffic visualizer and analysis tool), as these have been repeatedly requested.
  • Added a fixup to ensure that the snd_bcm2835 module was still autoloaded on the RPi3.
  • Fixed an issue with the keyboard switcher panel item, which did not always set up the initial layout correctly on first boot.
  • Switched (for demouser) the default youtube streaming mechanism of media-video/smplayer to youtube-dl (since the 'internal' mechanism was no longer reliable), and added net-misc/youtube-dl to the core package set. Also setup media-video/smplayer to use 'auto-copy' for hardware decoding (per feedback in this issue; thanks Jimmy-Z) and to use 4 threads for software decoding, where possible.
  • Removed app-portage/porthole from the apps / shipped @world sets, as it has been dropped upstream (Gentoo bug #708096).
  • Migrated the XFCE desktop and associated tools to a mix of 4.14/4.15 (from 4.12).
  • Updated media-video/ffmpeg with a number of LibreELEC patches (thanks acroobat). This should improve video playback performance in certain cases. NB: the LibreELEC hevc patches have not been applied in this release.
  • Added an initial set of packages for the FOSS videoconferencing server, Jitsi. Please see this post for further instructions on setup and use (although you can of course skip the "RPi4 64-bit Gentoo Install" section there, as the necessary packages are already present on the image). You'll realistically require a 2GiB RPi4B (or better) to run this application successfully. Note, though, that since Jitsi does not process the video streams, but acts simply as a meeting coordination point, selective forwarding unit and TURN server, the CPU requirements are not onerous - an RPi4 should be able to handle a reasonable number of simultaneous participants.
  • Updated the media-libs/raspberrypi-userland package to 1.20200520. As of this date, 64-bit MMAL userland support had (just ^-^) not yet been dropped, so in v1.6.0 of the image you can still use raspivid etc.
  • Various minor ebuild tidy-ups.
  • All packages brought up-to-date against the Gentoo tree, as of 11 June 2020. So e.g., www-client/chromium bumped to 84.0.4147.30, www-client/firefox to 77.0.1, app-office/libreoffice to 6.4.4.2 etc.
Users already on the prior 1.5.4 or earlier release can upgrade manually by following the instructions given here.

Note: this version should also support boot-from-USB on the Pi4, but to enable this you will need (at the time of writing) a beta version of the Pi4's EEPROM software. To install this, set (at your own risk!) FIRMWARE_RELEASE_STATUS="beta" in /etc/default/rpi-eeprom-update, and reboot.Once back up, reboot again to reflash the new EEPROM payload. You should then be able to write a copy of the image to a USB target, and boot from this (provided the uSD card is not inserted). However, I have not fully tested this process.

Have fun ^-^

And, as always, any problems or comments, please post either in this thread, or in the project's thread on the Raspberry Pi forums (here).

PS the bootable images are also available for download via PINN, for those who prefer that route, called gentoo64 and gentoo64lite there.
_________________
Regards,

sakaki
Back to top
View user's profile Send private message
safeness
Tux's lil' helper
Tux's lil' helper


Joined: 02 Jul 2004
Posts: 105
Location: Eastside, WA

PostPosted: Fri Jun 26, 2020 4:16 pm    Post subject: Reply with quote

@Sakaki Thanks for all the work you've been doing on this! Can you help me with this by any chance?

safeness wrote:
Can anyone please help me to build raspberrypi-omxplayer?

This is the bug I ran into: https://bugs.gentoo.org/626000

It's a requirement for rpi-play (screen cast from iOS with raspberry pi!) https://github.com/FD-/RPiPlay

Any help will be greatly appreciated. Thanks in advance!
Back to top
View user's profile Send private message
ian.au
Guru
Guru


Joined: 07 Apr 2011
Posts: 591
Location: Australia

PostPosted: Fri Jun 26, 2020 10:47 pm    Post subject: Reply with quote

@Sakaki, I'd already done the 5.4 kernel upgrades without issues from your earlier post, I was going to comment thanking you for those instructions, then my 8Gb pi finally arrived ;) I moved my install over last Wed, a highly technical exercise requiring 4 minutes to disconnect, pull the case and fan apart, switch boards swap the sd card over reconnect and reboot. Flat out the easiest hardware upgrade imaginable. Anyone interested in a rock-solid low-power dual-monitor desktop setup need look no further than the 8gb pi built up from this image and a good, fast ssd. It's a really useable system and I've found few limitations using it daily.

I'll have a play with the old 4gb pi and the new 'booting from usb' stuff, although I could never really understand all the wailing about that, booting from the sd and running off the ssd works just fine in practice.

Anyway, just a massive thank you again for all the work you've done on this Sakaki, it would have taken me forever to get here by myself.
Back to top
View user's profile Send private message
drizzt
Guru
Guru


Joined: 21 Jul 2002
Posts: 428

PostPosted: Sat Jun 27, 2020 5:18 am    Post subject: Reply with quote

Thank you Sakaki for your wonderful work. The image works like a charm. although I face one problem:
I switched the language to de_DE.utf8 and because of this I need to rebuild firefox. Unfortunately this failes with the following error:
Code:
Exception in thread ProcessReader:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/var/tmp/portage/www-client/firefox-77.0.1/work/firefox-77.0.1/testing/mozbase/mozprocess/mozprocess/processhandler.py", line 1116, in _read
    callback(line.rstrip())
  File "/var/tmp/portage/www-client/firefox-77.0.1/work/firefox-77.0.1/testing/mozbase/mozprocess/mozprocess/processhandler.py", line 1026, in __call__
    e(*args, **kwargs)
  File "/var/tmp/portage/www-client/firefox-77.0.1/work/firefox-77.0.1/python/mach/mach/mixin/process.py", line 96, in handleLine
    line_handler(line)
  File "/var/tmp/portage/www-client/firefox-77.0.1/work/firefox-77.0.1/python/mozbuild/mozbuild/controller/building.py", line 706, in on_line
    self.log(logging.INFO, 'build_output', {'line': message}, '{line}')
  File "/var/tmp/portage/www-client/firefox-77.0.1/work/firefox-77.0.1/python/mach/mach/mixin/logging.py", line 54, in log
    extra={'action': action, 'params': params})
  File "/usr/lib64/python3.6/logging/__init__.py", line 1374, in log
    self._log(level, msg, args, **kwargs)
  File "/usr/lib64/python3.6/logging/__init__.py", line 1444, in _log
    self.handle(record)
  File "/usr/lib64/python3.6/logging/__init__.py", line 1454, in handle
    self.callHandlers(record)
  File "/usr/lib64/python3.6/logging/__init__.py", line 1516, in callHandlers
    hdlr.handle(record)
  File "/usr/lib64/python3.6/logging/__init__.py", line 865, in handle
    self.emit(record)
  File "/var/tmp/portage/www-client/firefox-77.0.1/work/firefox-77.0.1/python/mozbuild/mozbuild/controller/building.py", line 590, in emit
    self.fh.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\xf6' in position 221: ordinal not in range(128)

 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
 * Unable to trace static ELF: /sbin/ldconfig: /sbin/ldconfig -p
295:14.94 0 compiler warnings present.
 * ERROR: www-client/firefox-77.0.1::gentoo failed (compile phase):
 *   (no error message)
 *
 * Call stack:
 *     ebuild.sh, line 125:  Called src_compile
 *   environment, line 5353:  Called die
 * The specific snippet of code:
 *       GDK_BACKEND=x11 MOZ_MAKE_FLAGS="${MAKEOPTS} -O" SHELL="${SHELL:-${EPREFIX}/bin/bash}" MOZ_NOSPAM=1 ${_virtx} ./mach build --verbose || die
 *
 * If you need support, post the output of `emerge --info '=www-client/firefox-77.0.1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=www-client/firefox-77.0.1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/www-client/firefox-77.0.1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/www-client/firefox-77.0.1/temp/environment'.
 * Working directory: '/var/tmp/portage/www-client/firefox-77.0.1/work/firefox-77.0.1'
 * S: '/var/tmp/portage/www-client/firefox-77.0.1/work/firefox-77.0.1'

 * Messages for package www-client/firefox-77.0.1:

 * You have the sandbox FEATURE set, firefox may not install correctly
 * Consider restricting via /etc/portage/{env,package.env}
 * ERROR: www-client/firefox-77.0.1::gentoo failed (compile phase):
 *   (no error message)
 *
 * Call stack:
 *     ebuild.sh, line 125:  Called src_compile
 *   environment, line 5353:  Called die
 * The specific snippet of code:
 *       GDK_BACKEND=x11 MOZ_MAKE_FLAGS="${MAKEOPTS} -O" SHELL="${SHELL:-${EPREFIX}/bin/bash}" MOZ_NOSPAM=1 ${_virtx} ./mach build --verbose || die
 *
 * If you need support, post the output of `emerge --info '=www-client/firefox-77.0.1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=www-client/firefox-77.0.1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/www-client/firefox-77.0.1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/www-client/firefox-77.0.1/temp/environment'.
 * Working directory: '/var/tmp/portage/www-client/firefox-77.0.1/work/firefox-77.0.1'
 * S: '/var/tmp/portage/www-client/firefox-77.0.1/work/firefox-77.0.1'


Does anyone have any hints how to fix this ?

Thank you
_________________
People don't have to earn my respect. I offer my respect to them, but be careful to lose my respect...
Back to top
View user's profile Send private message
Sakaki
Guru
Guru


Joined: 21 May 2014
Posts: 409

PostPosted: Sat Jun 27, 2020 11:07 pm    Post subject: Reply with quote

safeness wrote:
@Sakaki Thanks for all the work you've been doing on this! Can you help me with this by any chance?

safeness wrote:
Can anyone please help me to build raspberrypi-omxplayer?

This is the bug I ran into: https://bugs.gentoo.org/626000

It's a requirement for rpi-play (screen cast from iOS with raspberry pi!) https://github.com/FD-/RPiPlay

Any help will be greatly appreciated. Thanks in advance!

Sorry not to have been able to look at this earlier, been pretty snowed getting the v1.6.0 release out, then playing catch-up on some real-world responsibilities which got somewhat put on hold by that ><

A quick scan, however, suggests getting raspberrypi-omxplayer to build on arm64 will be near impossible. Per the upstream readme (emphasis added):

popcornmix wrote:
Note: omxplayer is being deprecated and resources are directed at improving vlc.

This is due to: omxplayer uses openvg for OSD and subtitles which isn't supported on Pi4. omxplayer uses openmax which has been deprecated for a long time and isn't supported with 64-bit kernels. omxplayer does not support software decode omxplayer does not support advanced subtitles omxplayer does not support playback from ISO files. omxplayer does not integrate with the X desktop

It is straightforward to confirm that the current raspberrypi/userland code omits building the OpenMAX IL library on arm64:
Code:
if(NOT ARM64)
   add_subdirectory(middleware/openmaxil)
endif()


Note that this issue will affect all 64-bit OSes for the RPi3/4 (including PiOS64), not just Gentoo.

You should be able to get raspberrypi-omxplayer-9999 building OK on 32-bit arm of course (once the makefile patch is adjusted for the current tip) but someone else would need to advise you on that (and it isn't clear that's what you want anyhow, given you've posted in this thread).
_________________
Regards,

sakaki
Back to top
View user's profile Send private message
Sakaki
Guru
Guru


Joined: 21 May 2014
Posts: 409

PostPosted: Sun Jun 28, 2020 12:26 am    Post subject: Reply with quote

drizzt wrote:
I switched the language to de_DE.utf8 and because of this I need to rebuild firefox. Unfortunately this failes with the following error:
...
Does anyone have any hints how to fix this ?

So, I just tried the following tests:
  • arm64: L10N="en en-GB" emerge =firefox-77.0.1 succeeds (this is the shipped version on the v1.6.0 image)
  • arm64: L10N="en en-GB de" emerge =firefox-77.0.1 fails, with the error you cited
  • amd64: L10N="en en-GB de" emerge =firefox-77.0.1 succeeds
  • arm64: L10N="en en-GB de" emerge =firefox-76.0.1 succeeds

So it would appear to be some form of arm64-specific regression (affecting gentoo-on-rpi-64bit, at least) between 76.0.1 and 77.0.1.
Will need to dig deeper to check what this is exactly, but from the above you could mask back to 76.0.1 in the short term, given that you are compiling your own version.
_________________
Regards,

sakaki
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54096
Location: 56N 3W

PostPosted: Sun Jun 28, 2020 4:14 pm    Post subject: Reply with quote

Team,

Play with
Code:
eselect python
I've had some versions of firefox fail to build with python-3.6.

Code:
L10N="en en-GB de" emerge --buildpkgonly =firefox-77.0.1
works for me with
Code:
# eselect python list
Available Python interpreters, in order of preference:
  [1]   python3.7
  [2]   python2.7
  [3]   python3.6
  [4]   python3.9 (fallback)
  [5]   python3.8 (fallback)


The error reads as if python3.6 is being used.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Sakaki
Guru
Guru


Joined: 21 May 2014
Posts: 409

PostPosted: Sun Jun 28, 2020 5:53 pm    Post subject: Reply with quote

Hi Neddy -

you nailed it!

I have been using python:3.6 as the default on my arm64 buildserver (and on the shipped image), as I thought that more conservative than switching to python:3.7.

But after using 'eselect python set python3.7', I was indeed able to successfully run:
Code:
pi64 ~ # L10N="en en-GB de" emerge =firefox-77.0.1


All users of gentoo-on-rpi-64bit: happily there is a (pgo) instance of python:3.7 already bundled with the image, so in light of the above, it probably makes sense for you to issue:

Code:
pi64 ~ # eselect python set python3.7


to make it the default, if you haven't already done so (or have a specific reason to use a different default).
_________________
Regards,

sakaki
Back to top
View user's profile Send private message
ekcsolutions
n00b
n00b


Joined: 29 Jun 2020
Posts: 1
Location: Sydney/Australia

PostPosted: Mon Jun 29, 2020 5:05 am    Post subject: Rpi4 8gb Sound issue Reply with quote

Hi Sakaki. Thanks for the lasest upgrade.
I am very new to Genpi64 but am working my way through it but i just cant seem to get the sound working on my RPI4.
i have tried running # lspci | grep Audio but this doesn't return anything so i don't know how to see what is loading.
I am running speakers through the jack not HDMI.
hope you can help. :?
_________________
Regards Chris
Back to top
View user's profile Send private message
Sakaki
Guru
Guru


Joined: 21 May 2014
Posts: 409

PostPosted: Mon Jun 29, 2020 8:25 am    Post subject: Re: Rpi4 8gb Sound issue Reply with quote

ekcsolutions wrote:
Hi Sakaki. Thanks for the lasest upgrade.
I am very new to Genpi64 but am working my way through it but i just cant seem to get the sound working on my RPI4.
i have tried running # lspci | grep Audio but this doesn't return anything so i don't know how to see what is loading.
I am running speakers through the jack not HDMI.
hope you can help. :?

Hi ekcsolutions,

with the recent kernels, each of the potential audio sinks (HDMI-1, HDMI-2 and headphone jack) show up as separate ALSA devices (unlike the old situation where you needed to issue a cset to route audio).

Therefore, all you need to do to use the headphone jack is to route audio there by default, using the pulseaudio volume conrol.

To do so, right-click on the speaker icon in the top panel, and choose "Open Mixer" from the drop-down (alternatively, you can use Applications -> Multimedia -> PulseAudio Volume Control to do this).

Once open, select the Output Devices tab, and ensure that the green tickmark button in the "bcm2835 Headphones Stereo" section is selected (it should, slightly confusingly, have a grey background if selected, just like the padlock item beside it). You can also set the output level for each device here.

That's it - now by default audio playback should route through the headphone jack!

When an app is playing, you can also set the playback route for it explicitly - try e.g. playing some audio via VLC and then looking at the Playback tab in the above pulseaudio volume control. There's a dropdown there you can use to select the output route. Also, VLC (like a few other apps) allows you to select the output route in-app too; choose Audio -> Audio Device and select it.

If you still have problems with this, please let me know!
_________________
Regards,

sakaki
Back to top
View user's profile Send private message
drizzt
Guru
Guru


Joined: 21 Jul 2002
Posts: 428

PostPosted: Mon Jun 29, 2020 8:57 pm    Post subject: Reply with quote

NeddySeagoon wrote:
Team,

Play with
Code:
eselect python
I've had some versions of firefox fail to build with python-3.6.

Code:
L10N="en en-GB de" emerge --buildpkgonly =firefox-77.0.1
works for me with
Code:
# eselect python list
Available Python interpreters, in order of preference:
  [1]   python3.7
  [2]   python2.7
  [3]   python3.6
  [4]   python3.9 (fallback)
  [5]   python3.8 (fallback)


The error reads as if python3.6 is being used.


Hi Neddy,
as Sakaki already said: you nailed it. Setting python3.7 as default python interpreter made firefox build like a charm.
Additionally I want to say that I had to increase the swap space ( I set it to 8GB) to successfully build firefox with the pi4 only (8GB version).

Thank you all
_________________
People don't have to earn my respect. I offer my respect to them, but be careful to lose my respect...
Back to top
View user's profile Send private message
Haraldpeter
n00b
n00b


Joined: 08 Jun 2016
Posts: 65

PostPosted: Sun Jul 12, 2020 7:10 pm    Post subject: Rhasp pi4 Sakaki Gentoo install switch to ssd Reply with quote

Hi, i will switch from sd to ssd and i am not really sure how to to that.
what i have done in the meanwhile:

- edit /etc/default/rpi-eeprom-update to "beta"
- reboot
- reboot a second one
is this ok?

bootloader version after this:
Code:
vcgencmd bootloader_version
Jun 15 2020 14:36:19
version c302dea096cc79f102cec12aeeb51abf392bd781 (release)
timestamp 1592228179


bootloader config after this:
Code:
vcgencmd bootloader_config
BOOT_UART=0
WAKE_ON_GPIO=1
POWER_OFF_ON_HALT=0
FREEZE_VERSION=0                       


what is the right way to copy and finish this on a ssd ?

Haraldpeter
Back to top
View user's profile Send private message
Haraldpeter
n00b
n00b


Joined: 08 Jun 2016
Posts: 65

PostPosted: Wed Jul 15, 2020 9:59 am    Post subject: fstrim Reply with quote

Hi,
so my rhasp4 runs only with ssd on an inateck usb3 to sata adapter.
but i have a question: is it possible to run a fstrim command on this ssd? fstrim -v / does not work
Back to top
View user's profile Send private message
Sakaki
Guru
Guru


Joined: 21 May 2014
Posts: 409

PostPosted: Fri Jul 17, 2020 3:55 pm    Post subject: Reply with quote

Hi Haraldpeter,

apologies for the delay in replying >< been a busy week...

I take it you got the boot from USB to work in the end, given you say above "so my rhasp4 runs only with ssd on an inateck usb3 to sata adapter"?

In any case, yes, your EEPROM image with timestamp 1592228179 should be sufficient for USB boot, and all you need to do once the EEPROM has been flashed (as yours has) is to clone your current bootable microSD card image to a (same size or larger) USB storage device (can be as SSD with a USB to SSD adaptor). This is most easily done on a PC, using dd or similar. Once done, you can then expand the rootfs partition and filesystem on the USB device, if its capacity is larger than the source uSD card (which is likely, if using an SSD). gparted allows you to do this resize straightforwardly via a GUI.

With that done, simply reboot your RPi4 with only the USB device connected (no uSD card present), and it should all 'just work'.

Note that some USB <-> SATA adaptors require quirks to boot sensibly on USB3 so to begin with, connect your adaptor / device to a USB2 port (black rather than blue insert) on your Pi4. Once you know you have a working system you can then try using a USB3 port for the device instead.
_________________
Regards,

sakaki
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54096
Location: 56N 3W

PostPosted: Fri Jul 17, 2020 5:49 pm    Post subject: Reply with quote

Haraldpeter,

I have 3 or 4 USB3 to SATA adaptors and even the new ones do not pass the trim command to the SSD.
I've tried from a Pi4 and a PC.

For trim to work, you need UAS in the kernel and for it to work with your USB3 root hub and USB to SATA device.
Unless its been fixed on the Pi4, USB quirks disables UAS on the Pi.

USB2 does not support UAS by design, so trim cannot work over USB2
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Haraldpeter
n00b
n00b


Joined: 08 Jun 2016
Posts: 65

PostPosted: Fri Jul 17, 2020 5:59 pm    Post subject: fstrim and usb Reply with quote

Hi,
in the meanwhile all works fine . the problem was my sata to usb adapter Inateck USB3.0 to SATA . I buy another adapter UGREEN Sata Adapter - and voila - trim works.
What I have done:
Code:
lsusb 
Bus 002 Device 002: ID 174c:55aa ASMedia Technology Inc. Name: ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge, ASM1153E SATA 6Gb/s bridge

then I create a File:
Code:
nano /etc/udev/rules.d/10-trim_umap.rules

with this in it
Code:
ACTION=="add|change", ATTRS{idVendor}=="174c", ATTRS{idProduct}=="55aa", SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"


after reboot it works!

but another Question:
the last genup update downloaded a "new"eeprom firmware and dispatch-conf wants to set it back to "critical" instead of "beta". Can I do this ? or what must i do in the future to always boot from ssd?

Best regards
Haraldpeter
Back to top
View user's profile Send private message
Haraldpeter
n00b
n00b


Joined: 08 Jun 2016
Posts: 65

PostPosted: Fri Jul 17, 2020 6:17 pm    Post subject: trim Reply with quote

NeddySeagoon ,

i think it has todo with the firmware of the ASMedia Chip.

Both Adaptors use the ASM1051E and both adapters have the same ID = ID 174c:55aa .
The Manual from the Ugreen Adapter on AMAZON ( in German) :

"Praktische Multifunktion: Neben UASP-Protokoll unterstützt der SATA Adapter für intelligenten Ruhemodus, TRIM-Befehl zur SSD und S.M.A.R.T für Selbstüberwachung" .

The Inateck USB3.0 to SATA dont have UASAP but the same Chip

With the Ugreen:
Code:
fstrim -v /


Code:
/: 1,9 GiB (1987022848 Bytes) getrimmt


the first time it trim 104 GB but one hour later it is only this






Best Regards
Haraldpeter
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54096
Location: 56N 3W

PostPosted: Fri Jul 17, 2020 8:13 pm    Post subject: Reply with quote

Haraldpeter,

That's fine.

The filesystem remembers what it trimmed form one trim to the next but its not saved across power cycles.

The first trim after a power up, finds all the unallocated space in the filesystem. Hence your 104GB trimmed.
An hour later, the filesystem remembers the 104GB already trimmed, and finds that a further 1.9 GiB can be trimmed.
Thats the space freed in that hour.

Trim is not supposed to be a command to the drive. Its an advisory that the space can be erased whenever the drive wants to.
Some sub optimal firmware treats trim as a command, and does it immediately.
The immediate trim will increase the accumulated erase cycles on the drive and shorten its useful life. That may not matter. If it only lasted 15 years instead of 45 years, or whatever ...
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Sakaki
Guru
Guru


Joined: 21 May 2014
Posts: 409

PostPosted: Fri Jul 17, 2020 9:08 pm    Post subject: Re: fstrim and usb Reply with quote

Haraldpeter wrote:

but another Question:
the last genup update downloaded a "new"eeprom firmware and dispatch-conf wants to set it back to "critical" instead of "beta". Can I do this ? or what must i do in the future to always boot from ssd?

Best regards
Haraldpeter

I believe that the USB boot is supported in the 'stable' EEPROM image now (there are three levels, 'critical', 'stable' and 'beta'), so you could set (in /etc/default/rpi-eeprom-update):
Code:

FIRMWARE_RELEASE_STATUS="stable"

and when prompted by dispatch-conf to update this file in future, use z (zap-new) to keep your version (i.e. stick with "stable" rather than "critical").

This will allow you to use a somewhat more frequently updated version of the EEPROM image going forward (and crucially which will support USB boot, which "critical" currently does not), while not exposing you to the bleeding-edge "beta" releases (which may have as-yet-uncaught serious bugs).
_________________
Regards,

sakaki
Back to top
View user's profile Send private message
Haraldpeter
n00b
n00b


Joined: 08 Jun 2016
Posts: 65

PostPosted: Sat Jul 18, 2020 4:51 pm    Post subject: fstrim Reply with quote

Hi,

many thanks to all - withe the firmware"stable" it works on a ssd.

my rhasp runs 24/7 to controll everything in my garden and koipond

Best Regards
Haraldpeter
Back to top
View user's profile Send private message
Haraldpeter
n00b
n00b


Joined: 08 Jun 2016
Posts: 65

PostPosted: Sat Jul 18, 2020 5:36 pm    Post subject: ssd on Rhasp pi4 aligment? Reply with quote

Hi,

today i check the right aligment on my rhasp 4 ssd and i get this:

Code:
lsblk --discard
NAME   DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
sda           0      512B       4G         0
├─sda1        0      512B       4G         0
└─sda2        0      512B       4G         0


Code:
parted /dev/sda align-check opt 1
1 not aligned: 2048s % 65535s != 0s


Code:
parted /dev/sda align-check opt 2
2 not aligned: 526336s % 65535s != 0s



what does it meant?


Last edited by Haraldpeter on Sat Jul 18, 2020 8:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
Haraldpeter
n00b
n00b


Joined: 08 Jun 2016
Posts: 65

PostPosted: Sat Jul 18, 2020 7:50 pm    Post subject: aligment on usb to sata Reply with quote

Hi,

i did read something about this Here: https://linux-blog.anracom.com/2018/12/03/linux-ssd-partition-alignment-problems-with-external-usb-to-sata-controllers-i/


Last edited by Haraldpeter on Sat Jul 18, 2020 8:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
Haraldpeter
n00b
n00b


Joined: 08 Jun 2016
Posts: 65

PostPosted: Sat Jul 18, 2020 8:19 pm    Post subject: Reply with quote

Hi,

that means it is normally?
Back to top
View user's profile Send private message
ian.au
Guru
Guru


Joined: 07 Apr 2011
Posts: 591
Location: Australia

PostPosted: Sat Jul 18, 2020 10:04 pm    Post subject: Reply with quote

Haraldpeter wrote:
Hi,

that means it is normally?

I'm no expert on ssd trimming, but I think that's irrelevant, afaik
Code:
lsblk -D
only returns a value from
Code:
/sys/block/<disk>/queue/discard_zeroes_data
for a value to report, and kernel.org says
kernel.org/doc wrote:

What: /sys/block/<disk>/queue/discard_zeroes_data
Date: May 2011
Contact: Martin K. Petersen <martin.petersen@oracle.com>
Description:
Will always return 0. Don't rely on any specific behavior
for discards, and don't read this file.
You can read this here

Edit 1: removed raspbian link to setting trim (it was systemd based so not relevant
Edit 2: finished answer below after hit post instead of preview..


I don't think that your parted command will return anything meaningful, what does it say if you use it interactively per the below:
Code:
pi64 ~ # parted /dev/sda1
GNU Parted 3.3
Using /dev/sda1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) align-check                                                     
alignment type(min/opt)  [optimal]/minimal? opt                           
Partition number? 1                                                       
1 aligned
(parted) quit


Last edited by ian.au on Sat Jul 18, 2020 10:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54096
Location: 56N 3W

PostPosted: Sat Jul 18, 2020 10:08 pm    Post subject: Reply with quote

Haraldpeter,

Be very wary of doing low level SCSI commands over USB.
Its harmless but the results, if you get any at all, are often incorrect.
USB to SATA converters are not very good at these things.

Code:
lsblk --discard
NAME   DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
sda           0      512B       4G         0


Your drive may tolerate 512B reads/writes but it will have a 4k physical sector size, That's the smallest region that can be written.
Internally, it will fake 512B writes, be doing a read of the 4k block, changing 512B and writing the modified 4k block back.


I suspect that you will get a different answer if you connect the drive to a real SATA port in a PC.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Goto page Previous  1, 2, 3 ... 10, 11, 12, 13, 14  Next
Page 11 of 14

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum