You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sudo mkdir /media/rosetta
sudo mount -t virtiofs rosetta /media/rosetta
Enable Rosetta 2 in Fedora ARM Linux VM
echo ":rosetta:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00:\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/media/rosetta/rosetta:F" | sudo tee /proc/sys/fs/binfmt_misc/register
Check Rosetta 2 support
ll /proc/sys/fs/binfmt_misc/
Expected output
total 0
-rw-r--r--. 1 root root 0 Feb 17 06:30 python
--w-------. 1 root root 0 Feb 17 07:07 register
-rw-r--r--. 1 root root 0 Feb 17 07:07 rosetta
-rw-r--r--. 1 root root 0 Feb 17 06:43 status
Try with x86-64 binary
wget https://github.com/PowerShell/PowerShell/releases/download/v7.3.2/powershell-7.3.2-linux-x64.tar.gz
mkdir ~/powershell_x64
tar -xvzf powershell-7.3.2-linux-x64.tar.gz -C ~/powershell_x64/
cd ~/powershell_x64/
./pwsh
rosetta error: failed to open elf at /lib64/ld-linux-x86-64.so.2
Trace/breakpoint trap (core dumped)
cd Downloads
wget https://www.rarlab.com/rar/rarlinux-x64-621.tar.gz
Extract unrar Linux x86-64 binary
tar -xvzf rarlinux-x64-621.tar.gz -C .
Check rar binary architecture
file rar/rar
rar: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, stripped
Try to get help of rar Linux x86-64 binary
cd rar
LD_LIBRARY_PATH=/opt/packages/lib64 ./unrar /h
UNRAR 6.21 freeware Copyright (c) 1993-2023 Alexander Roshal
Usage: unrar <command> -<switch 1> -<switch N> <archive> <files...>
<@listfiles...> <path_to_extract/>
<Commands>
e Extract files without archived paths
l[t[a],b] List archive contents [technical[all], bare]
p Print file to stdout
t Test archive files
v[t[a],b] Verbosely list archive contents [technical[all],bare]
x Extract files with full path
...
Try to use rar to compress, uncompress and compare the result
md5sum rarlinux-x64-621.tar.gz
d31ef68b281179d29729aaa81d232b9c rarlinux-x64-621.tar.gz
LD_LIBRARY_PATH=/opt/packages/lib64 rar a -p123456 rar612.rar rarlinux-x64-621.tar.gz
mkdir back
mv rarlinux-x64-621.tar.gz back/
LD_LIBRARY_PATH=/opt/packages/lib64 unrar x rar612.rar
md5sum rarlinux-x64-621.tar.gz
d31ef68b281179d29729aaa81d232b9c rarlinux-x64-621.tar.gz
Script to automatically setup Rosetta 2 in Fedora Linux ARM
cd Downloads
wget https://download.sublimetext.com/sublime_text_build_4143_x64.tar.xz
tar -xvJf sublime_text_build_4143_x64.tar.xz -C .
cd sublime_text
file sublime_text
LD_LIBRARY_PATH=/opt/packages/lib64 ./sublime_text
Running Command Line Applications in Fedora Linux ARM using Rosetta 2 And Mock
Running Steps
Setup Rosetta 2 using script
wget https://bit.ly/kidrosetta2
chmod +x kidrosetta2
vim kidrosetta2 # Only enable first 3 steps!!!
sudo ./kidrosetta2
Install Mock
sudo dnf install mock -y
Create Fedora x86-64 environment using Mock
mock -r fedora-37-x86_64 --forcearch=x86_64 shell
Try some commands in Mock x86-64
<mock-chroot> sh-5.2# uname -a
Linux 6e9e243ac5894078a1bb848a5bccd24d 6.0.7-301.fc37.aarch64 #1 SMP PREEMPT_DYNAMIC Fri Nov 4 18:13:35 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
<mock-chroot> sh-5.2# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
<mock-chroot> sh-5.2# cat /etc/resolv.conf
<mock-chroot> sh-5.2# which ping
/usr/bin/which: no ping in (/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin)
<mock-chroot> sh-5.2# ping google.com
sh: ping: command not found
<mock-chroot> sh-5.2# which zip
/usr/bin/zip
<mock-chroot> sh-5.2# file /usr/bin/zip
/usr/bin/zip: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=3b70ebe222b7e0994a9dfa1cae71493f685c2d31, for GNU/Linux 3.2.0, stripped
<mock-chroot> sh-5.2# zip --help
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
The default action is to add or replace zipfile entries from list, which
can include the special name - to compress standard input.
If zipfile and list are omitted, zip compresses stdin to stdout.
-f freshen: only changed files -u update: only changed or new files
-d delete entries in zipfile -m move into zipfile (delete OS files)
-r recurse into directories -j junk (don't record) directory names
...
-T test zipfile integrity -X eXclude eXtra file attributes
-y store symbolic links as the link instead of the referenced file
-e encrypt -n don't compress these suffixes
-h2 show more help
<mock-chroot> sh-5.2# which $SHELL
/bin/bash
<mock-chroot> sh-5.2#
<mock-chroot> sh-5.2# which dnf
/usr/bin/which: no dnf in (/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin)
<mock-chroot> sh-5.2# which wget
/usr/bin/which: no wget in (/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin)
<mock-chroot> sh-5.2# which which
/usr/bin/which
<mock-chroot> sh-5.2# file /usr/bin/which
/usr/bin/which: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=bdc77dcac615ca4cc39f03ce3d41348113f48242, for GNU/Linux 3.2.0, stripped
<mock-chroot> sh-5.2# which curl
/usr/bin/curl
<mock-chroot> sh-5.2# file /usr/bin/curl
/usr/bin/curl: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=d0cedd17f019655ffd4a28e6c2a53cf75c0473fd, for GNU/Linux 3.2.0, stripped
<mock-chroot> sh-5.2# cat /etc/*release*
Fedora release 37 (Thirty Seven)
NAME="Fedora Linux"
VERSION="37 (Thirty Seven)"
ID=fedora
VERSION_ID=37
VERSION_CODENAME=""
PLATFORM_ID="platform:f37"
PRETTY_NAME="Fedora Linux 37 (Thirty Seven)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:37"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f37/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=37
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=37
SUPPORT_END=2023-11-14
Fedora release 37 (Thirty Seven)
Fedora release 37 (Thirty Seven)
cpe:/o:fedoraproject:fedora:37
<mock-chroot> sh-5.2# cat /proc/cpuinfo
processor : 0
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp flagm2 frint
CPU implementer : 0x00
CPU architecture: 8
CPU variant : 0x0
CPU part : 0x000
CPU revision : 0
processor : 1
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp flagm2 frint
CPU implementer : 0x00
CPU architecture: 8
CPU variant : 0x0
CPU part : 0x000
CPU revision : 0
<mock-chroot> sh-5.2# dmidecode
sh: dmidecode: command not found
Mock help
[liveuser@localhost-live Downloads]$ mock --help
usage:
mock [options] {--init|--clean|--scrub=[all,chroot,cache,root-cache,c-cache,yum-cache,dnf-cache,lvm,overlayfs]}
mock [options] [--rebuild] /path/to/srpm(s)
mock [options] [--chain] /path/to/srpm(s)
mock [options] --buildsrpm {--spec /path/to/spec --sources /path/to/src|
--scm-enable [--scm-option key=value]}
mock [options] {--shell|--chroot} <cmd>
mock [options] --installdeps {SRPM|RPM}
mock [options] --install PACKAGE
mock [options] --copyin path [..path] destination
mock [options] --copyout path [..path] destination
mock [options] --scm-enable [--scm-option key=value]
mock [options] --dnf-cmd arguments
mock [options] --yum-cmd arguments
options:
-h, --help show this help message and exit
--version show program's version number and exit
--rebuild rebuild the specified SRPM(s)
--chain build multiple RPMs in chain loop
--buildsrpm Build a SRPM from spec (--spec ...) and
sources(--sources ...) or from SCM
--debug-config Prints all options in config_opts
--debug-config-expanded
Prints all options in config_opts with jinja template
values already expanded
--shell run the specified command interactively within the
chroot. Default command: /bin/sh
--chroot run the specified command noninteractively within the
chroot.
--clean completely remove the specified chroot
--scrub [all|chroot|cache|root-cache|c-cache|yum-cache|dnf-cache]
completely remove the specified chroot or cache dir or
all of the chroot and cache
--init initialize the chroot, do not build anything
--installdeps install build dependencies for a specified SRPM or
SPEC file
-i, --install install packages using package manager
--list-chroots List all chroot's configs
--update update installed packages using package manager
--remove remove packages using package manager
--orphanskill Kill all processes using specified buildroot.
--copyin Copy file(s) into the specified chroot
--copyout Copy file(s) from the specified chroot
Check x86-64 folders created by Mock
Installation folder
[liveuser@localhost-live ~]$ ll /var/lib/mock/
total 8
drwxrwxr-x. 4 root mock 4096 Mar 23 11:41 fedora-37-x86_64
drwxrwxr-x. 4 root mock 4096 Mar 23 11:41 fedora-37-x86_64-bootstrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters