# X session fails with ATI Radeon HD 4670 - KMS /radeon driver

## Pums

Hi everyone,

 I'm in trouble with an iMac (mid 2010) and its GPU ATI Radeon HD 4670 256 Mb. It seems the radeon free driver fails with it.

I've tried a plenty of GNU/Linux distributions. I could perform a complete install only with Gentoo, Debian 10, Ubuntu 20 and openSuse (15.1, successfully upgraded to 15.2 recently, and the open release Tumbleweed). In all cases, I need to add the "nomodeset" or "radeon.modeset=0" kernel parameter on boot in order not to get a frozen black screen right after loading the initramfs. Other distros I've tested give a black screen anyhow on Live CD; Debian and Ubuntu do the same on first post-install boot.

With opensuse, I can open a proper X session with desktop environment, still with nomodeset or radeon.modeset=0 parameter. It's perfectly suitable despite some display jaggedness. Tumbleweed even handles enjoyable transparency effects on Plasma desktop.

On Gentoo, install DVD  could not load graphic mode and the whole install process was somehow epic, with several yet unclear hangs during world updates, kernel builds and grub installs. Boot on two installed 5.4.48 custom kernels ends up with kernel panic. I've eventually resorted to use a pre-built gentoo-kernel (5.4.40), capable of avoiding black screen (needless to say, with one of the imperative kernel parameters) and have a flawless boot (woah!), but X server fails to start. (I have no display manager installed)

Here are the last lines of Xorg.0.log:

```

(EE) Screen 0 deleted because of no matching config section.

[    49.999] (II) UnloadModule: "radeon"

[    49.999] (EE) Screen 0 deleted because of no matching config section.

[    49.999] (II) UnloadModule: "modesetting"

[    49.999] (EE) Screen 0 deleted because of no matching config section.

[    49.999] (II) UnloadModule: "fbdev"

[    49.999] (II) UnloadSubModule: "fbdevhw"

[    49.999] (EE) 

Fatal server error:

[    49.999] (EE) Cannot run in framebuffer mode. Please specify busIDs        for all framebuffer devices

[    49.999] (EE) 

[    49.999] (EE) 

Please consult the The X.Org Foundation support 

    at http://wiki.x.org

 for help. 

[    49.999] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.

[    49.999] (EE) 

[    50.016] (EE) Server terminated with error (1). Closing log file.

```

Complete log is reachable there: http://dpaste.com/3VX4NBE.

Some more infos:

"# lsmod" there : http://dpaste.com/2EFJSE6

```

# lspci -k | grep -A2 -Ei "vga|display"

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] RV730/M96-XT [Mobility Radeon HD 4670]

        Subsystem: Apple Inc. RV730/M96-XT [Mobility Radeon HD 4670]

        Kernel modules: radeon
```

```
 # modprobe radeon

modprobe: ERROR: could not insert 'radeon': Invalid argument

```

though radeon module does exist... Is it because modesetting is deactivated on boot, or am I missing something?

```
# less /proc/config.gz |grep -i radeon

CONFIG_DRM_RADEON=m

CONFIG_DRM_RADEON_USERPTR=y

# CONFIG_FB_RADEON is not set

```

Could setting this last parameter help for something?

```

mac ~ # less /proc/config.gz |grep -i amd

CONFIG_X86_AMD_PLATFORM_DEVICE=y

CONFIG_CPU_SUP_AMD=y

CONFIG_X86_MCE_AMD=y

CONFIG_PERF_EVENTS_AMD_POWER=m

CONFIG_MICROCODE_AMD=y

CONFIG_AMD_MEM_ENCRYPT=y

# CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT is not set

CONFIG_AMD_NUMA=y

CONFIG_X86_AMD_FREQ_SENSITIVITY=m

CONFIG_AMD_NB=y

CONFIG_KVM_AMD=m

CONFIG_KVM_AMD_SEV=y

CONFIG_MTD_CFI_AMDSTD=m

CONFIG_MTD_AMD76XROM=m

CONFIG_PATA_AMD=m

CONFIG_NET_VENDOR_AMD=y

CONFIG_AMD8111_ETH=m

CONFIG_AMD_XGBE=m

CONFIG_AMD_XGBE_DCB=y

CONFIG_AMD_XGBE_HAVE_ECC=y

CONFIG_AMD_PHY=m

CONFIG_HW_RANDOM_AMD=m

CONFIG_I2C_AMD756=m

CONFIG_I2C_AMD756_S4882=m

CONFIG_I2C_AMD8111=m

CONFIG_I2C_AMD_MP2=m

CONFIG_PINCTRL_AMD=m

CONFIG_GPIO_AMDPT=m

CONFIG_GPIO_AMD_FCH=m

CONFIG_GPIO_AMD8111=m

CONFIG_AGP_AMD64=m

CONFIG_DRM_AMDGPU=m

CONFIG_DRM_AMDGPU_SI=y

CONFIG_DRM_AMDGPU_CIK=y

CONFIG_DRM_AMDGPU_USERPTR=y

# CONFIG_DRM_AMDGPU_GART_DEBUGFS is not set

CONFIG_DRM_AMD_ACP=y

CONFIG_DRM_AMD_DC=y

CONFIG_DRM_AMD_DC_DCN1_0=y

CONFIG_DRM_AMD_DC_DCN2_0=y

CONFIG_DRM_AMD_DC_DCN2_1=y

CONFIG_DRM_AMD_DC_DSC_SUPPORT=y

CONFIG_HSA_AMD=y

CONFIG_SND_SOC_AMD_ACP=m

CONFIG_SND_SOC_AMD_CZ_DA7219MX98357_MACH=m

CONFIG_SND_SOC_AMD_CZ_RT5645_MACH=m

CONFIG_SND_SOC_AMD_ACP3x=m

CONFIG_USB_AMD5536UDC=m

CONFIG_EDAC_AMD64=m

# CONFIG_EDAC_AMD64_ERROR_INJECTION is not set

CONFIG_AMD_IOMMU=y

CONFIG_AMD_IOMMU_V2=y

CONFIG_NTB_AMD=m

```

ATI proprietary driver should not be suitable since it only supports up to Xserver 1.12 and Linux kernel 3.4 (see https://www.amd.com/en/support/graphics/amd-radeon-hd/ati-radeon-hd-4000-series/ati-radeon-hd-4670 ). However, an install trial results in:

```
Check if system has the tools required for installation.

fglrx installation requires that the system have kernel headers.  /lib/modules/5.4.40/build/include/linux/version.h cannot be found on this system.

One or more tools required for installation cannot be found on the system. Install the required tools before installing the fglrx driver.

Optionally, run the installer with --force option to install without the tools.

Forcing install will disable AMD hardware acceleration and may make your system unstable. Not recommended.
```

It doesn't find the headers, although they're installed (I could not figure out where they are myselg, I thought they were part of kernel sources, but actually they are a separated package; those are cryptic considerations for me and I don't think it's key to solve my problem).

My technical skills are restricted, but I'd really like to figure out why and how others fail when openSuse succeeds. Is it a specific kernel patch or parameter? And if it does, shouldn't be Gentoo able to do the same, or shouldn't there be any workaround?

Any idea is welcome to help investigate that issue.Last edited by Pums on Mon Jul 20, 2020 11:53 pm; edited 2 times in total

----------

## DaggyStyle

can you post the following outputs?

dmesg

emerge --info

----------

## DaggyStyle

just to point out, I mustn't have nomodeset or radeon.modeset=0 set in your kernel or less the driver must probably won't work.

can you also post the entire .config?

note that you don't need CONFIG_DRM_AMDGPU at all

----------

## Pums

Thanks for help.

$ dmesg > http://dpaste.com/1ZPKCJK

$ less /usr/src/linux/.config > http://dpaste.com/3SKWYRX

(as I've said, it's the default config of gentoo-kernel package since I could not build an usual custom kernel)

```
$ emerge --info 

Portage 2.3.99 (python 3.7.8-final-0, default/linux/amd64/17.1/desktop, gcc-9.3.0, glibc-2.30-r8, 5.4.40 x86_64)

=================================================================

System uname: Linux-5.4.40-x86_64-Intel-R-_Core-TM-_i3_CPU_540_@_3.07GHz-with-gentoo-2.6

KiB Mem:    16390136 total,  16146008 free

KiB Swap:   17411064 total,  17411064 free

Timestamp of repository gentoo: Sat, 11 Jul 2020 23:30:01 +0000

Head commit of repository gentoo: aa159e51bb9c563de948887ab9311af1627db519

sh bash 5.0_p17

ld GNU ld (Gentoo 2.33.1 p2) 2.33.1

app-shells/bash:          5.0_p17::gentoo

dev-lang/perl:            5.30.3::gentoo

dev-lang/python:          2.7.18::gentoo, 3.7.8-r1::gentoo, 3.8.3-r1::gentoo

dev-util/cmake:           3.16.5::gentoo

sys-apps/baselayout:      2.6-r1::gentoo

sys-apps/openrc:          0.42.1::gentoo

sys-apps/sandbox:         2.18::gentoo

sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo

sys-devel/automake:       1.16.1-r1::gentoo

sys-devel/binutils:       2.33.1-r1::gentoo

sys-devel/gcc:            9.3.0::gentoo

sys-devel/gcc-config:     2.3::gentoo

sys-devel/libtool:        2.4.6-r6::gentoo

sys-devel/make:           4.2.1-r4::gentoo

sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)

sys-libs/glibc:           2.30-r8::gentoo

Repositories:

gentoo

    location: /var/db/repos/gentoo

    sync-type: rsync

    sync-uri: rsync://192.168.1.6/gentoo-portage

    priority: -1000

    sync-rsync-extra-opts: 

    sync-rsync-verify-metamanifest: yes

    sync-rsync-verify-jobs: 1

    sync-rsync-verify-max-age: 24

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="@FREE"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=westmere -mmmx -msse -msse2 -msse3 -mssse3 -mcx16 -msahf -mpopcnt -msse4.2 -msse4.1 -mfxsr --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=westmere -fstack-protector-strong -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=westmere -mmmx -msse -msse2 -msse3 -mssse3 -mcx16 -msahf -mpopcnt -msse4.2 -msse4.1 -mfxsr --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=westmere -fstack-protector-strong -O2 -pipe"

DISTDIR="/var/cache/distfiles"

ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"

FCFLAGS="-march=westmere -mmmx -msse -msse2 -msse3 -mssse3 -mcx16 -msahf -mpopcnt -msse4.2 -msse4.1 -mfxsr --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=westmere -fstack-protector-strong -O2 -pipe"

FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"

FFLAGS="-march=westmere -mmmx -msse -msse2 -msse3 -mssse3 -mcx16 -msahf -mpopcnt -msse4.2 -msse4.1 -mfxsr --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=westmere -fstack-protector-strong -O2 -pipe"

GENTOO_MIRRORS="ftp://ftp.free.fr/mirrors/ftp.gentoo.org/ http://ftp.free.fr/mirrors/ftp.gentoo.org/ http://gentoo.mirrors.ovh.net/gentoo-distfiles/ https://mirrors.soeasyto.com/distfiles.gentoo.org/ ftp://mirrors.soeasyto.com/distfiles.gentoo.org/ http://mirrors.soeasyto.com/distfiles.gentoo.org/"

LANG="en_US.utf8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j5"

PKGDIR="/var/cache/binpkgs"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"

PORTAGE_TMPDIR="/var/tmp"

USE="X a52 aac acl acpi alsa amd64 berkdb branding bzip2 cairo cdda cdr cli crypt dbus dri dts dvd dvdr elogind emboss encode exif flac fortran gdbm gif gpm gtk iconv icu ipv6 jpeg lcms ldap libnotify libtirpc mad mng mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds qt5 readline sdl seccomp spell split-usr ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vorbis wifi wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python2_7 python3_7" RUBY_TARGETS="ruby25" USERLAND="GNU" VIDEO_CARDS="radeon vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

(I run a local rsync Gentoo mirror, see https://wiki.gentoo.org/wiki/Local_Mirror , it works without a problem)

About your second message, I'm not sure to understand what you actually mean. To make it clear in case it's not, adding nomodeset or radeon.modeset=0 kernel parameter on boot is the only way I've found not to have a frozen black screen immediately. OpenSuse handles it and manages to open X session (with those two related messages  "[drm] VGACON disable radeon kernel modesetting." and "drm:radeon_init [radeon]] *ERROR* No UMS support in radeon module!" on boot).

----------

## DaggyStyle

from your dmesg:

```
[   10.286269] [drm:init_module [radeon]] *ERROR* No UMS support in radeon module!
```

as said, you cannot load drm without modeset.

the reason modeset doesn't work is because you are missing the relevant firmware in the kernel.

consult this for more information.

----------

## Pums

 *DaggyStyle wrote:*   

> from your dmesg:
> 
> ```
> [   10.286269] [drm:init_module [radeon]] *ERROR* No UMS support in radeon module!
> ```
> ...

 

I've managed to make a new kernel 5.4.48, retrieving config from gentoo-kernel and adding the firmware matching with my GPU, "radeon/R700_rlc.bin radeon/RV730_smc.bin radeon/RV710_uvd.bin radeon/RV730_me.bin radeon/RV730_pfp.bin", according to the page you mentioned. I still have a black screen on boot without "nomodeset"; with nomodeset, just like previously, boot is ok but X returns the same error.

Complete config file : http://dpaste.com/1J8RTH6

It seems not as clear as you say, or I do miss something. And the fact is that openSuse (only, until now) can have a X session working with the same conditions.

----------

## DaggyStyle

have you installed the fw pkg, e.g. sys-kernel/linux-firmware?

can you provide dmesg from the bad boot? either via ssh or syslog-ng and such?

----------

## DaggyStyle

try adding the fw of 710 too

----------

## theotherjoe

```
CONFIG_EXTRA_FIRMWARE="radeon/RV730_me.bin radeon/RV730_pfp.bin radeon/RV730_smc.bin radeon/R700_rlc.bin radeon/RV710_uvd.bin"

```

these are the firmware blobs needed for a HD4670 to work properly.

----------

## Pums

 *theotherjoe wrote:*   

> 
> 
> ```
> CONFIG_EXTRA_FIRMWARE="radeon/RV730_me.bin radeon/RV730_pfp.bin radeon/RV730_smc.bin radeon/R700_rlc.bin radeon/RV710_uvd.bin"
> 
> ...

 

Exactly the ones I've added:

```
$ zcat /proc/config.gz |grep radeon

CONFIG_EXTRA_FIRMWARE="radeon/R700_rlc.bin radeon/RV730_smc.bin radeon/RV710_uvd.bin radeon/RV730_me.bin radeon/RV730_pfp.bin"
```

----------

## Pums

 *DaggyStyle wrote:*   

> have you installed the fw pkg, e.g. sys-kernel/linux-firmware?

 

Yes.

```
 $ eix linux-firmware

[I] sys-kernel/linux-firmware

     Available versions:  20200316^bsd 20200421^bsd 20200519^bsd 20200619^bsd **99999999*l^bsd {initramfs +redistributable savedconfig unknown-license}

     Installed versions:  20200619^bs(06:54:58 PM 07/09/2020)(redistributable -initramfs -savedconfig -unknown-license)
```

 *DaggyStyle wrote:*   

> can you provide dmesg from the bad boot? either via ssh or syslog-ng and such?

 

Yes (ssh): $ dmesg > http://dpaste.com/15KPQK7

Now "radeon kernel modesetting enabled.", but I still get a blackscreen (now some seconds after openrc is launched; before, I could only see "loading initramfs").

 *DaggyStyle wrote:*   

> 
> 
> try adding the fw of 710 too

 

I can't find it:

```
$ eix *710*

No matches found

```

Or do you mean adding also the firmwares blobs for RV710 mentionned on the Radeon wiki's page?Last edited by Pums on Sat Jul 18, 2020 1:18 pm; edited 2 times in total

----------

## DaggyStyle

the dmesg show the module is loaded successfully.

if you disable X, do you get to login on screen?

----------

## Pums

 *DaggyStyle wrote:*   

> the dmesg show the module is loaded successfully.
> 
> if you disable X, do you get to login on screen?

 

X isn't enabled. I have no display manager installed, I need to launch it manually.

I can't get to login screen if I don't deactivate modesetting.

----------

## DaggyStyle

try disabling CONFIG_FB_SIMPLE and check again

if not working try kernel 5.4.48 or kernel 4.19.129

----------

## NeddySeagoon

Pums,

Please pastebin /var/log/Xorg.0.log so we can see what Xorg does when it starts.

```
[   13.134529] fbcon: radeondrmfb (fb0) is primary device

[   13.175111] Console: switching to colour frame buffer device 240x67

[   13.182091] radeon 0000:01:00.0: fb0: radeondrmfb frame buffer device
```

says that your kernel is probably OK.

Your root filesystem is mounted at 

```
[    5.493167] EXT4-fs (sda10): mounted filesystem with ordered data mode. Opts: (null)
```

which is a long time before the radeon drive is initalised, so I guess you have in set as a module. That's fine.

----------

## Pums

Thanks for your help.

 *NeddySeagoon wrote:*   

> 
> 
> Please pastebin /var/log/Xorg.0.log so we can see what Xorg does when it starts.
> 
> 

 

/var/log/Xorg.0.log: http://dpaste.com/2WMSS8Y

Previously, I tried to launch "startx" "blindly" twice  (though I've no screen, I can access ttys, login, run commands...). In case it case help, these are the two Xorg.0.log I've gotten: http://dpaste.com/2DGQHND and http://dpaste.com/1A6W6FT.

----------

## DaggyStyle

 *Pums wrote:*   

> Thanks for your help.
> 
>  *NeddySeagoon wrote:*   
> 
> Please pastebin /var/log/Xorg.0.log so we can see what Xorg does when it starts.
> ...

 

dbus is working?

----------

## Pums

 *DaggyStyle wrote:*   

> try disabling CONFIG_FB_SIMPLE and check again
> 
> if not working try kernel 5.4.48 or kernel 4.19.129

 

I'm currently using 5.4.48. I could not make custom kernel from 5.4.40 since with gentoo-kernel sources are not available (I use default last stable packages in my whole world set). As stated before, I retrieved gentoo-kernel config, oldconfiged it on gentoo-sources 5.4.48 and added the firmwares.

I may try to make a new 4.19.129 kernel if nothing else works but actually it's long and "painful" with that comp (as I've said in my first message, it often hangs for unknwon reason on large building processes; last night yet, It hung during gcc update). Why do you think it'd work with that kernel?

----------

## DaggyStyle

 *Pums wrote:*   

>  *DaggyStyle wrote:*   try disabling CONFIG_FB_SIMPLE and check again
> 
> if not working try kernel 5.4.48 or kernel 4.19.129 
> 
> I'm currently using 5.4.48. I could not make custom kernel from 5.4.40 since with gentoo-kernel sources are not available (I use default last stable packages in my whole world set). As stated before, I retrieved gentoo-kernel config, oldconfiged it on gentoo-sources 5.4.48 and added the firmwares.
> ...

 

it isn't far fetched that a kernel will have a bug.

if your system hungs during load, I think you should look at it first as it might have a connection to what you see.

I had a laptop with gentoo on it which misbehaved because the gpu fan has wore out.

----------

## Pums

 *DaggyStyle wrote:*   

> 
> 
> dbus is working?

 

Dbus isn't even installed; but X doesn't need it. For the moment, I've installed Lumina desktop that doesn't need it either (see https://wiki.gentoo.org/wiki/Lumina.

----------

## DaggyStyle

 *Pums wrote:*   

>  *DaggyStyle wrote:*   
> 
> dbus is working? 
> 
> Dbus isn't even installed; but X doesn't need it. For the moment, I've installed Lumina desktop that doesn't need it either (see https://wiki.gentoo.org/wiki/Lumina.

 

you have dbus errors in Xorg.log, bot sure how much it is related

----------

## NeddySeagoon

Pums,

Your log ends with 

```
[   557.528] (II) Server terminated successfully (0). Closing log file.
```

That means that Xorg started properly, its using the radeon driver, found nothing to do and quit.

Run 

```
emerge -1av twm xclock xterm
```

Its a number of small packges.

When that completes, I expect startx to show you three xterms and an analogue clock all wrapped up in twm.

twm only uses the primary mouse button.

If you have a ~/.xinitrc, rename it so its not found.

----------

## Pums

 *DaggyStyle wrote:*   

> 
> 
> it isn't far fetched that a kernel will have a bug.

 

In absolute terms it is not. But in the specific case of this mac and its GPU, considering that I could not have X working properly with anyone of the numerous distributions I've tried, among them Debian 10 (with Linux 4.19), Fedora 29, 30, 31 and 32, Manjaro, Bodhi Linux 5.1, Mageia 7.1, Linuxmint 17, Linux Lite 4.8,, (X)Ubuntu 18 and 20, and considering that openSuse does it from Leap 15.1 (Linux 4.19) to Tumbleweed (5.7), including Leap 15.2 (5.3.18 ), it seems to me a bit far fetched to suppose it'd be a version specific kernel bug. I may be wrong since I'm a newbie and sure I don't know and misunderstand many things, I aim to learn and understand.

 *DaggyStyle wrote:*   

> 
> 
> if your system hungs during load, I think you should look at it first as it might have a connection to what you see.
> 
> I had a laptop with gentoo on it which misbehaved because the gpu fan has wore out.

 

It's an iMac, impossible to open and have a peek inside without a professional equipment I have not, would cost an arm and a leg to have it done by a professional, that old computer doesn't worth it anyway.

I hope it's not a more specific hardware issue like the one you've had. Nevertheless, macOS still works perfectly on it and I've never had a problem of such but on Gentoo.

I guess it must be full of dust inside, I'll have to do with it (I could take off a handful of dust from the ram compartment which is the only screw closed part). The "case" (I don't know if it's the proper word) easily heats,  I presume it can explain it hangs during hard loads. However I don't know how I can check this out. The screen freezes, ssh stops, I can't do anything but a hard reboot. I'll try reducing MAKEOPTS from -j5 to -j3 (it's a quadcore).Last edited by Pums on Sat Jul 18, 2020 8:18 pm; edited 1 time in total

----------

## Pums

 *NeddySeagoon wrote:*   

> 
> 
> Your log ends with 
> 
> ```
> ...

 

I have already those packages installed (I always install them along with Xserver since they are necessary to start a basic X session).

I have two regular users accounts, one has .xinitrc set for starting Lumina, and the other doesn't have .xinitrc. It does not change anything.

I don't think it's the problem anyway: when the server says it terminated successfully, my screen is totally black since boot time (it becomes black after displaying some regular lines of openrc launching services). I've started X "blindly", I mean with absolute black screen, I do the same I would if display was ok: ctrl+alt+F2, username, password, startx. but I can't see anything on the screen.Last edited by Pums on Sat Jul 18, 2020 3:16 pm; edited 1 time in total

----------

## NeddySeagoon

Pums,

You can keep an eye on temperatures with lm-sensors.

Thermal problems can lead to system lockups.

About the only thing to do as you don't want to open the box, is reduce the thermal load.

You can do that by reducing 

```
MAKEOPTS="-j5"
```

to say -j2 or -j3.

As you have all the possible drivers for your Radeon card installed, lets try a different one.

```
[   379.205] (==) Matched radeon as autoconfigured driver 0

[   379.205] (==) Matched ati as autoconfigured driver 1

[   379.205] (==) Matched modesetting as autoconfigured driver 2

[   379.205] (==) Matched fbdev as autoconfigured driver 3

[   379.205] (==) Matched vesa as autoconfigured driver 4
```

Modesetting is nice and simple.

Make a file called /etc/X11/xorg.conf with the content

```
Section "Device"

    Identifier  "OnBoard Radeon"

    Driver      "modesetting"

#    BusID  "pci:bus:dev:func"

EndSection
```

Its possible you mad need to fill in the BusID entry.

With that file in place, Xog will use the modesetting driver or fail.

Run startx (no reboot required) and pastebin the log. I would be happy for you to get a picture with any driver right now.

----------

## Pums

I was wrong about dbus, it's been installed for a while:

```
# genlop -i dbus

 * sys-apps/dbus

   Total builds: 1

   Global build time: 58 seconds.

   Info about currently installed ebuild:

   * sys-apps/dbus-1.12.18

   Install date: Thu Jul  9 18:12:33 2020

   USE="elogind kernel_linux X -debug -doc -selinux -static-libs -systemd -test -user-session"
```

But its service was not enabled on default runlevel.

I've done it and rebooted (added dbus to global use flags but it affects no other package). I still get a black screen in the same conditions.

After starting "blindly" an empty X session : http://dpaste.com/23V61YW

Seems that X actually starts and works:

```
$ ps -A |grep tty3

 3288 tty3     00:00:00 login

 3383 tty3     00:00:00 bash

 3385 tty3     00:00:00 startx

 3402 tty3     00:00:00 xinit

 3403 tty3     00:00:00 X

 3407 tty3     00:00:00 xterm

 3432 tty3     00:00:00 dbus-launch

 3434 tty3     00:00:00 twm <defunct>

 3435 tty3     00:00:00 xclock

 3436 tty3     00:00:00 xterm

 3437 tty3     00:00:00 xterm

```

But screen remains desperately black.Last edited by Pums on Sat Jul 18, 2020 4:28 pm; edited 1 time in total

----------

## NeddySeagoon

Pums,

The dbus errors are gone and the Radeon driver is still in use.

The resolution is set to

```
[   710.790] (II) RADEON(0): Output eDP using initial mode 1920x1080 +0+0
```

Only the startup messages are in the log too. That means Xorg found something to do or locked up, so that it could no longer write the log.

but as you say, it looks like its working.

```
 3434 tty3     00:00:00 twm <defunct> 
```

twm died and the parent process has not yet collected the return code.

----------

## Pums

 *NeddySeagoon wrote:*   

> 
> 
> You can do that by reducing 
> 
> ```
> ...

 

It's now on -j2 (I should have done it a while ago).

 *NeddySeagoon wrote:*   

> 
> 
> Make a file called /etc/X11/xorg.conf with the content
> 
> [code]Section "Device"
> ...

 

I really thank you for your consideration, this mac has been challenging me for monthes.

I've added the file and rebooted in order to try having a clearer Xorg.0.log. Black screen as always.

Xorg.0.log right after boot: http://dpaste.com/0C2VEZV

Xorg.0.log after starting "blindly" empty X session: http://dpaste.com/0VPKV6K

Just in case, Xorg.0.log after reboot with nomodeset kernel parameter and failed "startx": http://dpaste.com/3FWM273

----------

## NeddySeagoon

Pums,

The radeon and Xorg modesetting driver both use kernel modesetting mechanism.

In fact, the Xorg modesetting driver uses the console resolution, that your framebuffer console left behind.

Te try a non-modesettnig driver,  change the line     

```
Driver      "modesetting" 
```

to

```
 Driver      "vesa" 
```

----------

## Anon-E-moose

For the black screen, what does X -retro do (execute from cmd line, not in X already) Ctrl-Alt-Backspace to exit X.

----------

## Pums

NeddySeagoon,

If I uncomment the Dbus line in xorg.conf with modesetting driver, X starts and stops immediately, no remaining defunct twm process. Xorg.0.log : http://dpaste.com/1TEFYTJ.

Same thing with Dbus line uncommented and replacing with vesa driver. Log: http://dpaste.com/0Y0E6F0

Apparently same thing with Dbus line commented out and with driver vesa, log : http://dpaste.com/1AR6KCX

Rebooting doesn't change anything, screen remains black in all cases (Dbus line commented out nor not, driver vesa or modesetting).

Anon-E-moose: I think you've misread. Black screen doesn't result from starting X. Black screen arises on boot, X is not started yet since I have no display manager, and I need to start X manually from tty with nothing at all visible on the screen, no prompt.Last edited by Pums on Sat Jul 18, 2020 6:37 pm; edited 2 times in total

----------

## Anon-E-moose

 *Pums wrote:*   

> Anon-E-moose: I think you've misread. Black screen doesn't result from starting X. Black screen arises on boot, X is not started yet since I have no display manager, and I need to start X manually from tty with nothing at all visible on the screen, no prompt.

 

Ah, sorry 'bout that   :Embarassed: 

Edit to add: you don't see boot messages, or a console screen?

How are you starting the system, bios or uefi boot?

----------

## GDH-gentoo

 *Pums wrote:*   

> With opensuse, I can open a proper X session with desktop environment, still with nomodeset or radeon.modeset=0 parameter. It's perfectly suitable despite some display jaggedness. Tumbleweed even handles enjoyable transparency effects on Plasma desktop.

 

Posting the Xorg.*.log file from openSUSE, to see what it does and compare, might also help.

----------

## Pums

 *Anon-E-moose wrote:*   

> 
> 
> Edit to add: you don't see boot messages, or a console screen?
> 
> How are you starting the system, bios or uefi boot?

 

It's uefi.

I can see first boot messages, openrc starts, launches some services regularly (EDIT: until "checking local filesystems") and then the screen turns black.

 *GDH-gentoo wrote:*   

> 
> 
> Posting the Xorg.*.log file from openSUSE, to see what it does and compare, might also help.

 

I'll do that when the world update finishes.Last edited by Pums on Sat Jul 18, 2020 9:53 pm; edited 1 time in total

----------

## Pums

Tumbleweed's Xorg.0.log

No xorg.conf file; xorg.conf.d only contains a file for the keyboard.

----------

## NeddySeagoon

Pums,

Its not using KMS. Its using framebuffer

```
[    35.927] (II) FBDEV(0): Creating default Display subsection in Screen section

    "Default Screen Section" for depth/fbbpp 24/32

[    35.927] (==) FBDEV(0): Depth 24, (==) framebuffer bpp 32

[    35.927] (==) FBDEV(0): RGB weight 888

[    35.927] (==) FBDEV(0): Default visual is TrueColor

[    35.927] (==) FBDEV(0): Using gamma correction (1.0, 1.0, 1.0)

[    35.927] (II) FBDEV(0): hardware: EFI VGA (video memory: 8128kB)

[    35.927] (DB) xf86MergeOutputClassOptions unsupported bus type 0

[    35.927] (II) FBDEV(0): checking modes against framebuffer device...

[    35.927] (II) FBDEV(0): checking modes against monitor...

[    35.927] (II) FBDEV(0): Virtual size is 1920x1080 (pitch 1920)
```

```
[    35.853] (II) [KMS] drm report modesetting isn't supported.

[    35.853] (EE) open /dev/dri/card0: No such file or directory
```

Thats the nomodeset on the kernel command line.

Is this an Intel Mac or a PPC mac?

The framebuffer driver just uses the RAM on the graphics card. The GPU does noting and the CPU plots every pixel.

That makes it very slow.

It would be useful to compare Gentoos dmesg with OpenSUSE too. 

The first step is to get a working console.

Please post your 

```
lspci -nnk
```

and the content of /usr/src/linux/.config

I thought your console was working too, an dmesg looks good.

----------

## Pums

It's an Intel Mac.

 *NeddySeagoon wrote:*   

> 
> 
> The framebuffer driver just uses the RAM on the graphics card. The GPU does noting and the CPU plots every pixel.
> 
> That makes it very slow.

 

I'm not surprised, at first it was very slow indeed with its original 4 G ram, I've upgraded to 16 G and it has become much more fluid though one notices it's not what it should be, eg comparing with macOS.

Gentoo's zcat /proc/config.gz

openSuse Tumbleweed's zcat /proc/config.gz

Gentoo's # lspci -nnk

openSuse Tumbleweed's # lspci -nnk

Gentoo's dmesg

openSuse Tumbleweed's dmesg

----------

## Pums

 *NeddySeagoon wrote:*   

> 
> 
> I thought your console was working too, an dmesg looks good.

 

It does only if modesetting is disabled at boot. If not, screen is empty and I need to use ssh or typing things I can't see on the screen (that's how I could startx from a tty, although I didn't see anything, controling processes with ssh I saw it was started and twm appeared as defunct).

----------

## NeddySeagoon

Pums,

Please tell us how you configured your kernel.

You have a lot _DEBUG_ options on in your kernel. This is normally a bad thing as _DEBUG_ will generate log spam and in some cases, will prevent normal operation.

I am in two minds ... to start the kernel configuration from the beginning or build on what you have now.

Did you ever change the kernel .config file with a text editor?

----------

## Pums

NeddySeagoon,

About my current config, I've reviewed my shell history to be sure. Unless I've made a mistake I retieved the config from  gentoo-kernel 5.4.40 (it was the kernel that I was running at that moment, and the first one with which I could have a proper boot), and applied it (via an oldconfig) to gentoo-sources (5.4.48 ), using menuconfig to add the firmware blobs. I think I've changed nothing else (unless maybe take off some useless device drivers).

I usually don't add debugging options to my kernel. The ones you're pointing out in my config must be default options from gentoo-kernel.

I did not change .config with an editor, I never do that, I always use menuconfig tool.

I can make a new kernel if you think it's better (now it seems overheating problems no longer happen after reducing MAKEOPTS to 2). I could use genkernel default config, just add the firmwares as I already did and remove some device drivers I'm sure I won't need. If you have better ideas or more precise instructions, I'm receptive to it.

----------

## NeddySeagoon

Pums,

That's all the right answers.

The kernel needs the firmware to be accessible at the time the module that will use the firmware is initialised.

For modules configured as <*>, that's built into the kernel binary, the firmware must be included in the kernel as everything in the kernel is initialised before root is mounted.

For modules configured as <M>, the module itself will be loaded after root is mounted, so firmware in /lib/firmware works.

For completeness, firmware built into the kernel is discarded when the kernel completes its initialisation before mounting root.

Long story short, you have CONFIG_DRM_RADEON=m in your kernel so do not need the firmware included in the kernel.

Lets try a 

```
genkernel -menuconfig all
```

kernel.

When it drops you into menuconfig, follow the kernel part of the Radeon Wiki Page.

The General section applies to you. Follow the Audio section if you want to use nte Video card HDMI audio output.

Where you have a choice between <M> and <*>, use <M>, as its easier to make work. 

Ignore AMD "Zen" CPUs and AGP cards. That does not apply to your system.

We don't care about Xorg yet. A working console is the first step.

If genkernel won't make a working console, post the dmesg you get with the new kernel.

----------

## Pums

NeddySeagoon,

Unless I'm mistaken, I would rather run

```

genkernel --kernel-config=default --menuconfig all

```

Since, as the genkernel wiki's page says: "By default, genkernel uses the config from the previous build of the same kernel version or a default kernel config if there isn't a previous config."

That would be in my case retrieving the config with debugging options about which you were skeptical.

"Use the special value default to force usage of genkernel's generic kernel config." would be better, wouldn't it?

I've checked /lib/firmware/radeon  already contains all the required firmwares.Last edited by Pums on Mon Jul 20, 2020 12:30 am; edited 2 times in total

----------

## NeddySeagoon

Pums,

That's correct. genkernel has changed over the years. It always used to use the default unless it was told not to.

Doing what you suggest will have the result I intended.

----------

## Pums

I could not find most of matching options from the wiki page. Searching with "radeon" in menuconfig returns me that:

```
 

  │          /radeon

  

  │   

  │ Symbol: FB_RADEON [=n]                                                                           │   

  │ Type  : tristate                                                                                 │   

  │ Prompt: ATI Radeon display support                                                               │   

  │   Location:                                                                                      │   

  │     -> Device Drivers                                                                            │   

  │       -> Graphics support                                                                        │   

  │         -> Frame buffer Devices                                                                  │   

  │ (3)       -> Support for frame buffer devices (FB [=y])                                          │   

  │   Defined at drivers/video/fbdev/Kconfig:1201                                                    │   

  │   Depends on: HAS_IOMEM [=y] && FB [=y] && PCI [=y]                                              │   

  │   Selects: FB_BACKLIGHT [=n] && FB_MODE_HELPERS [=n] && FB_CFB_FILLRECT [=y] && FB_CFB_COPYAREA  │   

  │                                                                                                  │   

  │                                                                                                  │   

  │ Symbol: FB_RADEON_BACKLIGHT [=n]                                                                 │   

  │ Type  : bool                                                                                     │   

  │ Prompt: Support for backlight control                                                            │   

  │   Location:                                                                                      │   

  │     -> Device Drivers                                                                            │   

  │       -> Graphics support                                                                        │   

  │         -> Frame buffer Devices                                                                  │   

  │           -> Support for frame buffer devices (FB [=y])                                          │   

  │ (4)         -> ATI Radeon display support (FB_RADEON [=n])                                       │   

  │   Defined at drivers/video/fbdev/Kconfig:1226 
```

Which seems ok to me.

Eventually I've not changed much, it'll be almost a default genkernel. Usually I like to prune my kernels as much as possible, it will wait.

Genkernel's compiling now, I let you know as soon as I can with relevant infos.

----------

## NeddySeagoon

Pums,

Gentoo works best when you make it work at all as the first step.

Then make it /lean/mean/shiny or whatever you want later.

Do you have another Gentoo system?

Its quite possible to build for you old Mac on another system.

The kernel is a good package to practice on too.

----------

## Pums

NeddySeagoon,

Genkernel process failed twice. First time it failed at time of making modules, but strangely I could not see any error in the log file. I should have kept that log and show it here, I didn't... Second time the mac hung, just like it used to do before, and disconcertingly  It did not heat that much (though I could not .

i wonder if there's a particular problem with genkernel, it never worrked on this mac, already hung twice at the beginning. I made the kernel with the firmwares the old way, with make oldconfig menuconfig && make modules_install &&make install. I used genkernel only to make the initramfs.

However I do have Gentoo working on other computers. One is much faster than the other, I'm planning to use is to make binaries for the others, I've already managed some nice things but I'm new on Gentoo and not all is easy.

You're right, the kernel is good to practice that, no dependency... I'll try to do it now.

----------

## NeddySeagoon

Pums,

Its worth keeping a separate kernel tree on the fast system for building for the Mac.

You don't want to get the two kernels mixed up and you certainly don't want to install the modules on the wrong system.

The simple way in to copy the kernel tree to your normal user and use that kernel tree just for the Mac.

Once its compiled, copy it to the Mac to run the install steps.

----------

## Pums

NeddySeagoon,

It was my idea at first. Nevertheless it's not easy since genkernel is not thought primarly to be used as a single user. 

It's been a day struggling and failing with genkernel, sorting out with its numerous options. I did not manage to do it. The following is a (boring) novel, no need to read it... I must be missing a lot of things, it seems all very complicated for nothing at the end...

So... I created the required directories, copied the sources and changed permissions on them. I arrived to such a command:

```

genkernel --bootdir=/tmp/macKernel/ --no-symlink --xconfig --kernel-config=default --install --logfile=~/Desktop/kernel/mac-5.4.48/genkernel.log --kernel-append-localversion=-v3genkernelMac --save-config --tmpdir=~/Desktop/kernel/mac-5.4.48/tmp/ --kerneldir=~/Desktop/kernel/mac-5.4.48/sources/linux-5.4.48-gentoo/ --module-prefix=~/Desktop/kernel/mac-5.4.48/modules  all

```

Genkernel still failed after making modules for a while. Log file says :

```
depmod: ERROR: could not open directory ~/Desktop/kernel/mac-5.4.48/modules/lib/modules/5.4.48-gentoo-x86_64-v3genkernelMac: No such file or directory

depmod: FATAL: could not search modules: No such file or directory

make: *** [Makefile:1341: _modinst_post] Error 1

* ERROR: compile_modules(): compile_generic() failed to compile the "modules_install" target!
```

But that directory does exist...

```
$ ls ~/Desktop/kernel/mac-5.4.48/modules/lib/modules/5.4.48-gentoo-x86_64-v3genkernelMac

build  kernel  modules.builtin  modules.builtin.modinfo  modules.order  source
```

And it seems it contains modules... I should have given it up at that step, bad idea to continue on an error, but I tried anyway.

I transfered the files (kernel, systemmap and modules) to the mac, ran grubconfig. New kernel ends up with kernel panic. I thought it was because initramfs was missing, tried to make some cleaning in my /boot and /lib/modules, since it's a mess, with a lot of rests of failed kernel... Genkernel refused to make initramfs because kernel's local version was set to an old dysfunctional kernel. I tried to replace .config in /usr/src with the proper one (I thought kernelversion was taken from .config), it did not work. I unmerged gentoo-sources, removes old sources, reemerged gentoo-sources, and now: "Current kernel's LOCALVERSION is set to ''; Will ignore set --kernel-localversion value '-x86_64' because kernel was not build ..." and "ERROR: '/lib/modules/5.4.48-gentoo' does not exist! Did you forget to compile kernel before building initramfs? If you know what you are doing please set '--no-ramdisk-modules'." 

Dracut refused for similar reasons :

```
# dracut

dracut: Executing: /usr/bin/dracut 

dracut: Will not override existing initramfs (/boot/initramfs-5.4.48-gentoo-v2-firmwareBlob.img) without --force

```

"dracut --force" only rebuilt the initramfs for my current kernel, and not for the new one.

I tried to deceive genkernel, replacing /etc/kernels/kernel-config-5.4.48-gentoo-x86_64 with the config file of my new kernel, and renaming Systemmap, kernel and /lib/modules folder for it to match with its expectations, and it accepted to make "/boot/initramfs-5.4.48-gentoo.img" for the new kernel. I ran again grub-mkconfig, rebooted, and it still ends up on kernel panic...

I wish I could find a better way... On IRC I've been suggested to enter a chroot to make kernels as root easier.

----------

## NeddySeagoon

Pums,

That's the hard way. I'm sure it can be made to work.

Now the easier way, you will end up doing this to build for the Mac on the fast machine anyway.

On the fast machine, make a chroot directory.

Fetch a stage3 tarball that will suit the Mac and untar it there. In effect, do an install to suit the Mac.

After the stage3 is in place, copy over the Macs /etc/portage, so you have all the Macs settings.

Copy over the Macs /var/lib/portage/world which is the list of packages that have been explicitly installed on the Mac.

You must not use -march=native in this chroot. You want to build for the Mac, not the fast system.

On the Mac, run 

```
gcc -### -E - -march=native 2>&1 | sed -r '/cc1/!d;s/(")|(^.* - )|( -mno-[^\ ]+)//g'
```

It tells what march=native really means to gcc.

Put whatever it spits out into the chroots make.conf in place of -mach=native.

Leave -pipe -O2 or whatever else you have.

The Macs own CPU_FLAGS_X86= should be in its make.conf already.

If not,  cpuid2cpuflags run on the Mac will tell you what to set.

You want to build binary packages of everything built in the chroot, so you can install them on the Mac.

There is a FEATURE for that, set it in the chroots make.conf. You get to read 

```
man make.conf
```

Set the MAKEOPTS to suit the build box.

Build in RAM if you have the RAM.

You can borrow the main installs ::gentoo repo and distfiles. There is no point in having two copies.

Do make sure that the Mac,  PKGDIR inside the chroot does not point into any of the "borrowed" locations, so set it explictily. Maybe PKGDIR="/macpackagedir" ?

Once you are happy with the setup, do a short test.

Do the chroot steps, as you would for a new install.

Run 

```
emerge -1av glibc 
```

PKGDIR should contain two files.

Packages, which is the index. It will list a single package and tell how it was built. Does it look correct for the Mac? 

The package file will be there too.

Once you are happy with the first package, do the rest.

```
emerge -e @world --keep-going --jobs=2
```

That will build everything in the world file and all the dependencies. Once it completes, you will have a chroot that mirrors the Mac and all the binary packages that match too.

There is one glaring simplifying assumption in the above. That the fast system can execute all the instructions of the older system.

Its often correct but not always.

If you get Illegal Instruction errors on the build box, its come across an instruction that the Mac has but it does not.

There are ways around this too.

The chroot will behave in most respects like the Mac. As its not a partition, you can't easily boot into it.

You probably can't run Xorg. Well you can ...

Lastly you can run genkernel here as you would on the Mac.

Installing the binaries on the Mac is for another post.

----------

## Pums

NeddySeagoon,

Thank you so much for those detailed explanations. That's something I've heard about and I was planning to do but it was not clear at all yet for me. I have gentoo on 5 cumputers among which 4 are old ones, and it's a pain to compîle on them.

I followed your instructions, I've got glibc binary at the right place, Packages file seems ok too!

Currently the world is building right. 

About binaries, I know I'll have to read carefully the guide on binary packages from the wiki.

On an old netbook, I did trials and managed to install an isolated binary of Firefox from my powerful computer, but it's something too hard to handle on a large scale  and in an elegant way (all the dependencies need to be previously installed on the slow computer). Chrooting is definitively a better way!

I'll let know of my advancements and further problems, I think I may have.

----------

## NeddySeagoon

Pums,

There are lots of ways of keeping the build box and clients in sync and sharing and installing the binaries once you have them.

You can share the repo(s) and binaries over NFS. 

Set up some form of server.

Sync using rsync ... which is what portage uses to update the local copy of the repo.

As you say, its all in the guide that you linked.

----------

## Pums

EDIT: Actually, it's easy to  summarize it all, no real need to read more: radeon's module is the culprit. If I blacklist it at boot (modprobe.blacklist=radeon), I can have a console, log in, run commands... But X doesn't work. With radeon, black screen, no visible console, no visible prompt, I can startx but can't see anything and twm is "defunct". Shouldn't I try to build it (EDIT: ie. radeon) in along with the firmwares?

The following is useless umho...

-----

I did several trials (I did not use nomodeset boot kernel parameter) . I think 2) is the really interesting one, so maybe read it first:

1) A minimalistic kernel (-v3), based on one that I have working fine on the powerful computer, I've only tried to make changes for it to handle the mac's hardware config (specially radeon graphic driver and network devices).

On boot, screen is completely black (no "loading iniramfs", no prompt, nothing; with previous kernels, screen used to turn black after displaying openrc's "Checking local filesystems"). Like with previous kernels, though I can't see anything at all on the screen, I can log in on a tty and startx. sshd works and I could check that X seemed to start, with a defunct twm process, as it happened already.

* zcat /proc/config.gz

* dmesg (the first line shows "(root@sed2)", sed2 is the powerful computer that made the kernels; Mac's hostname is "mac". I did not change conf.d/hostname nor /etc/host in the chroot tree, it still has the default "localhost". I don't know whether it can be a problem and I'd rather change that.)

* lspci -nnk

* lsmod

* Xorg.0.org

2) I used a genkernel's default config kernel (-v5), but I forgot to copy the corresponding modules in /lib/modules. For the first time ever, I could boot Linux without nomodeset parameter and display was right, regular console prompt, I could log in, run commands. But, logically, no network, plenty of errors and startx fails immediately.

* zcat /proc/config.gz (but modules were not used !)

* dmesg

* lsmod

* lspci -nnk

* Xorg.0.org

3) If I use the same kernel and add the forgotten modules for this kernel in /lib/modules, it seems like it used to be with older kernels: screen turns black after displaying some openrc messages, no prompt, nothing. startx results just like with the minimalistic kernel: twm defunct, screen empty since boot time.

Config is the same as -v5, but modules were usable.

*dmesg

*lsmod

*lspci -nnk

*Xorg.0.log

I've used this xorg.conf:

```
Section "Device"

    Identifier  "OnBoard Radeon"

    Driver      "modesetting"

#    BusID  "pci:bus:dev:func"

EndSection

```

With default genkernel without modules I've tried to change "modesetting" for "vesa" and comment/uncomment BusId line, but it did not seem to change anything.Last edited by Pums on Tue Jul 21, 2020 10:09 pm; edited 2 times in total

----------

## Pums

I've made a new kernel (v6) with minimalistic configuration, with built-in radeon driver and firmware:

```

$ zcat /proc/config.gz |grep -i radeon

CONFIG_LOCALVERSION="-x86_64-v6radeonBuiltIn"

CONFIG_EXTRA_FIRMWARE="radeon/R700_rlc.bin radeon/RV730_smc.bin radeon/RV710_uvd.bin radeon/RV730_me.bin radeon/RV730_pfp.bin"

CONFIG_DRM_RADEON=y

CONFIG_DRM_RADEON_USERPTR=y

# CONFIG_FB_RADEON is not set

```

> Complete config

At boot, I can hardly see the few first messages (not even "openrc"), the screen becomes black quickly, and as usual, no visible prompt, no visible console. Though I can't see anything, I can log in in a tty and startx, twm <defunct> once again.

* dmesg

* lsmod

* Xorg.0.log

If my understanding is correct, built-in radeon is loaded sooner, and so the screen turns black sooner...

----------

## theotherjoe

Pums,

from dmesg in 2) one can see that there is no display problem as long as the system

only plays with the efifb VGA console. 

Now, I have been through the dmesg ouput in your last post and from what I see there

is no indication of problems with the radeondrmfb. 

I have a hunch but since I dont have much experience with apple hardware I might

be on a wrong track.

My suspicion is that there is nothing wrong with the radeon driver. The backlight driver

simply turns off the backlight, hence you cant see anything on the screen once 

radeon driver has taken over.

I wonder what would happen if you would compile the apple backlight driver into the kernel

(just like the radeon driver) instead of having it as a module?

```
Graphics support  --->  Backlight & LCD device support  --->  [*]   Apple Backlight Driver
```

----------

## Pums

theotherjoe,

Although I don't understand much (see personal note below), I've made a new kernel (-v7) retrieving the previous config (-v6) only with the change you've suggested (CONFIG_BACKLIGHT_APPLE=y).

I could not see any difference with -v6 kernel : some messages displayed very quickly, and screen turns black even before openrc shows anything, no visible prompt, no visible console; from that moment screen remains empty,  if I startx "blindly" from a tty, "ps -A" shows a "defunct" twm process.

```
$ zcat /proc/config.gz |grep -i 'radeon\|backlight_apple'

CONFIG_LOCALVERSION="-x86_64-v7radeon+backlightBuiltIn"

CONFIG_EXTRA_FIRMWARE="radeon/R700_rlc.bin radeon/RV730_smc.bin radeon/RV710_uvd.bin radeon/RV730_me.bin radeon/RV730_pfp.bin"

CONFIG_DRM_RADEON=y

CONFIG_DRM_RADEON_USERPTR=y

# CONFIG_FB_RADEON is not set

CONFIG_BACKLIGHT_APPLE=y

```

* Config

* dmesg

* Xorg.0.log

Personal note: I have a technical and hardware knowledge very limited, and my English is quite poor, which doesn't help. While configuring kernels I've been wondering what could be the purpose of all the "backlight" options and I figured out it  had to be the control of extra lighting like one can find for example on some keyboards, and had nothing to do with the display on the screen's computer; so I thought I had no hardware using backlight. I was wrong and your suggestion that the problem would be a backlight one rather than a driver's one is interesting and may be a/the track to follow.

Edit: All that makes me think a lot and realize that, for example, if I try to compare the black screen I'm getting on boot time with the black screen I can get when, using "nomodeset" so to have a console working, the computer eventually hangs or when the screensaver is activated, there's a difference: in the first case I have no... backlight. It seems like the screen is completely switched off, whereas when the mac hangs one still can see a sort of "glow".Last edited by Pums on Wed Jul 22, 2020 4:32 pm; edited 1 time in total

----------

## Child_of_Sun_24

Do you have CONFIG_DRM_FBDEV_EMULATION enabled in your kernel config ?

It's under Device Drivers -> Graphics support -> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) -> Enable legacy fbdev support for your modesetting driver

Maybe it helps.

----------

## Pums

 *Child_of_Sun_24 wrote:*   

> Do you have CONFIG_DRM_FBDEV_EMULATION enabled in your kernel config ?

 

I do:

```
$ zcat /proc/config.gz |grep FBDEV

CONFIG_DRM_FBDEV_EMULATION=y

CONFIG_DRM_FBDEV_OVERALLOC=100

CONFIG_XEN_FBDEV_FRONTEND=y

```

----------

## theotherjoe

well, Pums,

as I said, I might be wrong there  :Sad: 

Mrs Google also didnt come up with a solution but it seems to be

a known problem. Found a thread from ubuntuforums about iMac with radeon.

describing the same problem with the console and without any solution.

Best bet would probably be to disable framebuffer console altogether and

go with plain VGA console:

Graphics support --> Console display driver support -->

Framebuffer Console support

That leaves the problem around Xorg. You probably will have to play 

with the two options for the radeon driver, compiled into kernel or as module

edit: tried without framebuffer console on my system. but that clashes with

kernel mode setting  :Sad:   that reduces your options even furher.

edit2: found this article about Macs EFI and Linux, maybe 

you can get some clues from it

http://refit.sourceforge.net/myths/

----------

## Pums

Thank you very much,

I need to understand better how Linux handles graphic hardware . I have tracks to explore and I will run tests in the next few days. I'll tell you more if needed.

Eventually, we may find or not a solution, but anyway I'll have learnt a lot thanks to the help I've received!

----------

## NeddySeagoon

Pums,

When you prevent the radeon kernel module loading, you get a console with some other console driver.

The xorg radeon driver depends on the kernel radeon modesetting driver.

You can have Xorg but only with the vesa or fb xorg drivers.

Radeon and the modesetting driver both depend on kernel modesetting, which as you rightly conclude, is the source of your problem. 

 *http://refit.sourceforge.net/myths/ wrote:*   

> 
> 
> Fact: You need BIOS compatibility for 2D/3D accelleration
> 
> If you want good graphics support in Linux, you must boot it using BIOS compatibility mode. This also means using LILO or GRUB, and having a MBR partition table (either hybrid GPT/MBR or plain MBR). 

 

Can you select BIOS or legacy mode for booting?

With care, and a little luck, its possible to change the partition table type under the install.

It appears your video card makes BIOS calls during startup. In EFI mode, there is no BIOS to support them.

----------

## Pums

Well, I had missed that... And it seems the key problem.

I've been looking around about it. I think I have to make a hybrid MBR/GPT partition table on my hard drive. By default it's pure UEFI, I don't think I can boot in legacy mode on this computer, there's no system setup menu like with traditional UEFI or old BIOS style. Actually, it seems the way Apple handles UEFI is strange. According to what I could see, macOS doesn't really use the EFI partition, it boots "directly". For example, even I lose access to macOS on boot after installing grub/grub2 (it doesn't recognize macOS), I can still boot on it by typing "alt" on boot (and then I can choose between launching macOS, macOS recovery mode, or booting on an external media in case there is a bootable one). The EFI partition is here but seems inactive until you install an external bootmanager on it.

See : https://support.apple.com/en-qa/HT201255

I need to back up my datas and then try to do that.

Thanks again!

----------

## NeddySeagoon

Pums,

Without some BIOS code the graphics card will not initialise.

When the BIOS (not EFI) starts, at the end  of its startup, before it loads the MBR, it calls the initialisation routines on all the peripherals that it detected.

The peripherals can assume the presence of BIOS and call subroutines provided by the BIOS ROM.

It gets worse ... I think that the BIOS is 16 bit real mode code, so you need the CPU in real mode.

The EFI Firmware is 32 bit protected mode and that won't run 16 bit real mode.

The kernel can execute 16 bit real mode code. That's required for some emulators, but it has no supporting BIOS code.

You need some actual BIOS code and a way to run it, like BIOS booting.

It has to run before the kernel sets up its DRM so that the hardware is in the state the kernel expects.

Changing the partition table on it own won't help.

What's required is reverse engineering the graphics card setup routines and working out what they do, then writing new code to achieve the same thing that runs as a part of the kernel before DRM is started. That's hard. Its been done once but not maintained.

MacOS must do it ... but its not open source.

-- Edit --

Very long hacky work around ... maybe.

Do a very minimal install on the Mac hardware to set it up as a Virtual Machine host. That's all it will do.

No Xorg, No user apps ...

Pass the video card through to the the guest. This means that the bare metal host will have no video at all. It will be serial console if there is a serial port, or ssh or even VNC.

The video pass though can be a boot time option. You would need two kernels.

Set up a guest that does BIOS booting. As it uses BIOS, it will correctly initalise the Graphics card.

This is your user install.

----------

## Pums

NeddySeagoon,

About the first part of your last post, reverse engineering... writing new code... All that is  light years away from my current capacities. I'm just a very very basic Gnu/Linux end-user that has been trying out Gentoo for over three months. I love it, I've learnt a lot (I didn't even know what a chroot is... and actually I believe it's still not clear for me how it really works...), I like keeping on learning, I'm not afraid of spending time on that but there are many things I can't realisticly do. My code skills do not go much beyond "hello world".

About the second part, well, it's a bit the same... My experience in virtualization has been limited to toying around with Vmware or  Virtualbox (nothing to do...), and installing once a host-0 Xen kernel on Debian (I guess it's rather the kind of thing you're talking about ?), and boot on it just to see, though I actually never used it.

In brief, to do that I would need to be almost guided step by step, and I can't guarantee I won't do things wrong. If you're ready to try it, well I could never thank you enaugh for that, but of course, feel free to do it or not. If I can use ssh I think it's ok not to have video at all  (no serial port on the mac), that's more or less what I've been doing lately...

So, tell me if I'm wrong, the first step with what you suggest would be reinstalling gentoo from scratch using a single stable profile? And... set it as a Virtual Machine host, across Xen eg?Last edited by Pums on Sat Jul 25, 2020 8:41 pm; edited 1 time in total

----------

## Anon-E-moose

I haven't followed every post, but does the mac have a display port connection and have you tried it to see if it shows a difference?

----------

## Pums

 *Anon-E-moose wrote:*   

> does the mac have a display port connection and have you tried it to see if it shows a difference?

 

It has a "Mini DisplayPort output with support for DVI, VGA, and dual-link DVI" (see model on support.apple.com), but I never used it (I have no correct cable). I may be wrong but I don't think it could work since the problem is the GPU cannot be handled by the kernel in "normal" conditions.

----------

## Pums

NeddySeagoon,

I've been looking around about virtualization, reading and rereading your last post and I think I figure out the solution you consider.

As you suggest, I'm going to make a new basic install for a Xen domain-0 following Gentoo's Xen wiki's page, to begin. I'll tell more if needed.

----------

## NeddySeagoon

Pums,

I would use a KVM because that's what I'm used to for bare metal installs on systems that will only host Virtual Machines.

I use Virtual Box too, for quick setups, where I only need the guest for a short time.

I have never used Xen.  Well, once, a long time ago, I rented a Xen virtual machine but that was it.

----------

## Pums

Ok, so it'll be the first time I use qemu.

I made a new minimalistic install from scratch, tried to follow only the handbook and the kernel instructions for qemu, though I have doubts since it seems several config options of the  wiki's qemu installation page do not match with the current stable kernel version.

I included in the new kernel the hardware modules matching with the mac, radeon driver included  (I had doubt about the "pass the video card through to the the guest" point). Logically screen turns black at boot time... ssh is ok. No video (as you said) meant no radeon driver I guess (now). Should I make a new kernel without radeon driver? It's easy to do it with the fast computer.

I included KVM for Intel processors support as a module:

```
# zcat /proc/config.gz |grep -i kvm

CONFIG_LOCALVERSION="-x86_64-v1kvm0"

CONFIG_KVM_GUEST=y

# CONFIG_KVM_DEBUG_FS is not set

CONFIG_HAVE_KVM=y

CONFIG_HAVE_KVM_IRQCHIP=y

CONFIG_HAVE_KVM_IRQFD=y

CONFIG_HAVE_KVM_IRQ_ROUTING=y

CONFIG_HAVE_KVM_EVENTFD=y

CONFIG_KVM_MMIO=y

CONFIG_KVM_ASYNC_PF=y

CONFIG_HAVE_KVM_MSI=y

CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y

CONFIG_KVM_VFIO=y

CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y

CONFIG_KVM_COMPAT=y

CONFIG_HAVE_KVM_IRQ_BYPASS=y

CONFIG_HAVE_KVM_NO_POLL=y

CONFIG_KVM=m

CONFIG_KVM_INTEL=m

# CONFIG_KVM_AMD is not set

CONFIG_KVM_MMU_AUDIT=y

# CONFIG_PTP_1588_CLOCK_KVM is not set
```

I had doubt about setting on the "dangerous" CONFIG_DRM_LEGACY support (I left the defauilt option "not set").

Complete Kernel config is there.

I was not sure about the use flags for qemu, currently:

```
 eix -I qemu

[I] acct-group/qemu

     Available versions:  0{tbz2}

     Installed versions:  0{tbz2}(02:50:23 AM 07/27/2020)

     Description:         System group: qemu

[I] app-emulation/qemu

     Available versions:  5.0.0-r1^t{tbz2} ~5.0.0-r2^t **9999*l^t {accessibility +aio alsa bzip2 +caps capstone +curl debug doc +fdt +filecaps glusterfs gnutls gtk infiniband io-uring iscsi jemalloc +jpeg lzo multipath ncurses nfs nls numa opengl +oss +pin-upstream-blobs plugins +png pulseaudio python rbd sasl sdl sdl-image +seccomp selinux +slirp smartcard snappy spice ssh static static-user systemtap tci test usb usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen xfs +xkb zstd KERNEL="FreeBSD linux" PYTHON_TARGETS="python3_6 python3_7 python3_8" QEMU_SOFTMMU_TARGETS="aarch64 alpha arm avr cris hppa i386 lm32 m68k microblaze microblazeel mips mips64 mips64el mipsel moxie nios2 or1k ppc ppc64 riscv32 riscv64 rx s390x sh4 sh4eb sparc sparc64 tricore unicore32 x86_64 xtensa xtensaeb" QEMU_USER_TARGETS="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze microblazeel mips mips64 mips64el mipsel mipsn32 mipsn32el nios2 or1k ppc ppc64 ppc64abi32 ppc64le riscv32 riscv64 s390x sh4 sh4eb sparc sparc32plus sparc64 tilegx x86_64 xtensa xtensaeb"}

     Installed versions:  5.0.0-r1^t{tbz2}(03:04:52 AM 07/27/2020)(aio alsa bzip2 caps curl doc fdt filecaps jpeg ncurses nls oss pin-upstream-blobs png python seccomp ssh vde vhost-net vhost-user-fs vnc xattr xkb -accessibility -capstone -debug -glusterfs -gnutls -gtk -infiniband -io-uring -iscsi -jemalloc -lzo -multipath -nfs -numa -opengl -plugins -pulseaudio -rbd -sasl -sdl -sdl-image -selinux -smartcard -snappy -spice -static -static-user -systemtap -tci -test -usb -usbredir -virgl -virtfs -vte -xen -xfs -zstd KERNEL="linux -FreeBSD" PYTHON_TARGETS="python3_7 -python3_6 -python3_8" QEMU_SOFTMMU_TARGETS="x86_64 -aarch64 -alpha -arm -cris -hppa -i386 -lm32 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -moxie -nios2 -or1k -ppc -ppc64 -riscv32 -riscv64 -rx -s390x -sh4 -sh4eb -sparc -sparc64 -tricore -unicore32 -xtensa -xtensaeb" QEMU_USER_TARGETS="x86_64 -aarch64 -aarch64_be -alpha -arm -armeb -cris -hppa -i386 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -mipsn32 -mipsn32el -nios2 -or1k -ppc -ppc64 -ppc64abi32 -ppc64le -riscv32 -riscv64 -s390x -sh4 -sh4eb -sparc -sparc32plus -sparc64 -tilegx -xtensa -xtensaeb")

     Homepage:            http://www.qemu.org http://www.linux-kvm.org

     Description:         QEMU + Kernel-based Virtual Machine userland tools

```

For the moment, /var/lib/portage/world only includes this:

```
app-admin/sysklogd

app-arch/lz4

app-editors/vim

app-emulation/qemu

app-portage/eix

app-text/wgetpaste

app-vim/screen

dev-libs/lzo

net-fs/sshfs

net-misc/dhcpcd

net-misc/netifrc

net-wireless/iw

net-wireless/wpa_supplicant

sys-apps/mlocate

sys-apps/pcmciautils

sys-boot/grub

sys-boot/os-prober

sys-boot/refind

sys-fs/btrfs-progs

sys-fs/dosfstools

sys-fs/mtools

sys-kernel/genkernel

sys-kernel/gentoo-sources

sys-process/cronie

```

About the next step... Make a new kernel without radeon driver? Follow QEMU/Linux guest?

I have IPV6, I wonder if  QEMU/KVM IPv6 Support is needed for me.

(By the way, I made a new chroot environment on the fast computer and  I could use it to make binaries for the mac's world update, the kernel and the other few packages; it works perfectly, now I'll only need to find a nice way to sync or share binaries; I'm considering to share the binpkg folder over nfs, it but seems easy to set up and will save some space disk. Again, thanks a lot for that!)

----------

## NeddySeagoon

Pums,

You need the PCI_STUB option in the host kernel

```
  ┌─────────────────────────── PCI Stub driver ────────────────────────────┐

  │ CONFIG_PCI_STUB:                                                       │  

  │                                                                        │  

  │ Say Y or M here if you want be able to reserve a PCI device            │  

  │ when it is going to be assigned to a guest operating system.           │  

  │                                                                        │  

  │ When in doubt, say N.                                                  │  

  │                                                                        │  

  │ Symbol: PCI_STUB [=n]                                                  │  

  │ Type  : tristate                                                       │  

  │ Defined at drivers/pci/Kconfig:89                                      │  

  │   Prompt: PCI Stub driver                                              │  

  │   Depends on: PCI [=y]                                                 │  

  │   Location:                                                            │  

  │     -> Device Drivers                                                  │  

  │       -> PCI support (PCI [=y])                   
```

 as that supports PCI passthrough.

You won't have a video card at all in the host install so you can turn off all the video card support options to start with.

I suggest that you make two kernels for the host. One with a working console, that you can boot into for debugging the host and one to support the video card passthrough.

If you will use QEMU-KVM, you don't have it do everything blind. Read about app-emulation/libvirt. That will let you set up VMs remotely and show their console.

You will need that in case the passthrough does not work first time.

The Guest install must use BIOS booting. You need the BIOS to initialise the graphics card in the guest.

----------

## Pums

I've tried to search and read many things, it's quite hard and many stuff seems outdated.

I think my host kernel is ok. I've followed this GEntoo's wiki page about Qemu.

Edit: About libvirt to control a VM remotely (though I'm not sure it's so important now), did you think of virt-manager for example ? (it's the only available on Gentoo I could find) 

I also tried to follow this page about  GPU passthrough with libvirt qemu kvm on Gentoo's wiki and  this similar page (this last one is the only I could find that gave explicitly an option to boot on old BIOS mode):

```
$ dmesg | grep 'IOMMU enabled'

[    0.284735] DMAR: IOMMU enabled

```

Seems ok. But

```
$ for d in /sys/kernel/iommu_groups/*/devices/*; do n=${d#*/iommu_groups/*}; n=${n%%/*}; printf 'IOMMU Group %s ' "$n"; lspci -nns "${d##*/}"; done;

IOMMU Group * 00:00.0 Host bridge [0600]: Intel Corporation Core Processor DRAM Controller [8086:0040] (rev 18)

00:01.0 PCI bridge [0604]: Intel Corporation Core Processor PCI Express x16 Root Port [8086:0041] (rev 18)

00:1a.0 USB controller [0c03]: Intel Corporation 5 Series/3400 Series Chipset USB Universal Host Controller [8086:3b3b] (rev 06)

00:1a.7 USB controller [0c03]: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller [8086:3b3c] (rev 06)

00:1b.0 Audio device [0403]: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio [8086:3b56] (rev 06)

00:1c.0 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 [8086:3b42] (rev 06)

00:1c.1 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 [8086:3b44] (rev 06)

00:1c.2 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 3 [8086:3b46] (rev 06)

00:1d.0 USB controller [0c03]: Intel Corporation 5 Series/3400 Series Chipset USB Universal Host Controller [8086:3b36] (rev 06)

00:1d.7 USB controller [0c03]: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller [8086:3b34] (rev 06)

00:1e.0 PCI bridge [0604]: Intel Corporation 82801 PCI Bridge [8086:244e] (rev a6)

00:1f.0 ISA bridge [0601]: Intel Corporation P55 Chipset LPC Interface Controller [8086:3b02] (rev 06)

00:1f.2 SATA controller [0106]: Intel Corporation 5 Series/3400 Series Chipset 6 port SATA AHCI Controller [8086:3b22] (rev 06)

00:1f.3 SMBus [0c05]: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller [8086:3b30] (rev 06)

00:1f.6 Signal processing controller [1180]: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem [8086:3b32] (rev 06)

01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] RV730/M96-XT [Mobility Radeon HD 4670] [1002:9488]

01:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] RV710/730 HDMI Audio [Radeon HD 4000 series] [1002:aa38]

02:00.0 Ethernet controller [0200]: Broadcom Inc. and subsidiaries NetXtreme BCM5764M Gigabit Ethernet PCIe [14e4:1684] (rev 10)

03:00.0 Network controller [0280]: Qualcomm Atheros AR928X Wireless Network Adapter (PCI-Express) [168c:002a] (rev 01)

04:00.0 PCI bridge [0604]: Texas Instruments XIO2213A/B/XIO2221 PCI Express to PCI Bridge [Cheetah Express] [104c:823e] (rev 01)

05:00.0 FireWire (IEEE 1394) [0c00]: Texas Instruments XIO2213A/B/XIO2221 IEEE-1394b OHCI Controller [Cheetah Express] [104c:823f] (rev 01)

ff:00.0 Host bridge [0600]: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers [8086:2c61] (rev 05)

ff:00.1 Host bridge [0600]: Intel Corporation Core Processor QuickPath Architecture System Address Decoder [8086:2d01] (rev 05)

ff:02.0 Host bridge [0600]: Intel Corporation Core Processor QPI Link 0 [8086:2d10] (rev 05)

ff:02.1 Host bridge [0600]: Intel Corporation 1st Generation Core i3/5/7 Processor QPI Physical 0 [8086:2d11] (rev 05)

ff:02.2 Host bridge [0600]: Intel Corporation 1st Generation Core i3/5/7 Processor Reserved [8086:2d12] (rev 05)

ff:02.3 Host bridge [0600]: Intel Corporation 1st Generation Core i3/5/7 Processor Reserved [8086:2d13] (rev 05)

```

and 

```
for iommu_group in $(find /sys/kernel/iommu_groups/ -maxdepth 1 -mindepth 1 -type d); do echo "IOMMU group $(basename "$iommu_group")"; for device in $(ls -1 "$iommu_group"/devices/); do echo -n $'\t'; lspci -nns "$device"; done; done
```

Returns nothing.

I don't see any group like on the example given on the wiki (/sys/kernel/iommu_groups/ exists but is empty).

I tried to adapt the settings for the VM to my case and I get this error message :

```
no iommu_group found: No such file or directory
```

From GPU_passthrough_with_libvirt_qemu_kvm, if I launch the MinimalPassthrough.sh script or the GentooPassthrough.sh script I get this error :

```

QEMU 5.0.0 monitor - type 'help for more information

(qemu) qemu-system-x86_65: -device vfio-pci,host=09:0.0,x-vga=on,multifunction=on: vfio /sys/bus/pci/devices/0000:09:00.0: no such host device: No such file or directory.

```

This script nor the explanations on the wiki are not clear at all to me, I don't know how I could tweak that.

If I try to launch regularly the virtual machine following  QEMU/Linux guest , I need to use the headless script to have the Cd image booted, I get this:

```
SeaBIOS (version ?-20190711_202441-buildvm-armv7-10.arm.fedoraproject.org-2.fc31

)

iPXE (http://ipxe.org) 00:03.0 C980 PCI2.10 PnP PMM+1FF92030+1FEF2030 C980

                                                                               

Booting from DVD/CD...

ISOLINUX 6.04 6.04-pre1 ETCD Copyright (C) 1994-2015 H. Peter Anvin et al

Gentoo Linux Installation LiveCD                         http://www.gentoo.org/

Enter to boot; F1 for kernels  F2 for options.

Press any key in the next 15 seconds or we'll try to boot from disk.

boot: 

Loading /boot/gentoo... ok

Loading /boot/gentoo.igz...ok

ATI9

```

and it doesn't do anything more.

One thing I'd like to make clear: when you say I'd need two kernels on the host, do you mean two different kernels (if so, what would be the difference?) or only different boot options? I've found this page about PCI passthrough, that recommends to use "ommu=on intel_iommu=on". Is that what you refer to? I've tried to use this option but it doesn't change anything.

Edit: Here yo can find the VM configs I've tried : https://dpaste.com/FACDAZRNS

----------

## NeddySeagoon

Pums,

From

```
01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] RV730/M96-XT [Mobility Radeon HD 4670] [1002:9488] 
```

This looks wrong.

```
qemu-system-x86_65: -device vfio-pci,host=09:0.0,x-vga=on,multifunction=on: vfio /sys/bus/pci/devices/0000:09:00.0: no such host device: No such file or directory. 
```

I would expect the 09:00.0 to be 01:00.0 as that comes from the bus/device/function.

```
ls /sys/bus/pci/devices/ -l
```

will show a lot of symlinks. Find the one for your video card  0000:01:00.0 -> and follow it to check.

I had in mind 

```
app-emulation/libvirt

app-emulation/virt-manager
```

virt-manager is a GUI.  On the Mac you need app-emulation/libvirt to manage your KVM.

On a remote system, install app-emulation/virt-manager.

If you install both on the same system, you can create KVMs locally.

Make a KVM work before adding video pass through.

----------

## Pums

I don' know how to make KVM work.

It seems there's a problem with libvirtd:

```

# rc-service libvirtd status

 * status: crashed

# rc-service libvirtd restart

 * Stopping libvirtd ...

 * start-stop-daemon: no matching processes found                                                                        [ ok ]

 * Starting libvirtd ...                   

# rc-service libvirtd status

 * status: crashed

# virt-host-validate

  QEMU: Checking for hardware virtualization                                 : PASS

  QEMU: Checking if device /dev/kvm exists                                   : PASS

  QEMU: Checking if device /dev/kvm is accessible                            : PASS

  QEMU: Checking if device /dev/vhost-net exists                             : PASS

  QEMU: Checking if device /dev/net/tun exists                               : PASS

  QEMU: Checking for cgroup 'cpu' controller support                         : PASS

  QEMU: Checking for cgroup 'cpuacct' controller support                     : PASS

  QEMU: Checking for cgroup 'cpuset' controller support                      : PASS

  QEMU: Checking for cgroup 'memory' controller support                      : PASS

  QEMU: Checking for cgroup 'devices' controller support                     : PASS

  QEMU: Checking for cgroup 'blkio' controller support                       : PASS

  QEMU: Checking for device assignment IOMMU support                         : WARN (No ACPI DMAR table found, IOMMU either disabled in BIOS or not supported by this hardware platform)

```

Edit: I really don't know what to do (I understand livirtd has nothing to do with lauching a VM). I have no experience with qemu/KVM. On the host I ran tests and qemu VM works easily with the default configuration from the wiki's Qemu guest page, and does the same as on the mac for the headless script (stops after ATI9...).

----------

## DaggyStyle

 *Pums wrote:*   

> I don' know how to make KVM work.
> 
> It seems there's a problem with libvirtd:
> 
> ```
> ...

 

is that related to this topic_ if not. please open a new one

----------

## Pums

It is, since I'm actually just trying to have X session  / KMS working with the mentionned GPU, and it seems the only solution would be to make a GPU passthrough to a virtual machine.

----------

## DaggyStyle

 *Pums wrote:*   

> It is, since I'm actually just trying to have X session  / KMS working with the mentionned GPU, and it seems the only solution would be to make a GPU passthrough to a virtual machine.

 

what other way is there? if you want to use a specific gpu in the vm, you must passthrough.

if you have an intel igp, you can use vgpu which allows to to split the physical gpu to virtual ones. then you can have actual gpus for the host and the guest

----------

## Pums

DaggyStyle: The other way would be start the computer and then start X session... But it seems it can't work beacause the GPU makes BIOS calls during startup. That's why I'd need to run a VM to passthrough. I have no intel GPU. For hows and whys you can read the thread.

----------

## DaggyStyle

 *Pums wrote:*   

> DaggyStyle: The other way would be start the computer and then start X session... But it seems it can't work beacause the GPU makes BIOS calls during startup. That's why I'd need to run a VM to passthrough. I have no intel GPU. For hows and whys you can read the thread.

 

I'm nit sure I understand what you are trying to do, do you want to to allow the host to use the gpu until the vm is styarting and then pass the gpu to the vm?

----------

## Pums

DaggyStyle: The host is not able to use the GPU.

----------

## DaggyStyle

 *Pums wrote:*   

> DaggyStyle: The host is not able to use the GPU.

 

than pass-through gpu is the only way to go.

I was sure this thread was about getting that device working on gentoo over bare metal, am I wrong?

----------

## Pums

DaggyStyle: This thread is about getting a GPU working.Last edited by Pums on Sun Aug 09, 2020 10:12 am; edited 1 time in total

----------

## DaggyStyle

but the fact that it is within an vm changes the approach, if that it the case, you should have pointed it out in the first place.

if you did than I apologize as I missed it.

if it is indeed within a vm, what is the version of the host's libvirt, kernel and qemu?

----------

## Pums

DaggyStyle: My approach was not to use a VM. I never used KVM/qemu before and I just want primarly to have the GPU working. The fact is that, after running several tests, NeddySeagoon figured out, on page 3 of this thread, that a VM seems the only way to do it. I would never have been able to figure it out by myself since I didn't even know something like GPU passthrough exists. Therefore, I could not "have pointed it out in the first place".

All versions are up to date stable ones: kernel 5.4.48, qemu  5.0.0-r1, libvirt 6.2.0-r2.

----------

## DaggyStyle

 *Pums wrote:*   

> DaggyStyle: My approach was not to use a VM. I never used KVM/qemu before and I just want primarly to have the GPU working. The fact is that, after running several tests, NeddySeagoon figured out, on page 3 of this thread, that a VM seems the only way to do it. I would never have been able to figure it out by myself since I didn't even know something like GPU passthrough exists. Therefore, I could not "have pointed it out in the first place".
> 
> All versions are up to date stable ones: kernel 5.4.48, qemu  5.0.0-r1, libvirt 6.2.0-r2.

 

I understand, you can start here: https://wiki.gentoo.org/wiki/GPU_passthrough_with_libvirt_qemu_kvm

----------

## Pums

 *DaggyStyle wrote:*   

> you can start here: https://wiki.gentoo.org/wiki/GPU_passthrough_with_libvirt_qemu_kvm

 

I've tried it yet (among other things) and it didn't work, see my Thu Jul 30, 2020 11:23 pm's post for details.

----------

## DaggyStyle

have you tried setting the vm with virt-manager?

another option is to replace that card with an cheap newer one

----------

## Pums

 *DaggyStyle wrote:*   

> have you tried setting the vm with virt-manager?
> 
> another option is to replace that card with an cheap newer one

 

As explained in my Wed Aug 05, 2020 12:23 am's post, libvirtd doesn't start properly, so virt-manager won't work.

I will not embark on the extremely long, hard, risky and possibly useless operation of changing an iMac's GPU.

----------

## DaggyStyle

you have an imac?

can you paste the output of /proc/cmdline?

----------

## Pums

Are you serious? Yes, it's an iMac, as neatly stated at the very beginning of the first line of this thread, and over a hundred times repeated since then.

I don't see which interesting information you could retrieve from my boot commandline options. It's just a basic one, I've tried to add "iommu=on intel_iommu=on" parameter but it doesn't make thinks work better, see my Thu Jul 30, 2020 11:23 pm's post for details.

----------

## DaggyStyle

 *Pums wrote:*   

> Are you serious? Yes, it's an iMac, as neatly stated at the very beginning of the first line of this thread, and over a hundred times repeated since then.
> 
> I don't see which interesting information you could retrieve from my boot commandline options. It's just a basic one, I've tried to add "iommu=on intel_iommu=on" parameter but it doesn't make thinks work better, see my Thu Jul 30, 2020 11:23 pm's post for details.

 

my apologizes, this thread is twice the size of my concentration ability.

you must have iommu=on intel_iommu=on, without it it won't work, I don't know how it is with macs but can you access the bios and verify vt and vtd are enabled?

----------

## edbch21

Pums,

In case you, or anyone else, are interested in having X working, I think I found a workaround, without having to use the passthrough trick

In summary, you can add the following line in /etc/X11/xinit/xinitrc

```
exec xrandr -d :0 --output eDP --crtc 1
```

This is the source of this information, if you want more details. 

As the source says, you have to authenticate blindly or configure autologin while in nomodeset booted section. 

I have a machine similar to yours (iMac11,2)

```
 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] RV730/M96-XT [Mobility Radeon HD 4670] 
```

Investigating NeddySeagoon's priceless tips, particularly on the uefi problem, I ended up (in despair) installing rEFInd, but I'm not sure that this is absolutely necessary.

The important bit of the xrandr command appears to be "--crtc 1". I wonder if anyone would have any idea of the equivalent of this in terms of parameters to be passed when the radeon module is loaded.

----------

## Pums

edbch21,

Sorry for answering so late. That's a very good new, I'm going to try to do what I can on my side, and let you know how it goes.

----------

