#unix

1 messages · Page 54 of 1

formal schooner
#

gnu make is quite an impressive program, the only bad thing about it really is the makefile syntax

#

can't vouch for bsd make, never used it

stark sinew
#

finally, it works, thanks for your help @formal schooner

crude seal
#

Hello

#

My usb device not showing up in my linux computer

gritty jolt
stark sinew
gritty jolt
#

Can u give me ur plugins?

stark sinew
#

yeah, 1 sec

#

so, if you load this .vimrc, it'll auto install

gritty jolt
#

Thank u

stark sinew
#

once pasted into .vimrc, execute :source % then execute :PlugInstall and voila.

#

your vim is the same as mine.

gritty jolt
#

Yeah i use vim as main Too

#

😄

stark sinew
#

nice lets see

gritty jolt
#

I would give u tomorrow i am on phone

stark sinew
#

ok cool

crude seal
#

How?

stark sinew
#

it'll be a few command line arguments

#

so uhm, what unix are u running?

#

remove your usb, show me the output of lsblk

#

then plug in and show the output of lsblk

crude seal
stark sinew
#

😒

#

what distro are u using

#

look if you don't want help then don't ask, simples.

#

or sort it yourself idk

crude seal
#

i use bodhi distro

#

it's distro of ubuntu

crude seal
# stark sinew remove your usb, show me the output of `lsblk`

this is without usb ```
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 55.5M 1 loop /snap/core18/2074
loop1 7:1 0 77.2M 1 loop /snap/discord/128
loop2 7:2 0 162.9M 1 loop /snap/gnome-3-28-1804/145
loop3 7:3 0 65.1M 1 loop /snap/gtk-common-themes/1515
loop4 7:4 0 32.3M 1 loop /snap/snapd/12398
sda 8:0 0 76.3G 0 disk
├─sda1 8:1 0 100M 0 part
└─sda2 8:2 0 76.2G 0 part
sdb 8:16 0 465.8G 0 disk
├─sdb1 8:17 0 512M 0 part /boot/efi
├─sdb2 8:18 0 1K 0 part
└─sdb5 8:21 0 465.3G 0 part /

stark sinew
#

k and with usb

crude seal
#
ahmed@ahmed-HP-Compaq-dx2420-Microtower:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  55.5M  1 loop /snap/core18/2074
loop1    7:1    0  77.2M  1 loop /snap/discord/128
loop2    7:2    0 162.9M  1 loop /snap/gnome-3-28-1804/145
loop3    7:3    0  65.1M  1 loop /snap/gtk-common-themes/1515
loop4    7:4    0  32.3M  1 loop /snap/snapd/12398
sda      8:0    0  76.3G  0 disk
├─sda1   8:1    0   100M  0 part
└─sda2   8:2    0  76.2G  0 part
sdb      8:16   0 465.8G  0 disk
├─sdb1   8:17   0   512M  0 part /boot/efi
├─sdb2   8:18   0     1K  0 part
└─sdb5   8:21   0 465.3G  0 part /
sdc      8:32   1   7.2G  0 disk

stark sinew
#

cool, so our device name is sdc ye?

#

now mkdir /mnt/usbstick

#

or sudo mkdir /mnt/usbstick/

#

then, mount sdc /mnt/usbstick/ or sudo mount sdc /mnt/usbstick/

crude seal
#

sudo mount sdc /mnt/usbstick
mount: /mnt/usbstick: special device sdc does not exist.

stark sinew
#

my bad

#

sudo mount /dev/sdc /mnt/usbstick/

crude seal
#

ahmed@ahmed-HP-Compaq-dx2420-Microtower:~$ sudo mount /dev/sdc /mnt/usbstick
mount: /mnt/usbstick: wrong fs type, bad option, bad superblock on /dev/sdc, missing codepage or helper program, or other error.

stark sinew
#

ok, we need to specify the filesystem type with the -t argument

#

do u know what filesystem type that usb is

#

i dunno how we'd check

crude seal
stark sinew
#

1 mo

#

what's the output of lsblk --fs

#

or blkid -p /dev/sdc

#

is more concise.

crude seal
# stark sinew what's the output of `lsblk --fs`
ahmed@ahmed-HP-Compaq-dx2420-Microtower:~$ lsblk --fs
NAME FSTYPE LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINT
loop0
     squash                                                  0   100% /snap/core
loop1
     squash                                                  0   100% /snap/disc
loop2
     squash                                                  0   100% /snap/gnom
loop3
     squash                                                  0   100% /snap/gtk-
loop4
     squash                                                  0   100% /snap/snap
sda
├─sda1
│    ntfs         BE2CC4812CC435E5
└─sda2
     ntfs         54D8C691D8C670B2
sdb
├─sdb1
│    vfat         3C09-F5DE                               511M     0% /boot/efi
├─sdb2
│
└─sdb5
     ext4         9506d0cf-5cc1-4466-9bcb-21185660512d  420.5G     3% /

stark sinew
#

second one instead pls

#

sudo blkid -p /dev/sdc

crude seal
#

nothing happens

stark sinew
#

hmmm

crude seal
stark sinew
#

let's just assume it's fat32

#

sudo mount -t vfat /dev/sdc /mnt/usbstick/

#

if not let's try ext4

#

and then i'm rlly out of ideas

crude seal
#

ahmed@ahmed-HP-Compaq-dx2420-Microtower:~$ sudo mount -t vfat /dev/sdc /mnt/usbstick/
mount: /mnt/usbstick: wrong fs type, bad option, bad superblock on /dev/sdc, missing codepage or helper program, or other error.
ahmed@ahmed-HP-Compaq-dx2420-Microtower:~$

stark sinew
#

and ext4?

crude seal
#

i replace vfat with ext4?

stark sinew
#

wait before that

#

hmmmm

#

actually yeah tfry that

#

i was thinking maybe sdc was partitioned

#

or something

#

then try mount -t msdos /dev/sdc /mnt/usbstick

#

hold on bro

#

is this usb stick empty?

crude seal
#

?

stark sinew
#

like is it a new usb stick or something?

crude seal
#

it's not empty

stark sinew
#

ok it's got things in it

crude seal
#

last time i used the usb i burned iso file in it

stark sinew
#

it's weird because theres no partition at all

#

normally you'd have like /dev/sdc has partition sdc1 or whatever

#

have u tried both -t vfat and -t msdos yet?

crude seal
#

ahmed@ahmed-HP-Compaq-dx2420-Microtower:~$ mount -t vfat /dev/sdc /mnt/usbstick
mount: only root can use "--types" option

stark sinew
#

so msdos doesn't work?

#

sudo mount -t msdos /dev/sdc /mnt/usbstick/

#

run that pls

#

u need to remember sudo

crude seal
#

ahmed@ahmed-HP-Compaq-dx2420-Microtower:~$ sudo mount -t msdos /dev/sdc /mnt/usbstick/
mount: /mnt/usbstick: wrong fs type, bad option, bad superblock on /dev/sdc, missing codepage or helper program, or other error.

stark sinew
#

ok, pls can u send a screenshot of the output of lsblk -l

crude seal
stark sinew
#

dmesg | tail -20 and screenshot pls

#

sudo dmesg | tail -20

#

oh yeah and finally, this definitely isn't gonna work but can u at least try in sequential order, see if one works.

#

sudo mount /dev/sdc1 /mnt/usbstick/

#

sudo mount -t msdos /dev/sdc1 /mnt/usbstick/

#

sudo mount -t vfat /dev/sdc1 /mnt/usbstick/

#

let's just guess it does have a partition even though it's not showing on lsblk for some reason.

crude seal
#

ahmed@ahmed-HP-Compaq-dx2420-Microtower:~$ sudo mount /dev/sdc1 /mnt/usbstick/
mount: /mnt/usbstick: special device /dev/sdc1 does not exist.
ahmed@ahmed-HP-Compaq-dx2420-Microtower:~$ sudo mount -t msdos /dev/sdc1 /mnt/usbstick/
mount: /mnt/usbstick: special device /dev/sdc1 does not exist.
ahmed@ahmed-HP-Compaq-dx2420-Microtower:~$
ahmed@ahmed-HP-Compaq-dx2420-Microtower:~$ sudo mount -t vfat /dev/sdc1 /mnt/usbstick/
mount: /mnt/usbstick: special device /dev/sdc1 does not exist.
ahmed@ahmed-HP-Compaq-dx2420-Microtower:~$

stark sinew
#

ok, damn.

#

i have no idea what else to do now apart from reformat that usb stick.

#

we'd reformat it, make a partition and then mount it

crude seal
#

How to do that

gritty jolt
stoic yoke
#

Anyone using WSL v2 Kali, so they can test a quick bug I keep getting?

#

If I ever double tap the physical escape key twice on my terminal windows it freezes the window temporarily.

stoic yoke
#

Ok well it seems like a Kali/Bash issue with Bash v5.1.4
Edit:
Figured out the issue, double escape in bash does tab complete and then also causes the entire bash window you cache my path. Causing a delay based on the size of my drives and etc....

quasi warren
#

When we do man ascii, we get:

So is it right to say ascii value of A is 65?

#

and if we wanted to store the numerical value of 65 to a variable instead of using 65 as a magic number, would the following make sense

ascii_of_A = 65
dark rivet
#

yes, but i would probably use ASCII_OF_A because it would be a constant

#

maybe even omit the "of" entirely

quasi warren
formal schooner
#

That foo_of_bar naming style is used in the ocaml stdlib

#

It's kind of goofy

high steppe
#

hey there, can anybody give me a hand? I'm having trouble with aliases/function definitions and execution/fallback directories for aliases too...

#

ik I sound like someone who hasn't even read the manual, but I have and I don't understand much

#

It would be great if anyone knew a tutorial other than the official one for this topic

heavy patio
#

hey there! i hope this is the right channel to ask but how do i install python modules on arch linux? (please ping me)

crisp furnace
#

How do we convert octal o hexadecimal directly? does anyone know?

heavy patio
#

but how?

lavish storm
lavish storm
heavy patio
#

i do

lavish storm
#

then do python -m pip install XXX

heavy patio
#

ill try that

#

[captain8771@CapOS ~]$ python -m pip install discord
/usr/bin/python: No module named pip
[captain8771@CapOS ~]$

#

bruh moment

lavish storm
#

ah

#

try sudo pacman -S python-pip

heavy patio
#

k

#

ah thanks!

lavish storm
crisp furnace
#

I meant without python

#

Ik this is a python server

lavish storm
#

that is not python

crisp furnace
#

oh

#

What is it?

lavish storm
#

shell script

#

Are you familiar with shell? (e.g. bash, zsh)

#

anyway shell has bc which is a calculator language

#

so you can use bc to convert any number in any base to a number in a base of your choice

#

if you want to learn more just type man bc in your terminal

crisp furnace
#

not unless you're referring to "windows cmd" and "windows powershell"

lavish storm
#

hmm

#

well

#

this channel isn't for windows-exclusive users

#

since windows isn't a UNIX-based OS

upper prairie
#

Typically you'd use pyenv

#

or install another version

#

I don't understand the point you're trying to make

#

Built-in Python doesn't come with pip

#

Python is used internally by certain programs

#

You don't want to install python-pip, and you don't want to use it as a global interpreter

#

That's up to you, but generally I don't think people should be using the built-in interpreter

#

it's only there as a dependency, and if something breaks... I don't expect it to be an easy fix

#

If you look hard enough, you'll see staff making the same recommendation throughout this server

#

I'd also like to caution against the use of pacman -S, while we're here

#

um that's exactly what you're not supposed to do

#

that's like... the worst thing you could do in this context

#

That's what you imply

#

If you say "update the repos", that doesn't imply pacman -Syu because that's a complete distribution upgrade

#

This is a bit of a fault on the wiki's part, the partial upgrades stuff is not explained here

#

but they do however expect you to read the system maintenance page

#

which does explain that you should perform a distribution upgrade before installing a package

#

and in the case of Arch, it's good habit to always just do sudo pacman -Syu <package>

#

updating the repos is what sudo pacman -Sy would do

#

sudo pacman -Syu actually updates packages and upgrades your system

#

That was not an assumption that I made, I was going solely based off of what you had said

#

Updating the repos is pacman -Sy, if you asked someone "How do I update the pacman repositories?", they would not respond with sudo pacman -Syu

#

I don't even use Arch

#

I... really don't see a need to delete every message

#

because now this looks incredibly one-sided and spammy

lavish storm
#

It was a one-sided conversation 🙂 you were right all along!

#

I sincerely apologise, i clearly know nothing

scarlet totem
lavish storm
#

Never use pacman -S!

scarlet totem
lavish storm
#

so I'm going to listen to the expert advice and not use -S

scarlet totem
#

If the wiki is wrong why hasn't it been updated for something so important

lavish storm
#

Clearly the wiki authors do not know what they are talking about :)

scarlet totem
lavish storm
scarlet totem
lavish storm
#

i guess i was just super lucky using -S for the last couple years

#

like one in a trillion lucky

scarlet totem
#

I am an apt user, so not familiar with pacman, but through reading the wiki and an understanding of package managers, my interpretation is -S will install old packages and not the most up to date.

lavish storm
#

depends, if you have run -Syu sometime that day then it may as well be the newest available. -S doesn't imply "download not the latest one"

scarlet totem
#

The most recent version in the cache

lavish storm
#

exactly

#

i think every arch user knows to do -Syu

#

very safe to assume so

scarlet totem
#

Is it easier to break Arch due to being a rolling release?

lavish storm
#

at least from personal experience

scarlet totem
#

they are normally a trade off

#

I go for stability

#

So with Arch installing pip with -Syu and then using a virtual env would be best

lavish storm
lavish storm
#

and yes, venvs for project-specific stuff i suppose

upper prairie
upper prairie
#

ArchWiki says to perform a system upgrade before installing a package, and the easiest way to do that would be sudo pacman -Syu <package>

lavish storm
#

I totally agree with you

#

I'm not implying you are wrong

#

I don't know why you are getting that impression, I have totally submitted to your opinions

upper prairie
#

I don't understand the sarcasm

lavish storm
#

It's not sarcasm??

#

Can't you just accept my defeat for what it is

upper prairie
#

You keep saying things like

ghastly, openSUSE users know better
— I can't help but take offense to that

lavish storm
#

but you do know better, do you not?

#

That is an empirical fact

scarlet totem
upper prairie
#

or am I not understanding what you're talking about lol

#

you generally just want to leave the preinstalled interpreter completely alone

scarlet totem
upper prairie
#

pipenv requires messing with the base interpreter

#

and that would also require you to activate a venv for things like IPython

#

which I mean to have to go around and do

cd ~/Documents/base-venv
source venv/activate.sh
ipython

is quite annoying lol

scarlet totem
#

Stuff like Jupyter I'll run in Docker or pipenv. Dev I'll use pipenv or Docker. I am already in the dir and can run pipenv run dev. Python applications I'll normally install with apt.

#

pipenv run dev will normally run something like ls *.py | entr -r python main.py

nova viper
#

anybody knows how to run code in VS?

scarlet totem
nova viper
#

yes

#

VS code

#

visual studio code

#

anybody?

scarlet totem
#

I do

#

vscode is what I use

nova viper
#

how do you run code

scarlet totem
#

There is a couple of ways, you can user the terminal or tasks

nova viper
#

ok?

#

because i just left py charm and downloaded this

scarlet totem
#

I use the terminal normally and don't use task.

#

Ctrl ~ (~ is above tab next to 1) will open a terminal

#

type python3 and see if it works

#

Terminal->New Terminal from the top menu will get you one as well

#

Also what os are you on?

nova viper
#

i am on mac OS

#

i love mac because its beautiful

upper prairie
#

because with pyenv you can just do like pyenv global 3.9.5 and be on your way, worry free

nova viper
#

my dream was to have a linux system but i din't get one

scarlet totem
upper prairie
#

How's that compare to poetry?

#

might be the wrong channel for this, if you'd prefer we move then you can ping me in a relevant channel

scarlet totem
#

Yeah

untold abyss
#

Used that for piping output of a script. anyone know what does this do exactly? >

>(tee -a stdout.log) \
    2> >(tee -a stderr.log >&2)
formal schooner
#

@untold abyss like this?

cmd \
  1> >(tee -a stdout.log) \
  2> >(tee -a stderr.log >&2)

it emits stdout to both stdout.log and stdout, and it emits stderr to both stderr.log and stderr

#

>() is "process substitution"

main olive
#

Im getting the ertot “chroot is running ,command “start” ignored”

scarlet totem
sick dirge
#

any thoughts on this

print("PythonOS [0.1] is booting up...")
print("Importing modules...")
import os
print("Setting keys...")
adminpassword = os.environ['adminpassword']
print("All modules and keys are set up!")
def main():
  print(" ")
  cmd = input("A:/~ ")
  if cmd == "help":
    print("poweroff - Shutdown system")
    print("help - Help command")
    return main()
  if cmd == "poweroff":
    print("Shutting down...")
    print(" ")
    print("This was PythonOS [0.1].")
  else:
    print("Invalid command!")
    return main()
main()
#

its a basic "opeating system for me but I know its not" what other commands should i add im planning to add a admin "root" command which is being worked on

dapper musk
#

I dont think that it is correct chanell your """"""os"""""" does not have eaven unixish paths

lavish storm
#

lol

amber garnet
fresh saddle
#

It is definitely a shell though

atomic ember
#

I have a question it's a good idea to use a recursive function in that "os"?

formal schooner
#

you don't want to implement arbitrarily long loops in python using recursion

#

because python doesn't have any optimization for recursive functions and you eventually hit the maximum stack size

atomic ember
#

that i was thinking

lavish storm
#

async is probably better

onyx marsh
#

Should i use single quote or double quote to run a python script on linux?
Well, it's not directly on linux terminal. I'm using a run external program on torrent completion on qbittorrent but since it on linux vps, i assume it run bash.

python "/root/nekobot/up.py" -hash "e92f5b4a721c6a5b7f8f257e25e221d0f773c395"
runic quarry
#

Won't make a single difference.

supple escarp
#

Hey I'm writing a deamon in python

supple escarp
#

I've an issue where I've got a class that's in another file

#

for some reason the daemon starts if the class is in the same file as my driver function. But if I pull it in from another file it fails to start

supple escarp
#

Any ideas?

lavish storm
#

rather than here

azure portal
#

what is the source command for? and how does it work?

lavish hill
runic quarry
azure portal
runic quarry
#

It just runs the script inside of your current shell.

#

For example;

#

Say you have a file named script.sh with this in it:

#!/usr/bin/env bash

echo hi
cookie = cake

If you run source script.sh, it'll print hi to your terminal, and set the value of cookie to cake.

#

Pretty much what @lavish hill said, just provided an example.

#

When you run source ~/.bashrc it's just a huge collection of commands and variables entering into your current shell.

lavish hill
#

The cool thing about it is when you write functions in the script. They become callable, and won't be called by source, just to make that clear. When you source bashrc, you'll want your terminal settings stored in there

runic quarry
#

Yeah, like you could put something like this in a file:

print_words() {
  echo "hi"
  echo "hi2"
}

And if you ran source file, you would be able to run the print_words command, which would print hi and hi2.

#

Is there a certain way you're needing to use it or something?

azure portal
#

@runic quarry @lavish hill ,
how it is different to bash command use to run script?

lavish hill
runic quarry
#

Great question:

Try creating a file named file.sh with this in it:

#!/usr/bin/env bash
discord=quack
  1. First try running bash file.sh. If you then run echo $discord, you'll see it's not set to anything.

  2. Now, run source file.sh. If you run echo $discord this time, you'll see that it's set to quack.

#

Difference is mostly just in that, first one runs in a subprocess, but the second one runs directly inside your shell.

#

Just fixed the command, still hung up on python variable assignment.

azure portal
#

@lavish hill , you mean with source you directly executing it? and with bash is you are loading it for later use? as what @runic quarry example (if I understand the example correctly)?

lavish hill
#

One actually good example of this:
Inside your bashrc, you can enter this:

PATH=$PATH:$HOME/.local/bin

If you then source ~/.bashrc it tells your terminal that you will later on look for executable files located in ~/.local/bin for your terminal commands. If you just ~/.bashrc, it would only execute, but not be stored in terminal

runic quarry
#

So you'd have your current terminal session, and when you run bash file.sh, it spawns a new process to run the command.

#

When you run source file.sh though, it runs in your current process.

lavish hill
#

Another important point of this is that source does not require the file to be executable!

runic quarry
#

I don't think running bash file.sh does either.

#

I think it mostly matters just when running something like ./file.sh.

lavish hill
#

True

runic quarry
#

Great great

lavish hill
#

Completely off topic though, I recommend zsh 😂

runic quarry
#

I'll let you keep your opinion, definitely disagree though.

#

I'm too lazy to learn zsh. Already stuck learning Python 'cause Bash gets slow as crud real quick when using pipes.

#

Really liking the speed improvements with Python though.

lavish hill
#

How come? I feel like zsh is the more beginner friendly version of bash, or more easily configurable, but it just took a while to actually get it done

runic quarry
#

I started with Bash, and there's all these tiny differences with zsh that's making me not want to learn it.

#

In zsh's defense I've spent about five minutes trying to learn it.

#

Was mainly going to use it to make some spinners for a program I write (Bash was being poopoo at it), but Python looks like it'll work lovely.

lavish hill
#

I mean, you might have the exact functions that I'm talking about in Bash too. I'm just addicted to fzf

runic quarry
#

No clue what that is lol

#

Just an advanced regex thing or something?

lavish hill
#

That reminds me of why I came on this chat lol! Thanks xD
Do you happen to have a regex pattern to grab between to parentheses?

runic quarry
lavish hill
#

Yea

#

I got this far: \((.*?)\)

runic quarry
#

Do you want to include the parenthesis, or no?

lavish hill
#

I just want to get rid of them yeah

runic quarry
#

You fine using grep?

#

I know how to keep the parenthesis, and then remove then with sed, not sure much on how to get rid of them with only regex though.

#

If you're fine keeping them, something like this would work:

\([^)]*\)
lavish hill
#

Yeah I'm using grep -Eo already

#

Let me try

#

It's getting close

runic quarry
#

Just added an escape, had some issues without it.

#

Should be able to just run sed or something after to get rid of the parenthesis.

lavish hill
#

Hmm yeah, probably need to do that.. Just not sure sed is available where I'm going to run this

runic quarry
#

Will grep be?

lavish hill
#

grep is available

#

Sed is too 😄

runic quarry
#

Do you need help with the sed statement, or is that covered?

#

Don't know many places with grep without sed, any recent Linux system would have then anyway.

lavish hill
#

I'm not too familiar with sed, so it would be helpful, but I can google a bit too. It needs to pipe the output though, currently just looking at the default gateway as an example

#

So my command atm is:

arp -a | grep gateway | grep -Eo "\((.*?)\)"
runic quarry
#

Well if you have a string like hi(123), this would work:

echo 'hi(123)' | grep -Eo '\([^)]*\)' | sed -e 's|(||g' -e 's|)||g'
#

Just tells sed to wipe out any parenthesis.

lavish hill
#

Kind of nasty looking, but works beautifully

#

Thanks 😛

runic quarry
#

Joys of regex lol

#

Yep, np

lavish hill
#

Neat!

#!/bin/bash

InsidePar(){
  echo $@ | grep -Eo '\([^)]*\)' | sed -e 's|(||g' -e 's|)||g'
}

GATEWAY=$(InsidePar $(arp -a | grep gateway))
echo $GATEWAY
supple escarp
#

@lavish storm Maybe, I figured it was a unix issue since I'm using a double fork to start the background process.

undone pulsar
#

In fact you could probably skip out on the tr entirely by replacing the grep with something like grep -Po '(?<=\()[^)]*'

#

Worth noting that this particular pattern won't catch unmatched parens though.

frank coral
#

Is it possible to generate a public ssh key without the schacon@mylaptop.local part in the end?

frank coral
#

thank you 🙂

amber garnet
#

👍

nimble panther
#

!warn 824602496742719498 Please don't post pictures of random people.

shy yokeBOT
#

:incoming_envelope: :ok_hand: applied warning to @bold fjord.

shrewd thicket
#

Why does my discord bot fail, after a while, with the message "Killed"?

#

This is a graph of the memory available on my ubuntu machine

#

The dip is where the process shuts down

modest cargo
#

I have a server and I created a DNS name to point to that server, is there a way that I can check in a script in the server if the DNS name points to the local server?

main olive
#

is anyone willing to help me with an issue i dont see any open help channels. dont really want to get banned by bombing the channel with my problems, if you can shoot me a message, that would be awesome thanks 🙂

warped nimbus
#

If your question is about unix stuff you can just ask here though

main olive
#

no it wasnt, there were no available channels for a little there i was wondering if it just stays like that or... anyways thanks

warped nimbus
#

There definitely were. We have plenty in reserve right now. If there were not any available then we would have gotten an automated alert.

#

Unless it was being slow to move the channels over or something

main olive
#

strange twice today i have not seen the available help channel, maybe i missed it cause theres no "#"

lavish storm
#

i see three

main olive
#

yes

lavish storm
#

go ask in one of them now!

main olive
#

i already asked

lavish storm
#

nice! good job!

main olive
#

🙂

coral moth
#

Can we make os with cython

#

?

hidden sail
amber garnet
#

You need system language like C or Rust

coral moth
#

like 90% is c or c++

lavish storm
white barn
#

OS can have a little Python, as a treat

#

I mean would it count as a bit of Python if you used python like old school 8-bit computers used BASIC?
you didn't use Python for OS development but you gotta do some stuff to make python work with your custom OS

coral moth
#

Oh okay gotcha thanks

formal schooner
#

i believe an OS kernel usually needs a bit of assembly to start itself, and then needs to be written in a language like C (but not necessarily C) in order to have full, precise control over the hardware

#

once you have a kernel (not a small task) you can write as many python programs as you want... but you will need a python interpreter too

real swan
#

does the base register contain physical address or logical address? when i googled i found that it maybe logical or physical which im not sure if it is right or wrong
any help in this regard would be great

dapper musk
#

logical anddres since CPU is dealing with it. also i wonder what this question has to do with unix or pythron

pulsar hawk
#

I’m here

gleaming topaz
#

I restarted it with sudo reboot and it's stuck like this for several minutes

pulsar hawk
#

do uname -a and tell me what it says

gleaming topaz
#

I can't do anything

pulsar hawk
#

Oh there’s not even a cli ?

gleaming topaz
#

Nothing happens when I type or move my mouse

#

Also the green LED isn't blinking

pulsar hawk
#

Yeah I don’t know try unplugging it then flashing it again if data gets messed up in the process

#

I’ve never seen that problem, sorry

gleaming topaz
#

At the top it says Internal error: Oops: 17 [#11] SMP ARM
Wtf

desert bloom
#

Do you have more than one kernel to choose from?

gleaming topaz
#

Installed the standard raspPi Debian (I think it's called that)

#

I now unplugged it.

#

I'll let it cool dow for a bit

#

Ok it booted regularly. No need to flash it

scarlet glen
#

Just added ubuntu to the new windows terminal but its pathed as "/mnt/c/Users" when I use it and I cant change drive. The git-bash changes drive with no problems as its not pwd'd as mnt/c and just c/.

dapper musk
#

well thats beacouse WSL is basicly virual mashine and there is no such thing as c/ a/ b/ etc in unix beacouse it uses mount system

#

and git-bash is just shell like cmd

olive ice
#

I hate wsl just use a gnu/Linux distro instead

dapper musk
#

you can't always do it for example on work computrer

scarlet glen
#

^thats right

#

I found that I can still path through my disks just differently thankfully, its path'd as mnt/DRIVE etc.

pastel kestrel
#

this chat is MEGA dead

lavish storm
#

Want to tell us a bit more?

pastel kestrel
#

mhm

pastel kestrel
grand sinew
#

genfstab -U /mnt >> /mnt/etc/fstab
say I wanted to execute this (unix like or whatever) command through python with subprocess.call, would i give ">>" as an arg?

vagrant fern
#

no

#

you'd open /mnt/etc/fstab as a file in append mode and give that to the subprocess stdout

#
with open('/mnt/etc/fstab', 'ab+') as fstab:
    subprocess.run(['genfstab', '-U', '/mnt'], stdout=fstab)

something like this

storm trellis
#

I have successfully launched a python script using "LXDE-PI" autostart function, however, this script needs to run as root in order to function correctly. How can I do this?

#

Where would I add "sudo"?

long dune
#

Any way to reboot a remote server via script without losing the current connection or disrupting the script?

main olive
tall bone
humble onyx
shy yokeBOT
#

Hey @rich kernel!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

rich kernel
#

On local machine, image works fine, but when I attempt to use same docker image in production I get the errors above.
Any tips?

short brook
#

Hello everyone:

I need some help with a small task.
i want to build a script which will be automatically executed at login to the server via ssh.
this script should accept only a few keywords which are basically {projectnames} and run the underneath laying tasks.
my Problem is that im uncappable of creating the SSH part... the script itself (which just rebuilds some docker containers) is already done.
i need a solution to provide both.. Linux Shell login via Putty or MobaXTerm or similar which gives you a python input inside the script and ssh command execution via Command line like

ssh user1@server1 projectname

glass remnant
#

i know linux bois

fallow blade
#

Hi guys do i really need to go into bios settings to fix the virtualization issue on my VIrtual machine?

glass remnant
#

Yes

#

you have to turn on virtualization from your bois

#

bios*

fallow blade
#

AFAIK it doesnt affect performance much right?

short brook
#

Got it working 😄

#

finally 😄

woeful dome
#

I'm missing memory in /sys/fs/cgroup/ -- what can I do to fix that?

#

Can I just do mkdir /sys/fs/cgroup/memory?

#

hm, no, I can't

opaque ginkgo
#

raspi?

woeful dome
humble onyx
# woeful dome Can I just do `mkdir /sys/fs/cgroup/memory`?
$ ls /sys/fs/cgroup/
cgroup.controllers             cgroup.subtree_control         cpu.stat                       io.cost.qos                    memory.stat                    sys-kernel-debug.mount/
cgroup.max.depth               cgroup.threads                 dev-hugepages.mount/           io.pressure                    -.mount/                       sys-kernel-tracing.mount/
cgroup.max.descendants         cpu.pressure                   dev-mqueue.mount/              io.stat                        proc-sys-fs-binfmt_misc.mount/ system.slice/
cgroup.procs                   cpuset.cpus.effective          init.scope/                    memory.numa_stat               sys-fs-fuse-connections.mount/ user.slice/
cgroup.stat                    cpuset.mems.effective          io.cost.model                  memory.pressure                sys-kernel-config.mount/       ```
#

it doesn't look like it is supposed to be directory

woeful dome
#

🤔

amber garnet
humble onyx
#

I ran it on a vm if that makes a difference

warped nimbus
#

Though I am not finding anything for that for arch or manjaro

#

You can check if the memory controller is even enabled with cat /proc/cgroups. It will probably show it as disabled.

woeful dome
warped nimbus
#

Does cgroup2 have it? Or is that not enabled for you?

#

I think arch started enabling it by default

#

Thought it may only enable one at a time

woeful dome
#

sorry, I'm a giant noob, as you might suspect

warped nimbus
#

If it was enabled, presumably /sys/fs/cgroup2 would be mounted

#

Well, maybe that's not true. It could be enabled at the kernel level but simply not mounted, perhaps.

#

I played around with this on my Arch system. It seems like it mounts cgroup2 only under /sys/fs/cgroup, but both v1 and v2 are enabled.

#

It shows cgroup2 mounted under /sys/fs/cgroup in /etc/mtab

#

And it shows both fs enabled in /proc/filesystems

#

Actually, if you look in /etc/mtab, what do you see for the cgroup entry?

#

This is what I have. You can see "memory" in there ```
cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0

#

Oh I misread it

#

Harder to read in my terminal. memory_recursiveprot is not related

#

So yeah if you check mtab you will see if it's using v1 or v2. v2 has a different structure, which is probably why you don't see memory anymore

woeful dome
#

I get cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0

#

alright, the reason I needed /sys/fs/cgroup is that that's the default location for nsjail's memory/CPU limiting stuff

warped nimbus
#

nsjail does support cgroup v2, but I only have experience using it with v1

#

IIRC there is a switch to enable v2 support

woeful dome
#

@warped nimbus Another question: is there any disadvantage in using rlimit_... on nsjail instead of cgroups, if I need to just limit RAM and CPU?

warped nimbus
#

I think the biggest difference is how it works for child processes

#

cgroup operates on groups of processes. From working on snekbox, I know that the limits set via cgroups are shared by all children. I don't think this is the case for rlimit

#

By shared, I mean that e.g. if you limit memory to 10 megabytes in a cgroup, then all processes in the cgroup can in total use 10 megabytes, where as with rlimit I think each process would get its own 10 megabytes.

woeful dome
#

oh

#

so I should 100% use cgroups

warped nimbus
#

Probably, cause I can at least confirm its behaviour.

#

I am not so sure for rlimit as I don't have as much experience with it

woeful dome
#

Can you recommend some place to read about cgroups?

warped nimbus
#

IIRC redhat had a good guide for them, but I believe it was for v1. I'll try to find it again

woeful dome
#

thanks, I'll check it out

warped nimbus
#

This is something I planned to read but never got around to it https://lwn.net/Articles/679786/

woeful dome
#

Hm, I enabled cgroups v2:

cgroup_mem_max: 53687091200
cgroup_mem_mount: "/sys/fs/cgroup/memory"

cgroup_pids_max: 1
cgroup_pids_mount: "/sys/fs/cgroup/pids"

use_cgroupv2: true

and I'm getting this error:

[E][2021-07-24T04:08:50+0300][5797] bool subproc::initParent(nsjconf_t*, pid_t, int)():392 Couldn't initialize cgroup 2 user namespace for pid=5804
[F][2021-07-24T04:08:50+0300][1] bool subproc::runChild(nsjconf_t*, int, int, int, int)():448 Launching child process failed
warped nimbus
#

I believe this is the issue where you need to create the cgroup manually before launching nsjail

#

nsjail doesn't do this for you because that'd require root

woeful dome
warped nimbus
#

That would be correct for v1, but not v2

#

v2 merges controllers into a single hierarchy, or something like that

#

You just need to mkdir /sys/fs/cgroup/NSJAIL

#

Cause the default cgroupv2_mount for nsjail is /sys/fs/cgroup and it appends NSJAIL to that

shy yokeBOT
#

cgroup2.cc lines 42 to 44

static std::string getCgroupPath(nsjconf_t *nsjconf, pid_t pid) {
	return nsjconf->cgroupv2_mount + "/NSJAIL." + std::to_string(pid);
}```
woeful dome
#

I tried running it again, still fails, but with a different error

[F][2021-07-24T04:19:18+0300][1] bool subproc::runChild(nsjconf_t*, int, int, int, int)():448 Launching child process failed
[E][2021-07-24T04:19:18+0300][6496] int nsjail::standaloneMode(nsjconf_t*)():256 Couldn't launch the child process
```,and now I have a few directories like

/NSJAIL.5960
/NSJAIL.5961
/NSJAIL.5962
...
```, on which I get Operation not permitted when deleting, even as root

warped nimbus
#

Oh I didn't notice the PID was not a child path

#

Try configuring cgroupv2_mount to a cgroup that you create beforehand

#

like cgroupv2_mount = "/sys/fs/cgroup/NSJAIL" and then it should be creating cgroups under it like /sys/fs/cgroup/NSJAIL/NSJAIL.42069

#

That's basically how it does it for v1.

woeful dome
# warped nimbus like `cgroupv2_mount = "/sys/fs/cgroup/NSJAIL"` and then it should be creating c...

Now I get

[E][2021-07-24T04:25:18+0300][7044] bool util::writeBufToFile(const char*, const void*, size_t, int)():100 Couldn't write '4' bytes to file '/sys/fs/cgroup/NSJAIL/NSJAIL.7050/cgroup.procs' (fd='6'): Permission denied
[E][2021-07-24T04:25:18+0300][7044] bool subproc::initParent(nsjconf_t*, pid_t, int)():392 Couldn't initialize cgroup 2 user namespace for pid=7050
[F][2021-07-24T04:25:18+0300][1] bool subproc::runChild(nsjconf_t*, int, int, int, int)():448 Launching child process failed
warped nimbus
#

Also use -v for verbose output for that error

woeful dome
#

will do

#

@warped nimbus lemon_ping

warped nimbus
#

The weird thing is that it has permission to create the cgroup, but not to write inside it

woeful dome
#

yeah, it actually creates those directories

warped nimbus
#

Are they still there?

#

Can you try to write to cgroup.procs?

#

"permission denied" might be a misleading error. It may not actually be a file permission thing but more of a "this operation isn't supported" thing

#

Which still wouldn't make much sense

woeful dome
#

file system is not full, I have 50 GB free

warped nimbus
#

I know that a permission error is given when trying to set memory swap limit but the kernel hasn't been configured for that, for example

#

What's the ownership/permissions of that file?

woeful dome
#

Access: (0644/-rw-r--r--) Uid: ( 1000/ df) Gid: ( 1000/ df)

warped nimbus
#

Also, you should try writing an actual number in there, it may reject input if it isn't an actual PID (or at least doesn't look like one)

woeful dome
#

but... I am the owner of the file, how can I be denied permission?

warped nimbus
#

Does it let you write with sudo?

woeful dome
warped nimbus
#

I'm not sure why

#

From kernel docs

Delegation

Model of Delegation


A cgroup can be delegated in two ways.  First, to a less privileged
user by granting write access of the directory and its "cgroup.procs",
"cgroup.threads" and "cgroup.subtree_control" files to the user.
Second, if the "nsdelegate" mount option is set, automatically to a
cgroup namespace on namespace creation.

Because the resource control interface files in a given directory
control the distribution of the parent's resources, the delegatee
shouldn't be allowed to write to them.  For the first method, this is
achieved by not granting access to these files.  For the second, the
kernel rejects writes to all files other than "cgroup.procs" and
"cgroup.subtree_control" on a namespace root from inside the
namespace.

The end results are equivalent for both delegation types.  Once
delegated, the user can build sub-hierarchy under the directory,
organize processes inside it as it sees fit and further distribute the
resources it received from the parent.  The limits and other settings
of all resource controllers are hierarchical and regardless of what
happens in the delegated sub-hierarchy, nothing can escape the
resource restrictions imposed by the parent.

Currently, cgroup doesn't impose any restrictions on the number of
cgroups in or nesting depth of a delegated sub-hierarchy; however,
this may be limited explicitly in the future.
#

Delegation Containment

A delegated sub-hierarchy is contained in the sense that processes
can't be moved into or out of the sub-hierarchy by the delegatee.

For delegations to a less privileged user, this is achieved by
requiring the following conditions for a process with a non-root euid
to migrate a target process into a cgroup by writing its PID to the
"cgroup.procs" file.

  • The writer must have write access to the "cgroup.procs" file.

  • The writer must have write access to the "cgroup.procs" file of the
    common ancestor of the source and destination cgroups.

The above two constraints ensure that while a delegatee may migrate
processes around freely in the delegated sub-hierarchy it can't pull
in from or push out to outside the sub-hierarchy.

For an example, let's assume cgroups C0 and C1 have been delegated to
user U0 who created C00, C01 under C0 and C10 under C1 as follows and
all processes under C0 and C1 belong to U0::

  ~~~~~~~~~~~~~ - C0 - C00
  ~ cgroup    ~      \ C01
  ~ hierarchy ~
  ~~~~~~~~~~~~~ - C1 - C10

Let's also say U0 wants to write the PID of a process which is
currently in C10 into "C00/cgroup.procs". U0 has write access to the
file; however, the common ancestor of the source cgroup C10 and the
destination cgroup C00 is above the points of delegation and U0 would
not have write access to its "cgroup.procs" files and thus the write
will be denied with -EACCES.

For delegations to namespaces, containment is achieved by requiring
that both the source and destination cgroups are reachable from the
namespace of the process which is attempting the migration. If either
is not reachable, the migration is rejected with -ENOENT.

#

I figured pasting here is more convenient since I cannot directly link to that section

woeful dome
#

oh

#

my user needs write access to /sys/fs/cgroup/cgroup.procs, right?

#

no, that can't be right

warped nimbus
#

If you chown those files then you chould be able to write to them, is what I get out of it.

#

I'm not sure if the containment section applies, since you're note dealing with adding a process that's already in another cgroup

woeful dome
#

I had done sudo chown -R df /sys/fs/cgroup/NSJAIL, all the files in there already belong to me

warped nimbus
#

Unless it counts a process being in the root cgroup

#

But that would seem very impractical

#

Honestly this is outside my knowledge at this point

woeful dome
#

I feel like this is so much over my head

#

maybe I should just pick a different project

warped nimbus
#

Maybe mounting cgroup v1 instead would make your life easier.

woeful dome
#

yeah 😄

#

I guess the issue is that an update switched my system to v2

warped nimbus
#

But everything I have read leads me to believe that what you're doing should work

#

I don't see why you cannot write if you own the files.

#

Maybe the "containment" section does play a role here after all. I don't know.

woeful dome
#

it's pretty confusing tbh

#

everything is a file, except some things don't behave as usual files at all

warped nimbus
#

Yeah they have extra semantics

main olive
#

Is there any distros best for prgramming compared to the others?

vagrant fern
#

no

#

the "best distro" will be the one you feel the most productive in

dark rivet
#

it will be manjaro though

arctic saffron
#

Ubuntu and Pop os have tools for ML to easily get your graphics card working with tensor flow, Kali Linux has tools for hacking and pen testing, if you want to develop IOS games you should get a Mac. It totally depends on what type of programming.

shrewd thicket
#

Imagine developing for apple

lavish kettle
#

how about what's the best disto to run jupyter notebook 24/7 bots on a raspberry pi 4?

#

trading bots (crypto/stock) & discord bots

#

raspbian seems like default choice

vagrant fern
#

raspbian is the most sane, yes

main olive
#

jupyter notebook is not a good fit for bots imo

#

It's better to have an api of sorts running on the raspi

#

And a frontend on a pc which gets the necessary info from this api

#

You can avoid unnecessary overhead and the bot will be more responsive

smoky harbor
#

Mint Linux

#

Is my favorite of all I've tried if your still looking give it a try with Cinnamon been using as daily driver for a few years

steep horizon
#

having an issue installing python3.9 on Rasbpian buster, read my message in #help-cupcake

lavish kettle
#

@main olive that makes sense. would flask be reasonable choice?
would learning docker be worthwhile for this?

main olive
#

At least not if you need to learn it

lavish kettle
#

that's very helpful. thank you. i'll start looking at fastAPI tutorials. was thinking about docker because there's a chance i'll have to deploy similar bots to different devices but doesn't seem like it'd be super necessary to start with

main olive
#

Yeah, first finalize the code itself before moving to containerize it

haughty burrow
#

Guys idk if the right lounge

#

but

#

I delete ubuntu partition on my windows and after extending the partiion

#

I was abouta go to the Prompt command to do the last command for the boot stuff

#

my pc got turned off

#

qfter viewing hella lot of YouTube videos

#

i was told to download windows 10 on a usb
aka bootable windows 10 usb

#

after that it led me to this

#

it's either install now
or repair your pc

#

what should i do

#

i want to keep my old files on my windows

dapper musk
#

so you have deletet ext4 partiton and you want data from it back?

haughty burrow
#

boot

dapper musk
#

ah you need to delete GRUB

#

you are on MBR?

haughty burrow
#

im' trying to execute the command
''
bootrec /rebuildbcd

#

its gives me this

#

basically means ''add the installation to the boot list ''more or less

#

it said
''the requested system device could not be found''

dapper musk
#

can you run diskpart

#

and list vol

#

and show me the output?

haughty burrow
#

@dapper musk

dapper musk
#

ok then run

#

bootrec /fixmbr

haughty burrow
#

hmm usually my old c had 322 why is E there

haughty burrow
dapper musk
#

and this will remove grub

dapper musk
haughty burrow
dapper musk
#

no outside it

haughty burrow
#

exit first then?

dapper musk
#

yes

#

ctrl-d, quit? or something like this

haughty burrow
#

Yes

#

it said

#

operation successful

#

(roughly translated)

dapper musk
#

great then just reboot

#

and it should work

haughty burrow
#

is it okqy to not write it ?

dapper musk
#

oh as far as im concerned you dont need it

haughty burrow
#

ooo okay then i shall exit now

#

i got these

dapper musk
#

after reboot?

haughty burrow
#

aaah i should just turn off the pc ?

dapper musk
#

yes

haughty burrow
#

i still haven't

#

ok

#

i will do it

#

got this xc

dapper musk
#

oh ok scan os is nesecary

#

eh go back to shell

#

and run fixboot

#

scanos

#

bootrec rebuit etc... also to make sure

#

and dont waste time

haughty burrow
haughty burrow
dapper musk
#

your's usb is still inside it?

haughty burrow
#

yds

#

yes

dapper musk
#

ohhh im stupid it was ment to run on windows booted

#

not on usb

#

so grub should be still there

#

f12 del etc

#

wathever will let you into bios

#

boot from ssd/harddrive

#

to windows and run commands on it

haughty burrow
#

f12 where do it type it ? inside bios ?

#

cuz rn i can only enter bios

#

grub rescue is gone

dapper musk
#

you use it to enter bios...

#

ah ok then

#

you should have

#

something like this

#

choose your disk

#

or just remove usb

haughty burrow
#

my bios is looking like this though

#

wait

#

letme redo it

dapper musk
#

you should have boot section here. anyways just remove usb from it

#

and reboot

#

it will be easier

haughty burrow
#

these are in the boot options

#

damn im panicking rn

dapper musk
#

eh anyways

dapper musk
#

just grub is still there

haughty burrow
dapper musk
haughty burrow
#

i removed it

dapper musk
#

reboot

#

and grub will show since im stupid

#

boot into windows

#

powershell/cmd as admin

haughty burrow
dapper musk
#

wtf. go into bios and check if all drives are listed

haughty burrow
# haughty burrow

according to the drives from this pic it seems like they are they aren't they?

dapper musk
#

ah

#

you had UEFI and i thought that mbr

#

but that is strange beacouse you did't had FAT32 prartiton

#

anyways switch into UEFI

haughty burrow
haughty burrow
dapper musk
#

it should f up pendrive

#

beacouse im stupid

#

but rest was't affected

haughty burrow
#

what does pendrive have

dapper musk
#

it had windows instaler

#

on it

haughty burrow
#

oh look

#

it took me back here

#

i entered the usb

#

wait

#

letme screnn it

#

this thingy

#

basically ere

haughty burrow
dapper musk
#

ok then go back to cmd

haughty burrow
#

im on cmd

#

its clean rn i better not f this up xD

#

diskpart right?

dapper musk
#

yes

#

list volumes

haughty burrow
dapper musk
#

*list vol

haughty burrow
#

yes look at it

#

oh bow the c has 322 Gb like it used to

#

now*

dapper musk
#

ok your windows should be MBR since it does not have 32

#

and fixmbr acctualy did something

#

bootsect /nt60 <drive name>: /mbr

haughty burrow
#

oh is it good or bad

dapper musk
#

replace drive name

#

with your windows drive

dapper musk
#

wait a s

#

to make sure that it is mbr

haughty burrow
#

yes im waitinf

dapper musk
#

list disk

#

it

#

if it does not have * here

haughty burrow
#

disk 0 doesnt

dapper musk
#

and it is your main disk?

haughty burrow
#

yes

#

1tera 300gb

dapper musk
#

ok select it

#

using select disk 0

haughty burrow
#

done

dapper musk
#

list volumes again it shoud show drive leters

#

inside disk 0

#

check what letter is assigned to main windows

haughty burrow
dapper musk
#

and use bootsect /nt60 letter /mbr

haughty burrow
dapper musk
#

it is not

#

it might be

haughty burrow
#

oh

#

how to confirm

dapper musk
#

do you remember sie

#

*size of your main drive?

haughty burrow
#

i remeber Files Being on C

#

322 gb

dapper musk
#

ok so well it is C

dapper musk
haughty burrow
#

i had only C and D

#

ny D didnt have anything important

dapper musk
#

*you saw C and D

haughty burrow
#

ah right

#

ill do that cmd

dapper musk
#

also maybe it is to late

#

but you should backup your drive

#

anyways

#

run command

haughty burrow
#

on diskpart or outside

dapper musk
#

outside

haughty burrow
#

weird

dapper musk
#

oh letter

#

you were ment to replace it

haughty burrow
#

ops

dapper musk
#

with C:

haughty burrow
#

C: Not only C ?

dapper musk
#

C:

haughty burrow
#

it says Its successful

dapper musk
#

ok then restart and try to boot into legacy mode

#

and hopefully it works

haughty burrow
#

just to make sure ill send a screen

#

nah not this

dapper musk
#

i dont understand french...

haughty burrow
#

not legacy stuff

dapper musk
#

your windows was in mbr aka legacy

#

so yes boot into legacy

haughty burrow
#

i shoudld remove usb forst ?

#

does it matter ?

dapper musk
#

if you are booting into legacy it does not

#

if into UEFI it will pioritetize your's USB

#

and boot into it

haughty burrow
#

it showed me this before

#

but anyways what shoudl i do now

#

ooh

#

i know of a way to fix this

#

brb

#

saw it on ytb i should enable legacy something

#

on bios 'boot options''

dapper musk
#

you should have this enabled but well worth trying

haughty burrow
#

Look at this

#

@dapper musk a video sqid i should write down the number shown qnd press enter

dapper musk
#

i never saw it and i think that it meant a key

#

but well type it

haughty burrow
dapper musk
#

ehh it should work. you can do it also other way

#

copy files into other drive

#

install windows

#

copy them again

haughty burrow
#

ia there a way to backup my current drives?

dapper musk
#

there is built in into windows but it sucks. clonezilla

#

is propably the best way

haughty burrow
#

xc

#

i really hope i didn't touch any data from the drives

#

tommorow is shoudl take my pc to fix it

dapper musk
#

ok good night

haughty burrow
#

gnitr

rich mortar
#

Anyone know how to merge 2 bin files into one on a mac?

dusty basalt
#

does anyone know what:
ar -p ifplugd_*_armhf.deb data.tar.xz | sudo tar -xJ -C / ./usr/sbin/ifplugd
of the last param for ./usr/sbin/ifplugd does?

#

I've been stuck at this for days, the base command works well for extracting the binaries from a package deb file and not installing it

#

but anything outside that breaks root (thankfully I'm doing this on an rpi)

formal schooner
#

@dusty basalt this is gnu tar, i assume? the man page says:

tar -x [-f ARCHIVE] [OPTIONS] [MEMBER...]

and

-x, --extract, --get
       Extract files from an archive.  Arguments are optional.  When given, they specify names of the archive members to be extracted.

so the ./usr/sbin/ifplugd argument means "extract only usr/sbin/ifplugd from the archive".

#

not 100% sure what you mean by "anything outside that breaks root", but note that -C means "extract files to /", so maybe you should be using -C ~/ifplugd-extract or otherwise something that isn't /, and then copying files to the right location afterwards

dusty basalt
#

@formal schooner I teased out the problem

dusty basalt
#

the second argument for tar actually allows you to specify a member of a archive, it wasn't immediately clear that ./usr/sbin.ifplugd refers to the file tree within the archive. One might think that it refers to the file destination path and this was the mistake I made

#

if you ran ar -p ifplugd_*_armhf.deb data.tar.xz | sudo tar -xJ -C /

#

this copies the archive files directly to root (bad), and causes all your binaries to be overwritten

#

I immediately lost access to sudo, ls, basically everything

#

I couldn't really debug what's wrong when I could not even navigate within the terminal anymore or shutdown ---- this is what I meant by breaking root

#

I tried writing to a test folder, like -c /home/user/test and it appended to any files within the folder

#

so I'm not exactly sure what damage is caused by ar -p ifplugd_*_armhf.deb data.tar.xz | sudo tar -xJ -C /

#

but it was very, very frustrating to learn around this because any small misstep would cause your distribution to break.

slender rapids
#

Hejhej, i dont want to ask a super easy question but i cant find the right thing to google right now.
I have Windows on my main partition (C) and Ubuntu on D. How can i make it so that i get to choose at the start of the pc what i want to use? at the moment i have to restart the pc everytime. Do i need to get into the bios every time i start my pc?

warped nimbus
slender rapids
tawdry fox
#

@slender rapids, may I ask what you're using Ubuntu for?

slender rapids
#

Also i like the idea of an open source product and would use it full time if i didnt like games so much 😅

warped nimbus
#

Well... Canonical (the company managing Ubuntu) is kinda bleh cause they bundled some Amazon app in one of the Ubuntu releases. Sure, that was almost a decade ago, but I have no reason to risk trusting them when there are so many other distros available.

tawdry fox
slender rapids
tawdry fox
#

Ohh I see, alright.

slender rapids
#

its probably just my incompetence tbh

long dune
#

Say I have a txt file like :
bobby
daniel
john
shortest bobby
mike
fred
taller bobby

And I want to grep for lines with"bobby" but want to exclude any bobby that is preceded (taller bobby etc). How would I do about doing that?

#

I am thinking this would be done with regex but I can't quite fathom doing it (perhaps with a negative lookbehind?)

vagrant fern
#

in plain Python i'd go with the best regex trick

#

which would bring you to something like \w+ bobby|(bobby)

#

in grep i would probably just pipe that to another grep -v ' bobby' to exclude lines where there's another word in front of it

vagrant fern
long dune
#

@vagrant fern wow thank you for the website, seems really useful.

#

I will try piping that to another grep

pseudo ether
#

I'm not sure if this belongs here. But I wrote a program for a not so tech savvy friend using tkinter. But the problem is that he runs Linux Mint on his old laptop and he isn't big on the terminal. So whats the best way to go about making a shortcut that will launch the program when he clicks on it?

warped nimbus
# pseudo ether I'm not sure if this belongs here. But I wrote a program for a not so tech savvy...

I don't know what desktop environment Mint uses, but a general idea I have is to make the file executable with chmod +x and add a shebang at the top. Maybe the DE will recognise that and respect the shebang. If not, maybe you'd have luck doing something similar, but with a shell script that does python3 yourscript.py. Otherwise, you can look up how to create actual shortcuts for whatever DE it uses.

pseudo ether
#

Ah, thanks. Thats what I figured. I was hoping to not have to use chmod. But I'm sure he'd be OK with one line in the terminal.

warped nimbus
#

Hopefully; it's a one-time thing.

formal schooner
formal schooner
#

it's not unlike the "create shortcut" functionality in windows

woven yarrow
#

Can someone recommend a way to redirect the output of a python service with systemd? I wanna do what python3 test.py >> output.log does but for a service

#

StandardOutput=append:/root/output.log didn't do anything

tawdry fox
#

You should be able to hijack stdout to a StringIO and do whatever you want.

woven yarrow
#

How?

#

I don't wanna modify the .py I just wanna redirect the output to a file like python3 test.py > output.log

formal schooner
#

or do you want to also write to a log file? like what tee might do

#

not sure why the StandardOutput=append:/foo option doesn't work

woven yarrow
formal schooner
#

what does your unit file look like? maybe you need StandardOutput=syslog although afaik that's the default

woven yarrow
#
[Unit]
Description=Python script as service test

[Service]
ExecStart=python3 /root/test_service.py
Restart=always

[Install]
WantedBy=multi-user.target
#

Am I missing something?

#

I've also had StandardOutput=append:/root/output.log in previously but didn't do anything other than creating the file

formal schooner
#

does the service emit logs to stdout or stderr?

woven yarrow
#

Uh, no idea to be honest, it just does prints, what does that do?

formal schooner
#

yes that should be stdout

woven yarrow
#
[Unit]
Description=Python script as service test

[Service]
ExecStart=python3 /root/test_service.py
StandardOutput=append:/root/output.log
StandardError=append:/root/error.log
Restart=always

[Install]
WantedBy=multi-user.target
#

It was like that

#

Both were created but stayed empty

#

All the script does is

#
from time import sleep

while True:

    print("Hello")
    sleep(1)
    print("Hello again")
    sleep(1)
#

It works with the > redirect but not as a service

formal schooner
#

huh

#

honestly no idea, maybe it's a buggy or outdated version of systemd?

woven yarrow
#

Hm idk it's a fresh install on GCP with their Ubuntu distro

formal schooner
#

do you see anything in journalctl from that service?

woven yarrow
#

Yes I see the starts and stops and restarts etc.

#

But not the prints

formal schooner
#

and i assume you're running this as root with the system-wide systemctl

#

as opposed to systemctl --user

#

or maybe systemctl --user but as root is more appropriate? hard to say

woven yarrow
#

I'm running every command as root yes

#

This is what the journalctl looks like

Jul 29 16:40:19 gcp-us-c1a-f1-micro-01 systemd[1]: test_service.service: Scheduled restart job, restart counte>
Jul 29 16:40:19 gcp-us-c1a-f1-micro-01 systemd[1]: Stopped Python script as service test.
Jul 29 16:40:19 gcp-us-c1a-f1-micro-01 systemd[1]: Started Python script as service test.
Jul 29 16:40:55 gcp-us-c1a-f1-micro-01 systemd[1]: Stopping Python script as service test...
Jul 29 16:40:55 gcp-us-c1a-f1-micro-01 systemd[1]: test_service.service: Succeeded.
Jul 29 16:40:55 gcp-us-c1a-f1-micro-01 systemd[1]: Stopped Python script as service test.
#

Looks correct just no print outputs

#

Which is what I want to redirect to a log file not these status updates btw

#
root@gcp-us-c1a-f1-micro-01:~# systemctl daemon-reload
root@gcp-us-c1a-f1-micro-01:~# systemctl start test_service
root@gcp-us-c1a-f1-micro-01:~# systemctl status test_service
● test_service.service - Python script as service test
     Loaded: loaded (/etc/systemd/system/test_service.service; disabled; vendor preset: enabled)
     Active: active (running) since Thu 2021-07-29 18:28:12 CEST; 2s ago
   Main PID: 102438 (python3)
      Tasks: 1 (limit: 677)
     Memory: 6.7M
     CGroup: /system.slice/test_service.service
             └─102438 /usr/bin/python3 /root/test_service.py

Jul 29 18:28:12 gcp-us-c1a-f1-micro-01 systemd[1]: Started Python script as service test.
root@gcp-us-c1a-f1-micro-01:~# l
Geekbench-5.4.0-Linux/        __pycache__/        distributor/  index/    output.log  snap/    test_service.py
Geekbench-5.4.0-Linux.tar.gz  dask-worker-space/  error.log     monitor/  proxy/      test.py
root@gcp-us-c1a-f1-micro-01:~# tail output.log 
root@gcp-us-c1a-f1-micro-01:~# 
#

(same with error.log)

#

Running systemd version 246

#

I figured it out

#

I had to add Environment=PYTHONUNBUFFERED=1

formal schooner
#

ah, that's a fun one

#

so python simply was never flushing the output buffer

#

good catch

woven yarrow
#

Completely unrelated to python but there's that one guy that saved me from a headache lol

formal schooner
#

no, this is a python specific thing for sure

woven yarrow
#

Yeah I know I meant the thread was not related to python

vagrant fern
#

PYTHONUNBUFFERED=1 was such an annoying gotcha for me. i wish python was doing that automatically if stdout wasn't a tty or something

woven yarrow
summer trail
woven yarrow
summer trail
#

Exactly the same thing.

#

It sets Python to unbuffered IO mode, but it only applies to that one run of Python, whereas the environment variable applies to every run of Python from the time you set it onward.

#

Which could, in theory, break something that expects its IO to be buffered.

woven yarrow
#

Ohh gotcha

summer trail
#

Granted it's unlikely to break anything, but I dislike global fixes to local problems

woven yarrow
#

Yup I agree, testing it now

#

Yeah works like a charm, thanks man

past sluice
#

hi how to log python print statement output in log file
i try this python3 /root/filedetect.py >> /var/log/filedetect.log 2>&1
but it log other info but not python print statements.
can someone help.

#

alright the answer is @summer trail -u

final echo
#

hallo

wise valve
#

@final echo can we continue here?

final echo
#

sure

wise valve
#

okay

#

so i look up some tutorials on how to use my linux?

final echo
final echo
wise valve
#

but u sure my pc specs dont suck?

wise valve
midnight rain
#

I recommend the Debian administrator handbook after you learn some basics

final echo
wise valve
final echo
midnight rain
#

maybe YouTube videos, on a top of basic commands

wise valve
#

okay

final echo
#

@wise valveyou know how to open terminal

wise valve
#

there is a terminal app right?

#

ik how to open that

final echo
#

ok nice

#

so ill show u how to update your system

wise valve
#

okay

final echo
#
sudo apt update && sudo apt update

run this command to update your system

basics

sudo = administrator
apt = ubuntu package manager (the thing where you can install stuff)
update = updating the things
upgrade = applying the update

#

&& = first do the command on left side then do the one on right

midnight rain
wise valve
#

kk im downloading

final echo
#

forgot to tell that

wise valve
#

it downloaded some stuf

#

and then said command 'sude' not found

midnight rain
#

sudo

wise valve
#

i typed sudo only

midnight rain
#

hmhmm

final echo
#

thats weird

midnight rain
#

Ubuntu comes with it

wise valve
#

should i send you a screen shot?

midnight rain
#

yes ofv

#

odc

#

ofc

final echo
#

type sudo and look if its like this

midnight rain
#

it exists

#

that's the help

wise valve
final echo
#

@wise valveyou typed sude at the second time

midnight rain
#

you wrote sude

wise valve
#

oh yea

midnight rain
#

it's sudo

wise valve
#

okay cool now it works

final echo
#

nice

wise valve
#

done

final echo
#

it might take some time

midnight rain
#

I think it's something like Superuser do

final echo
#

ok

final echo
#

@wise valvenow would you like to install vscode

midnight rain
#

ye but maybe like that he can remember better

wise valve
#

python is preinstalled right?

final echo
wise valve
#

okay

final echo