Linux - Reddit – Telegram
Linux - Reddit
761 subscribers
4.18K photos
207 videos
39.8K links
Stay up-to-date with everything Linux!
Content directly fetched from the subreddit just for you.

Powered by : @r_channels
Download Telegram
WSL 2 or a virtual machine ?

I finally upgraded my laptop, but it has a new AMD processor and Nvidia graphics card. So I will be keeping Windows 10 for now. However, I would like to continue running a bitcoin node and lightning node. I have only ever installed these via linux systems. Would it be possible in WSL 2 to do this?

Thanks for any insights.

https://redd.it/kusmm7
@r_linux
SUCCESS: iPhone 7 with dead NAND netbooting unmodified Ubuntu 20.04 arm64 over usb gadget ethernet

I just got done with this incredible experiment, and I couldn't resist sharing.

EDIT: VIDEO!!! **https://youtu.be/DrntxWqDuvI**

\--------

Prerequisites

1. writable directory available over nfs, including dhcp server on local network
2. checkra1n 0.10.2-beta (get at https://checkra.in/releases/0.10.2-beta#all-downloads)
3. Kernel fork for h9x/A10 (https://github.com/corellium/linux-sandcastle)
4. projectsandcastle utilities (https://github.com/corellium/projectsandcastle)
5. EITHER arm64 cross compiler or an arm64 native device. I used a rpi4 on 20.04 <-- way helpful to be able to chroot and setup, otherwise you'd have to use qemu-user
6. Bridge setup noscript/udev rules by me https://github.com/newperson1746/iphone7-linux-nfsroot

1. Rootfs setup

Make sure you have debootstrap. I'm assuming an arm64 native ubuntu device already running to which you have mounted the nfs directory at /mnt/nfsrootarm64

`sudo debootstrap focal /mnt/nfsrootarm64`
Now you can chroot into it and run some important pre-setup:
I'd install nano for convenience, I'll assume you have it from now on
apt install nano network-manager openssh-server
`dpkg-reconfigure locales`
This'll fix the famous debootstrap LC_ALL error. I chose en_US.utf-8 and also chose it as default.
`dpkg-reconfigure tzdata`
Here you can fix the clock
`adduser <someuser>`
This'll be your non-root admin user for regular use
`adduser <someuser> sudo`
nano /etc/apt/sources.list
Add focal-updates, focal-backports, and focal-security!
You can also add universe if you want to at this point

2. Kernel setup

clone the sandcastle kernel, and make hx_h9p_defconfig , now we need to make quite a few changes to the config. I did them manually by editing .config:

CONFIG\_USB\_ETH=y
CONFIG_NFS_FS=y
CONFIG\_IP\_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG\_BLK\_DEV\_INITRD=n // (none needed, otherwise it'll complain about wanting one)
CONFIG_CMDLINE="earlycon=hx_uart,0x20a0c0000 console=tty0 root=/dev/nfs rw nfsroot=<your_nfs_server_ip>:/nfsrootarm64,vers=4,tcp init=/usr/bin/systemd rootwait ip=dhcp g_ether.host_addr=12:a5:cf:42:92:fd g_ether.dev_addr=5e:bc:ca:27:92:b1 g_ether.idVendor=1317 g_ether.idProduct=42146 mitigations=off"
Replace the MAC addresses if you'd like, but I'll assume these are the ones moving forward
Fill in your nfs server ip
All of the flags are needed, I spent like 30 power cycles figuring out why nfs wouldn't mount unless i specified tcp.
CONFIG_ROOT_NFS=y
CONFIG\_CMDLINE\_FORCE=y
CONFIG_DEBUG_INFO=n // to speed up compile drastically

Now you can export LOCALVERSION if you'd like, and CROSS_COMPILE and ARCH=arm64if needed, but now it's just the good old:

make -j 4 Image

Now run `./dtbpack.sh` to generate the device-trees that PongoOS will use later.
lzma -z --stdout arch/arm64/boot/Image > ../Image.lzma to create the linux image that PongoOS can boot

3. Project Sandcastle utilities: clone the repo and cd to loader.

`make` will fail so simply run manually `cc -O2 -Wall load-linux.c -lusb-1.0 -o load-linux`
(-lusb was before load-linux.c, which broke sometime after sandcastle was first released)

4. Networking setup: clone my repo.

edit [`ethbridge.sh`](https://ethbridge.sh) with your ethernet ifname (it can trivially be modified to accept it as an argument from udev or something like that, but I'm lazy)
Place it somewhere static so you can call it from udev later
edit `70-iphone7.rules` with the MAC of your `g_ether` if you changed it, and put the correct path to [`ethbridge.sh`](https://ethbridge.sh)
SUCCESS: iPhone 7 with dead NAND netbooting unmodified Ubuntu 20.04 arm64 over usb gadget ethernet

I just got done with this incredible experiment, and I couldn't resist sharing.

**EDIT: VIDEO!!!** [**https://youtu.be/DrntxWqDuvI**](https://youtu.be/DrntxWqDuvI)

\--------

**Prerequisites**

1. writable directory available over nfs, including dhcp server on local network
2. checkra1n 0.10.2-beta (get at [https://checkra.in/releases/0.10.2-beta#all-downloads](https://checkra.in/releases/0.10.2-beta#all-downloads))
3. Kernel fork for h9x/A10 ([https://github.com/corellium/linux-sandcastle](https://github.com/corellium/linux-sandcastle))
4. projectsandcastle utilities ([https://github.com/corellium/projectsandcastle](https://github.com/corellium/projectsandcastle.git))
5. EITHER arm64 cross compiler or an arm64 native device. I used a rpi4 on 20.04 <-- way helpful to be able to chroot and setup, otherwise you'd have to use qemu-user
6. Bridge setup noscript/udev rules by me [https://github.com/newperson1746/iphone7-linux-nfsroot](https://github.com/newperson1746/iphone7-linux-nfsroot)

**1. Rootfs setup**

Make sure you have debootstrap. I'm assuming an arm64 native ubuntu device already running to which you have mounted the nfs directory at `/mnt/nfsrootarm64`

* `sudo debootstrap focal /mnt/nfsrootarm64`
* Now you can `chroot` into it and run some important pre-setup:
* I'd install nano for convenience, I'll assume you have it from now on
* `apt install nano network-manager openssh-server`
* `dpkg-reconfigure locales`
* This'll fix the famous debootstrap LC\_ALL error. I chose en\_US.utf-8 and also chose it as default.
* `dpkg-reconfigure tzdata`
* Here you can fix the clock
* `adduser <someuser>`
* This'll be your non-root admin user for regular use
* `adduser <someuser> sudo`
* `nano /etc/apt/sources.list`
* Add focal-updates, focal-backports, and focal-security!
* You can also add universe if you want to at this point

**2. Kernel setup**

clone the sandcastle kernel, and `make hx_h9p_defconfig` , now we need to make quite a few changes to the config. I did them manually by editing .config:

* CONFIG\_USB\_ETH=y
* CONFIG\_NFS\_FS=y
* CONFIG\_IP\_PNP=y
* CONFIG\_IP\_PNP\_DHCP=y
* CONFIG\_BLK\_DEV\_INITRD=n // (none needed, otherwise it'll complain about wanting one)
* CONFIG\_CMDLINE="earlycon=hx\_uart,0x20a0c0000 console=tty0 root=/dev/nfs rw nfsroot=[<](https://172.16.13.1)your\_nfs\_server\_ip>:/nfsrootarm64,vers=4,tcp init=/usr/bin/systemd rootwait ip=dhcp g\_ether.host\_addr=12:a5:cf:42:92:fd g\_ether.dev\_addr=5e:bc:ca:27:92:b1 g\_ether.idVendor=1317 g\_ether.idProduct=42146 mitigations=off"
* Replace the MAC addresses if you'd like, but I'll assume these are the ones moving forward
* Fill in your nfs server ip
* All of the flags are needed, I spent like 30 power cycles figuring out why nfs wouldn't mount unless i specified tcp.
* CONFIG\_ROOT\_NFS=y
* CONFIG\_CMDLINE\_FORCE=y
* CONFIG\_DEBUG\_INFO=n // to speed up compile drastically

Now you can export `LOCALVERSION` if you'd like, and `CROSS_COMPILE` and `ARCH=arm64`if needed, but now it's just the good old:

`make -j 4 Image`

* Now run `./dtbpack.sh` to generate the device-trees that PongoOS will use later.
* `lzma -z --stdout arch/arm64/boot/Image > ../Image.lzma` to create the linux image that PongoOS can boot

**3. Project Sandcastle utilities: clone the repo and cd to loader.**

* `make` will fail so simply run manually `cc -O2 -Wall load-linux.c -lusb-1.0 -o load-linux`
* `(-lusb` was before `load-linux.c,` which broke sometime after sandcastle was first released)

**4. Networking setup: clone my repo.**

* edit [`ethbridge.sh`](https://ethbridge.sh) with your ethernet ifname (it can trivially be modified to accept it as an argument from udev or something like that, but I'm lazy)
* Place it somewhere static so you can call it from udev later
* edit `70-iphone7.rules` with the MAC of your `g_ether` if you changed it, and put the correct path to [`ethbridge.sh`](https://ethbridge.sh)
*
Move `70-iphone7.rules` to /etc/udev/rules.d
* `sudo udevadm control --reload`

**5. checkra1n:** you'll need **0.10.2-beta** due to a command in PongoOS that was removed in later versions. It was added back after its open-sourcing, but the linux loader fails, so let's stick to this one.

\-----

**PUTTING IT ALL TOGETHER**

* Have the iPhone in recovery mode
* Launch checkra1n normally (no args)
* Hit start, and follow the DFU instructions. Once it tells you you've successfully entered DFU mode (sometimes it doesn't, just verify by `dmesg -w` in another terminal window reporting `Apple Mobile Device (DFU mode)` ), immediately CTRL-C before it starts attempting to boot into iOS.
* Now, run `checkra1n -cpE`
* This will launch PongoOS' command line only
* Now run `load-linux <path to Image.lzma> <path to dtbpack>`

Sit back and watch the iPhone show the two Tuxs on the top, autoconfigure DHCP, mount rootfs, and start systemd and go to a login prompt!

You should be able to ssh into it by checking what ip lease it was given by your dhcp server. Or, add a manual assignment by MAC address so you know exactly what it will be, as the bridge to ethernet exposes the usb-gadget's own MAC to the LAN, and it'll be visible independently from the tethered computer.

\-----

To be honest, I felt a lot of pride in using Linux for one of its classic purposes: repurposing otherwise-unusable devices. This iPhone would never be able to boot iOS again, as its nvme nand is completely dead. Yet, it boots Linux and mounts a filesystem over USB ethernet no problem!

**Go Linux!**

EDIT 3: Apparently they struggled to get Android to run because A10 mandates 16k page sizes, yet on mainline distros, there's no problem...

**Credits**

[https://blog.project-insanity.org/2020/04/22/linux-with-wayland-is-now-running-on-iphone-7/](https://blog.project-insanity.org/2020/04/22/linux-with-wayland-is-now-running-on-iphone-7/)

https://redd.it/kux9xx
@r_linux
Linux is the most "vulnerable" OS in the world.

I'm training for Cyber Security and we had a live class yesterday. The instructor asks us, "What's the most vulnerable OS in the world?"

Most people say Windows (predictably), I wanted to say "Any OS which hasn't been hardened & left at default config" but I didn't wanna be a smart ass - no one likes a smart ass. That's probably what the instructor is going for anyways. Trick question and whatnot.

Nope. The man claims it "Linux" which is the most vulnerable OS in the world. Shares this article.

I skim through the thing - we're live, don't have much time. I raised three concerns with the "analysis".

1. Debian is treated as one single OS, disregarding versions. Windows versions are treated separately.
2. Desktop Windows is represented by 7 & 10, which came out in 2008 & 2015 respectively. Windows XP, Vista, 8 & 8.1 are not even mentioned. This is for the period 1999-2019.
3. The analysis only considers raw No. of reported Vulns. without regard to severity.

The instructor does apologise... for offending me! Are my concerns valid? Are my objections justified? Am I thinking in the right way for a career in Cyber Security? No, it's whether or not I'm "offended" that's of top concern!

I'm a bit pissed and wanted to rant.

https://redd.it/kuy69p
@r_linux
Cron job



i need to schedule a cron job to get system time, cpu utilization and processor count and write it to an html and Schedule it for every 15mins.

Can anybody help me with this?

(Job automation using cron in unix/Linux)

https://redd.it/kuxzx9
@r_linux
What happened to Parler just shows us that we should not be trusting cloud servers like AWS with our business servers and data.

AWS cancels Parler contract for political reasons and gives them only 2 days to relocate.

The reason was political, but who knows what future nonsense reasons these companies may come up with to give you the boot. I hope many companies are now rethinking their cloud strategies and realizing they are gambling their whole business model on the whims of other companies. I think its time for some of these companies to start hiring Linux professionals to in-house more of their core business server needs.

Linux has made the opportunity to do this much easier in the past few years. I hope that Apple (of which I am NOT a fan) has shown us and that ARM and other CPU architectures have a place in the data center now. Chip manufacturers need to get their butts in gear to scale up these chips for more than just phone & tablet requirements. Data centers (both in-house and commercial) are going to need low power and cost CPUs that can handle greater memory and disk usage.

https://redd.it/kuywwc
@r_linux
It takes a very long time to unmount my hard disk.

I copied over 500GB and clicked unmount but it takes long time(still going on)(over 1h).

What shoud I do?

&#x200B;

hard disk:

seagate 2tb backup plus

&#x200B;

system:

cpu: amd r5 2600

ram: 12GB

gpu: gt1030

m/b: asrock a320m hdv r4.0

os: manjaro gnome 20.2.1

&#x200B;

pls help me ASAP!!!

https://redd.it/kv21mn
@r_linux
Reversed the Z3 series LCD display USB protocol as I use Linux
https://redd.it/kv4m8u
@r_linux
I made a tool for remembering linux commands

I always forget some linux or osx commands (like sudo lsof -iTCP -sTCP:LISTEN -n -P for checking which ports are being listened on). So I created this command, saves me a trip to google every time. It stores your own commands in a json file in you home dir. It can also fill in arguments in an interactive way, like the message in the example below. Feel free to use.

https://github.com/lvoogdt/ehh

https://i.redd.it/us0pbeldqqa61.gif

https://redd.it/kv7r5u
@r_linux
Transfer from Windows

Hey, I have been thinking of going from windows to some linux distribution, but I dont know which ohe I should go with? I would want something not very hard to learn and something that is like easy to switch to, any tips I should go with?

https://redd.it/kvc238
@r_linux
Writing an init with Go (part 1)

Hey guys, I've been experimenting with what the PID 1 is supposed to do and implementing it with modularity in mind (e.g. no services are spawned from PID1).

Also tried to use some sort of well known language to write services. Who doesn't know yaml?

And all the utils are written in Go. From golang.org: "Go is an open source programming language that makes it easy to build simple, reliable, and efficient software". It feels like a perfect fit for the PID 1.

So, here is the repo: https://gitlab.com/mrvik/go-pid1

And some articles describing the process and some design decisions: https://dev.to/mrvik/writing-an-init-with-go-part-1-3f35

I hope you like it. Feel free to report suggestions or whatever improvements you like.

Cheers!

https://redd.it/kvdumu
@r_linux
SUCCESS: iPhone 7 booting Ubuntu 20.04 to full gnome-shell desktop GUI

WE DID IT!! BOOTS TO THE FULL DEFAULT GNOME DESKTOP!

**VIDEO!** [**https://www.youtube.com/watch?v=DO8vt34kTh0**](https://www.youtube.com/watch?v=DO8vt34kTh0)

&#x200B;

https://preview.redd.it/v5gtvtwapua61.png?width=750&format=png&auto=webp&s=b2d8c6a11e4d836f0004c5d59610f20ed6fd4026

**BIG NOTE 0:** lol i literally wrote this entire post from Firefox running on the iphone 7 XD big brain time + arm64 rocks

**BIG NOTE 1:** Holy shit! This blew up! Thank you everyone, I had no idea this was gonna be that big. I'm truly humbled by how much interest it's garnered. I hope I've been able to effectively deliver the inspiration that Linux provides not just to me, not to just to the people reading about this, but to millions of developers, employees, and children alike. It's a tool to change the world, and I've never been prouder to support a worldwide revolutionary example of software which saves devices from the trash, revives old laptops to help children in need, or simply makes a convenient server out of an otherwise useless iPhone.

**BIG NOTE 2:** It's reached 9to5mac and iDownloadBlog and more! It's been reported that I am running on a "jailbroken" iPhone and that to be able to do this one has to have already jailbroken the phone. That's not correct; in fact there's no possible way for me to jailbreak this iPhone, as its NVMe NAND is downright inaccessible. That is to say, iOS will never be able to boot on this phone. *If there weren't a Linux kernel port for A10, one might be able to affectionately call this phone not a Linux phone but a brick.* One can pull all of this off without ever jailbreaking the phone. The only reason I'm using checkra1n is for the bootrom exploit and unsigned code execution. In fact, this iPhone had never been jailbroken before flash failure. I got it from my grandma who had the NAND die on her suddenly.

\--------------

Background: I actually was going to stop at just booting nogui. Believe it or not, I am going to be using this in production; I will actually be deploying this iPhone as a server to relieve capacity issues at my home servers. I'm 16 and run several school/club websites and game servers for my friends and myself, and I'll be distributing some load to the iPhone to relieve the main server!

With A10 IPC on par with Skylake, the performance per watt of this device is downright astonishing. The entire "server" is powered off a USB port on the main server.

**TO-DO: Run benchmarks**

* I would love to use the phoronix test suite, but I have no idea what benchmark suite I'd be running. Let me know what you're interested in seeing!
* From memory in news articles and geekbench scores, A10 nearly matched Skylake IPC, and I'd love to see whether that still holds true in a Linux environment
* **Let me know if there's anything else you'd like to see tested/run on the Ubuntu iPhone!**

**Fixes since last time**

* `sudo apt install linux-firmware ubuntu-desktop`
* Working on getting brcmfmac firmware (not my main focus though, as I don't need it)
* No compromises ubuntu-desktop, since its just an nfsroot folder that I can easily make a copy of for my actual production setup, why not go grand for a test
* New services: [https://github.com/newperson1746/iphone7-linux-nfsroot/tree/master](https://github.com/newperson1746/iphone7-linux-nfsroot/tree/master)
* g\_ether\_dns.service --> /etc/systemd/system/g\_ether\_dns.service
* enable it to fix DNS not being set by kernel dhcp
* vino\_server.desktop --> \~/.config/autostart/vino\_server.desktop
* For mouse/keyboard input to gnome-shell, also remote access is useful in general
* `sudo nano /etc/gdm3/custom.conf`
* Uncomment AutomaticLoginEnable and AutomaticLogin
* set these for your user
* As VNC doesn't work in gdm3 but it'll autostart on login
* `gsettings set org.gnome.Vino prompt-enabled false`
* To allow connection without triggering a prompt that we have no way of interacting with

&#x200B;

**Quick thing for anyone who's
trying this out**

1. If your nvme NAND isn't dead, try compiling hx-touchd, fixing hx-touchd.service from [https://github.com/newperson1746/iphone7-linux-nfsroot/tree/master](https://github.com/newperson1746/iphone7-linux-nfsroot/tree/master) , and moving firmware/D10.mtprops to a location like /lib/firmware/multitouch/D10.mtprops
1. This is the daemon that uploads the firmware and config for the touchscreen; it won't work for me because it depends on certain data on NAND (/dev/nvme0n3) from iOS, which is corrupt by the dead NAND cells.

* Source for mtprops/service info on hx-touchd: [`https://github.com/corellium/projectsandcastle/blob/master/android/sandcastle-aosp.diff`](https://github.com/corellium/projectsandcastle/blob/master/android/sandcastle-aosp.diff)

https://redd.it/kvmsfd
@r_linux
Best way to filter and monitor traffic?

Im planning to set up DNS sinkhole to block ads and stuff, so i am wondering, what best way would be to set up some monitoring tool to see statistics and logs of visited ip's, as well as used bandwidth on per-user basis?
For the platform im going to be using intel nuc and centos

https://redd.it/kvnewo
@r_linux
Can open Firefox in terminal

Cant open Firefox in terminal

Hey,

&#x200B;

Whenever I try to open firefox in my terminal I get this message:

No protocol specified

Unable to init server: Could not connect: Connection refused

Error: cannot open display: :14.0

&#x200B;

Does anyone know what I can do to fix that?

https://redd.it/kvobo2
@r_linux