#unix

1 messages ยท Page 40 of 1

main olive
#

with -ef, the fourth column is C, which stands for cpu usage

#

the first is the PID

fickle granite
#

@restive helm your ps and grep command only found itself, not your bot ๐Ÿ™‚

main olive
#

aye, if you grep ps output, you will always match the grep you're grepping with unless you also do | grep -v grep

main olive
#

is someone here using openBSD?

#

how is it

#

i've used openbsd before

#

it's alright

#

the OS is pretty nicely integrated with itself

#

only reason I moved was because some things that I needed weren't compiling

urban merlin
#

@ebon wigeon Did you solve the issue?

ebon wigeon
#

I did, actually! Thank you so much for asking. I had pulled the 3.7src and compiled it then copied over my host machine's /usr/lib(64)/, and /usr/local/lib(64)/ and it worked!

urban merlin
#

Glad to hear that!

valid wasp
#

You know that scene in the oringinal Jurassic Park where the girl sits in front of a computer and excited says "This is unix! I know unix!"
Well I thought the interface was just another janky hollywood mockup. But I learned today that its an actual file explorer that was used with old Silicon Graphics machines. Its called FSN - file system navigator

#

and pronounced "Fusion"

lavish hemlock
#

Lol i accidently hacked myself

modern kestrel
#

command: ['sh', '-c', 'echo "Hello, Kubernetes!" && sleep 3600']

#

What does -c do?

main olive
#

specifies a command on the commandline (as opposed to stdin), this case echo && sleep

modern kestrel
#

Ah okay cool

#

I thought sh did that but i guess sh just shells you into the container

#

Thanks

main olive
#

it's a flag for sh

#

that entire command can be written as sh -c 'echo "Hello, Kubernetes!" && sleep 3600'

modern kestrel
#

okay so can you give me a stdin example?

main olive
#

echo 'echo "Hello, Kubernetes" && sleep 3600' | sh

#

running sh "whoami" without the -c flag would try to open a script file called whoami instead of running the command

modern kestrel
#

ah right okay i understand thanks

#

wait so

#

sh is like cd/

#

?

#

nvm

#

im just playing around in the terminal

#

and its listing folders for auto compelte with sh

main olive
#

well, you can also do sh directory/script.sh, that's fine

long pilot
#

hope it's the second one

#

it was at this point that he knew. he fucked up.

quaint mirage
#

MBR is fine, but it's legacy.

#

UEFI/GPT is what you should go for if your device supports it

long pilot
#

i am installing on an external SSD

quaint mirage
#

it's more to do with the device that boots

long pilot
#

it's mbr but the main disk is gpt

#

i am very lost and confused

quaint mirage
#

it's probably fine

long pilot
#

i used the second one

quaint mirage
#

should be fine. :)

long pilot
#

i'm like halfway into the installation already

#

and i am wondering how will the system boot

quaint mirage
#

probably just fine

long pilot
#

what do do incase if it won't?

quaint mirage
#

although, depending on device, you might have to flip on legacy mode in the BIOS

long pilot
#

where do i find it?

quaint mirage
#

varies from bios to bios.

long pilot
#

hm

quaint mirage
#

but usually under the boot menu

long pilot
#

i didn't really see anything there

#

maybe later

quaint mirage
#

might also be under the security tab

long pilot
#

incase i fuck up, do i just delete the partitions on the drive through windows, remove the boots and then rewrite iso to usb and start again? or more complicated?

quaint mirage
#

windows might not like a USB device with multiple partitions

#

so you might not be able to just re-format from explorer

long pilot
#

i dunno, everything is ok for me

quaint mirage
#

you'd have to use disk manager

long pilot
#

i use it all the time lol

quaint mirage
#

ah nice

#

yeah, just format all the shit and start over

long pilot
#

ok :D

#

one more thing

#

as i am currently in the tutorial at the part where the guy mounts his EFI partition (that i didn't create) do i just skip it?

#

@quaint mirage

quaint mirage
#

can't speak for that tutorial unfortunately

#

buuuut, seems like it

long pilot
#

LearnLinuxTV one

#

ok :D

#

thx

quaint mirage
#

all else fails, give it another go.

#

not like failure isn't an okay option here

#

since you can just start over.

long pilot
#

but wait

#

what do i do with grub

#

because i need it since my lil bro uses the pc and i need to know how to set up grub

quaint mirage
#

well if you're booting from an entirely different drive

#

it'll have its own bootloader etc

#

when you tell it to boot from that drive, it's going to ignore the installed drive

long pilot
#

ubuntu did well

#

it deteced both /dev/sdb1 (root) and /dev/sda2 (windows)

long pilot
#

found a tutorial on how to, gonna try mounting myself

main olive
#

Is it possible to configure some display setting or environment variables or collection of software so that while sshed into a machine, I could display content visually, either with software on the local or remote. If not, my scp/rsync familiarity makes it not too troublesome.

#

It seems to indicate that that might be possible when you try it.

#

@main olive X forwarding?

#

I'll look into what that is. X is the display software on Linux I think, but I only know that because Ive had to install it to get things to appear again on an occasion or two

#

Is the auth for this flakey?

#

not really?

#

Just checking.

#

it just requires xauth to be installed on the server

#

it all still happens over ssh

#

thanks i can probably get it working.

solid path
#

What's up guys so im trying to zip a folder in linux ubuntu I used python zipfile moudle and shutil also but they are copying the whole path so I give it something like this server/playlist/songs

#

and what I want it to do is just zip the songs folder but its zip all the path/dirc

main olive
#

Does someone have any idea how to enable desktop sound for screensharing in discord?

#
  • Ubuntu 20.04
main olive
#

@solid path do you need to do this with python or would a shell command be fine?

main olive
#

Does someone have any idea how to enable desktop sound for screensharing in discord?
@main olive im not sure but doesnt ubuntu gnome by default use wayland which has problems with apps like discord ? try switching to xorg and test if it works

solid path
#

@main olive I have to do it with python

valid wasp
#

does calling a shell script with python count as doing it with python ?

#

;p;

#

lol

#

I assume the songs have a common file extension. Then you can probably use a wildcard to target only the songs and

main olive
green iron
#

Hey

#

Can anyone help me fix this.

#

Error while updating ubuntu

green iron
#

Anyone?

#

๐Ÿ˜

main olive
#

when you run pip install on linux mint, are you installing to python 2 or 3

main olive
green iron
#

3

main olive
#

@main olive when in doubt, pip --version shows you the python version pip is coupled with

solid path
#

@main olive Thanks i know its late but it worked

timber dove
#

I was able to run a discord bot on my iphone.

main olive
#

jailbroken?

untold patrol
#

What the heck is going on here?

#

2nd time booting up my raspberry pi running Ubuntu 64 bit

valid wasp
#

Did you enable the PURPLE_SQUARE_ONBOOT option?

surreal vapor
#

!paste

shy yokeBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

digital haven
#

@old panther btw - here's the gsutil doc: https://cloud.google.com/storage/docs/gsutil/commands/rsync#be-careful-when-synchronizing-over-os-specific-file-types-symlinks,-devices,-etc .

the relevant part:

The gsutil rsync command copies changed files in their entirety and does not employ the rsync delta-transfer algorithm to transfer portions of a changed file. This is because cloud objects are immutable and no facility exists to read partial cloud object checksums or perform partial overwrites.

not sure if you're interested, this is just following your comment a while back re losing data with rsync

main olive
#

Did you enable the PURPLE_SQUARE_ONBOOT option?
@valid wasp he also seems to have enabled CURSORS=2

main olive
#

hi

#

I'm packaging my python script.. this time with a requirements.txt which I'm not familiar with
does this go in a shell script?

or does it suffice if I put it in the readme

#
#!/bin/bash
set -e
set -x

virtualenv -p python3 .
source ./bin/activate

pip install -r image_sequence/requirements.txt

# Example: 
# python -m image_sequence_augmentor --data_url=<url_with_file> --number=1234
main olive
#

it's generally best to leave it up to the users how they wish to install dependencies

#

you can also include a shell script which does setup for the user if you're expecting to be providing for users who might not be familiar with requirements.txt or pip

#

but you should indicate you've done that in the readme

main olive
#

what should I call this script then

#

like, what's the norm

#

setup.sh, maybe

#

thank you

halcyon garnet
#

anyone else having issues with pygame?

main olive
#

what sort of issues are you having @halcyon garnet?

halcyon garnet
#

I put in pip3 install pygame

#

and it returns ```
Collecting pygame
Using cached pygame-1.9.6.tar.gz (3.2 MB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zfwny4m0/pygame/setup.py'"'"'; file='"'"'/tmp/pip-install-zfwny4m0/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-zfwny4m0/pygame/pip-egg-info
cwd: /tmp/pip-install-zfwny4m0/pygame/
Complete output (12 lines):

WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using UNIX configuration...

/bin/sh: 1: sdl-config: not found
/bin/sh: 1: sdl-config: not found
/bin/sh: 1: sdl-config: not found

Hunting dependencies...
WARNING: "sdl-config" failed!
Unable to run "sdl-config". Please make sure a development version of SDL is installed.
----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

valid wasp
#

@valid wasp he also seems to have enabled CURSORS=2
@main olive Too right! I didnt notice that. I usually have a hard time when SCREEN_GLARE is set to 100

main olive
#

@halcyon garnet Unable to run "sdl-config". Please make sure a development version of SDL is installed.

#

do you have a development version of sdl installed

valid wasp
#

Matte screens seems the be the exception rather than the norm these days.

halcyon garnet
#

don't think so

#

is there a way to check?

main olive
#

what distro are you running?

#

@halcyon garnet

halcyon garnet
#

Ubuntu

#

20.04

#

that could be a problem but it shouldn't

#

sorry I should have tagged you @main olive

main olive
#

apt install sdl2-dev @halcyon garnet

#

?

halcyon garnet
#

E: Unable to locate package sdl2-devapt
E: Unable to locate package install
E: Unable to locate package sdl2-dev

#

@main olive

#

imma go to sleep

#

try to fix it in the morning

#

thanks for the help ๐Ÿ™‚

main olive
#

@halcyon garnet sudo apt install libghc-sdl2-dev maybe?

#

seems like they changed the package name for some reason

covert heart
#

Hi, any ideas why this happens?

$ source ./venv/bin/activate
bash: <venv path here>
export VIRTUAL_ENV

_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/bin:$PATH"
export PATH

# unset PYTHONHOME if set
if ! [ -z "${PYTHONHOME+_}" ] ; then
    _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
    unset PYTHONHOME
fi

if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
    _OLD_VIRTUAL_PS1="${PS1-}"
    if [ "x" != x ] ; then
        PS1="${PS1-}"
    else
        PS1="(`basename \"$VIRTUAL_ENV\"`) ${PS1-}"
    fi
    export PS1
fi

# Make sure to unalias pydoc if its: No such file or directory
main olive
#

what?

#

i have no idea what your problem is

#

@covert heart

#

also hi

covert heart
#

Hi:)

#

I've created a new virtual enviroment with:

virtualenv -p python3 venv
source venv/bin/activate

Now when I run

which pip
or
which pip3

I get /home/<user>/.local/bin/pip and not the pip of the virtualenv.

#
$ ls ./venv/bin/
activate       activate_this.py  easy_install-3.8  pip3.8     wheel
activate.csh   activate.xsh      pip               python     wheel3
activate.fish  easy_install      pip3              python3    wheel-3.8
activate.ps1   easy_install3     pip-3.8           python3.8
#

I think that the problem was with source ./venv/bin/activate
It's output was:

bash: <venv path here>
export VIRTUAL_ENV

_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/bin:$PATH"
export PATH

# unset PYTHONHOME if set
if ! [ -z "${PYTHONHOME+_}" ] ; then
    _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
    unset PYTHONHOME
fi

if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
    _OLD_VIRTUAL_PS1="${PS1-}"
    if [ "x" != x ] ; then
        PS1="${PS1-}"
    else
        PS1="(`basename \"$VIRTUAL_ENV\"`) ${PS1-}"
    fi
    export PS1
fi

# Make sure to unalias pydoc if its: No such file or directory
fickle granite
#

just run it like ./venv/bin/pip to be safe

#

source ./venv/bin/activate shouldn't produce any output at all iirc

#

I wonder if you've got source aliased or something

covert heart
#

after source ./venv/bin/activate
venv is not activated at all. (venv)$ is not displayed

fickle granite
#

yes I understood that part

#

you don't really need to "activate" your virtualenv. If you really want to you can just set PATH by hand; afaik that's all it really does

covert heart
#

Yes I know, I would just like it to work

fickle granite
#

try . instead of source

covert heart
#

Faster to type just pip :P

fickle granite
#

if that works better, it is further reason to suspect that you've modified the source command somehow

covert heart
#
$ source
bash: source: filename argument required
source: usage: source filename [arguments]
#

Haven't touched it

fickle granite
#

I don't see how that proves it

covert heart
#

maybe it's not working propertly in Ubuntu 20.04?

fickle granite
#

unlikely

#

I have ubuntu 20.04 too so (once it boots) I'll try it

#
:-) 2020-05-05T07:18:52-0700 [communal-pika tmp]$ virtualenv -p python3 venv
created virtual environment CPython3.8.2.final.0-64 in 680ms
  creator CPython3Posix(dest=/tmp/venv, clear=False, global=False)
  seeder FromAppData(download=False, retrying=latest, progress=latest, webencodings=latest, lockfile=latest, contextlib2=latest, urllib3=latest, chardet=latest, certifi=latest, html5lib=latest, pip=latest, distlib=latest, appdirs=latest, pkg_resources=latest, packaging=latest, ipaddr=latest, requests=latest, setuptools=latest, msgpack=latest, wheel=latest, colorama=latest, six=latest, pep517=latest, pytoml=latest, distro=latest, CacheControl=latest, idna=latest, pyparsing=latest, via=copy, app_data_dir=/home/ubuntu/.local/share/virtualenv/seed-app-data/v1.0.1.debian)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
:-) 2020-05-05T07:19:04-0700 [communal-pika tmp]$ source venv/bin/activate
(venv) :-) 2020-05-05T07:19:17-0700 [communal-pika tmp]$ type -a pip3
pip3 is /tmp/venv/bin/pip3
(venv) :-) 2020-05-05T07:19:25-0700 [communal-pika tmp]$ 
#

workx 4 me ๐Ÿ˜ฆ

#

try this, see if you get the same result: ```py
:-) 2020-05-05T07:25:02-0700 [communal-pika venv]$ dpkg -S /usr/bin/virtualenv
python3-virtualenv: /usr/bin/virtualenv

#

@covert heart this

covert heart
#

@fickle granite
dpkg-query: no path found matching pattern /usr/bin/virtualenv

#

It's installed here:

/home/<user>/.local/bin/virtualenv
fickle granite
#

maybe that's why

#

where'd that come from? I got mine via sudo apt-get install python3-virtualenv

covert heart
#

sudo pip3 install virtualenv

fickle granite
#

that doesn't seem crazy ๐Ÿ˜

#

although the usual advice is to never run sudo pip

#

I'm suprised that sudo pip installed something in your home directory

covert heart
#

Maybe it was without sudo

#

Im not sure

fickle granite
#

not sure you even need virtualenv, tbh; I always just use python3 -m venv

#

and that module comes with python3

covert heart
#

It acted the same with source

#

I tried it before

fickle granite
#

I'm out of ideas

covert heart
#

It's interesting that the output of source ./venv/bin/activate isn't the whole script

#

it's just a part of it

#

Just lines 50-72

fickle granite
#

try this ```py
-) 2020-05-05T07:38:39-0700 [communal-pika venv]$ head -1 bin/activate
This file must be used with "source bin/activate" from bash

#

I wonder if yours will mention a different shell

main olive
#

hi

#

when uploading to my github, vscode adds a .vscode folder.. do I need this

fickle granite
#

no

main olive
#

is there a way to disable this.. what do I do now.. delete it?

fickle granite
#

no keep it but put /.vscode in .gitignore

#

that way git won't constantly nag you about it

main olive
#

I need to add a gitignore now?

fickle granite
#

only if you don't want .vscode in your face all the time

covert heart
#

@fickle granite

$ head -1 ./venv/bin/activate
# This file must be used with "source bin/activate" *from bash*```
fickle granite
#

you could also put it in .git/info/exclude

main olive
#

where's that

fickle granite
#

@covert heart the mystery deepens

main olive
#

in local?

fickle granite
#

no idea what "in local" means

#

it's in .git/info, relative to the top of your git working tree

covert heart
#

@fickle granite
It says source bin/activate and I'm running source venv/bin/activate

fickle granite
#

I assume that's more or less a typo

#

source bin/activate would fail, if there's no file by that name

#

anyway I did source venv/bin/activate and it worked fine

main olive
#

is it /.vscode or .vscode/

fickle granite
#

that I'm not certain of. Whichever works.

#

it could even be /.vscode/ ๐Ÿ™‚

main olive
#

I did .vscode/*

covert heart
#

@fickle granite Thanks, switched to python3 -m venv and it's working now
I could swear that it didn't work before

fickle granite
#

that's the best way, since you know which flavor of python you're using

#

similarly with pip -- I never do pip install...; I only ever do python3 -m pip install

covert heart
#

@fickle granite why not pip3 install?

fickle granite
#

because you're never sure which pip3 you ran

#

@covert heart this

#

one of the most common problems beginners have in this discord is "I installed a module but python says it's not installed". it's always because they have multiple versions of python, and pip was from version A but they're running python from version B

main olive
#

hello

#

I am trying to use inline C in python and send data over a socket but it is only sending a dot

#

It's not correctly sending what I am telling it to send

#

and the length is correct of what it sends, only the string is not

sharp lion
#

Hi Guys, I am getting this when i click on the + button next to the chat input in discord app, I am using Manjaro as my OS.
Has anyone else faced this issue?

main olive
#

Maybe do :
pacaur -S unicode-character-database

#

i think it's precisly this command that worked before for me

halcyon garnet
#

@main olive it went through the whole setup thing but afaik it isn't showing up when I do pip list

#

Nevermind

#

amen

#

I got it to work

main olive
#

<@&267629731250176001> "ip logger"

lavish hemlock
#

git: 'good' is not a git command. See 'git --help'

trail grove
#

never heard of git good what's it do?

lavish hemlock
#

Is there a command where i can take an input and replace a specific or phrase character in a file with that input

#

let's say example.txt contains >

jade cairn
#

I think sed does that

main olive
#

a combination of sed and shell expansion, probably

lavish hemlock
#

okay

willow kayak
#

@lavish hemlock tr can also do this for characters but sed is the king here

fickle granite
#

sed is pretty hard to use; there might be an easier way, except I don't really understand what 70xpwn wants. Some examples would help

lavish hemlock
#

like editing a variable in a json file

#

let's say you have a discord bot, and the prefix is: !
I'm thinking of having an input that would for example say What new prefix would you like to use:

#

And replace that

#

@fickle granite :)

fickle granite
#

if you're editing JSON, you'd be nuts to use anything other than a proper JSON parser

#

jq might do that, but I'd write a 10-line python script to do it

lavish hemlock
#

ok

spice whale
#

Hello All, how is everyone tonight, WOOOOOOOO!

#

Who can and wants to teach me about system calls from statically typed languages?

main olive
#

what do you want to know?

spice whale
#

im curious as to how system calls register differently for x86 architecture versus 64 bit architecture obviously its a big field of study but a brief overview of salient points is a need for me ๐Ÿ˜„

#

thanks for the response by the way

spice whale
#

Also under the unix kernel is it the exact same as Linux or did they choose to modify the Unix kernel for the implementation of Linus' project i asume that Linux Is Identical to Unix but ive never been able to confirm it, Kernels are tricky business to edit and it can be dangerous if you ask my opinion.. I dont know manual system calls well enough for that rackateering gig.

#

๐Ÿ˜„ :{ ๐Ÿ˜›

agile blade
#

I'm trying to set up a python service

#

and am getting this error

#

string "type=AVC msg=audit(1588907701.722:20730): avc: denied { read } for pid=1 comm="systemd" name="muri-app.service" dev="vda1" ino=33599362 scontext=system_u:system_r:init_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=0

frank thunder
#

aight so this is the "noobest" question ive asked in a long time but ive recently switched to linux(ubuntu 20.04) completely and noticed that it was already running python3.8.2 and thats completely fine but i was wondering how to get a older version i usually used 3.8.0 so i looked it up and went ahead and installed it like so

wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
tar -xvf Python-3.8.0.tgz
./configure
make 

so all that is working fine if i run ./python in that folder i get python3.8 all is dandy BUT i was wondering if thats the way i need to be doing it and i just alias python in my zshrc to run ~/path-to-python3.8.0 another question is how can i get pip to work with that installation once i set up all the aliases and everything if thats how im meant to do it

sorry for dumb question been on windows for years and this is my first week and some change of linux

solemn grotto
#

its best to avoid that headache and use version management tool like pyenv

#

it will let you cleanly switch between python versions and everything it includes like pip, packages, etc

frank thunder
#

huh that looks really cool ill give it a try thanks

#

also looks like a LOT less hassle

main olive
#

or

solemn grotto
#

itd my goto when working on multiple projects

main olive
#

you could pass an alternate installation dir to ./configure, which is how most apps work, and btw make doesnt install anything unless you make install

main olive
#

Hi

#

can someone help me understand this

#

does cpu start from 0 index or 1

#

i have a 16 cpu instance and want to do some pinning

#

when I do grep CPUAffinity /etc/systemd/system.conf I get 1 2

#

and here on this page I find this:

#
CPUAffinity=0 1```
main olive
#

I ended up not setting affinity manually, but isolcpus with 5-15 range.. on 16 vcpu, since I couldnt figure it out

#

and it works, for what I needed to do.. just didn't get clarity on it

fresh saddle
#

Is there a standard Linux file that is just an EOF character?

main olive
#

EOF isn't a character, it's a signal

#

/dev/null signals EOF when you try to read it, though

fresh saddle
#

Ah that's cool, thanks

#

EOF have an associated character code, right, even it isn't saved into the file directly?

main olive
#

not really, no

#

not on UNIX systems really

fresh saddle
#

So that's a signal like SIGKILL, and whatever other thousand of signals Linux has?

main olive
#

no, it's not an IPC signal, probably a misphrasing on my part

#

it's more a... concept, than anything

fresh saddle
#

Okay gotta read up on that, it sounds interesting

main olive
#

like

#

you can't really "tell" a process about an EOF

#

the process comes to that conclusion itself when it can't read any more of the file

#

the exception is terminals, of course, as input from a terminal doesn't really ever "end" unless it's hung up

#

so there has to be a way to signal an "early" EOF

#

which is what ctrl-d does

fresh saddle
#

Okay I see

#

And so the process can conclude that it reached the end when it asks for 10 characters and only receive for 5 for instance?

main olive
#

usually processes rely on libc for that information

#

read() returns -1 once EOF is reached

frank coral
#

Hello, I'd like to add alias to starts python script more easily. Which file should I choose between ~/.bash_profile and ~/.bashrc? I don't really see the difference

main olive
#

use .bashrc

#

.bash_profile is used for when bash is used as a login shell, and that usually sources .bashrc in turn

#

so .bashrc will almost always be used

frank coral
#

ok, thanks!

steel verge
#

is there a meta package for complete compiler tools on Ubuntu/Debian?

#

something akin to apt install devel-tool which includes all the common stuff like make, automake etc

warped nimbus
#

The gcc package on debian already suggests make, gdb, etc

#

So you could install gcc with the flag to install suggested packages

lavish hemlock
#

Here's a challenge for you guys... make a live countdown timer, from 0-60 minutes, and display it in a digital like format

dim talon
#

How can I check if a systemd service exists in python and save the result as a true/false variable?

#

@steel verge check out build-essential

warped nimbus
#

Would using systemctl with subprocess be an option for you?

dim talon
#

how would that look?

cmd = '[ $(systemctl list-unit-files "firewalld*" | wc -l) -gt 3 ]'
result = subprocess.call([cmd], shell=True)

if result:
  firewall = "firewalld"

?

#

using subprocess calls rather than a weird library is definitely preferred, I'm just not sure how the syntax would work

warped nimbus
#

I suggest you only use the systemctl command and process its output in Python

#

I believe this will work

import subprocess
output = subprocess.check_output(["systemctl", "list-unit-files", "firewalld*"])
dim talon
#

So more like:

output = subprocess.check_output(["systemctl", "list-unit-files", "firewalld*"])

lines = len(output.split('\n'))

if lines => 3:
  firewall = "firewalld"

...lemme test that

warped nimbus
#

I forgot you need to add text=True otherwise the output will be in bytes

dim talon
#

kk thx

#
>>> output = subprocess.check_output(["systemctl", "list-unit-files", "firewalld*"], text=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/subprocess.py", line 216, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'text'
warped nimbus
#

oh

#

py 2.7

#

Can you use python 3?

dim talon
#

sure

warped nimbus
#

So text is for Python 3.7+

dim talon
#

much better

warped nimbus
#

For older versions use universal_newlines

dim talon
#

kk

#

thx for the help, I think this works

warped nimbus
#

You're welcome

lavish hemlock
#

How do i remove google-authenticator for 1 specific user

#

linux ssh

main olive
#

@dim talon I recommend using the return code instead of trying to parse the output

#

less chances of it breaking

tawdry sonnet
#

I'm running windows, and I have a spare partition that I don't use. I'd like to get comfortable on a unix system, my only experience anything related to it has been using gitbash and a bit of FreeNas.

I know ubuntu is very popular, but any flavour in particular that would be best for development?

main olive
#

more or less all of them are fine for development, but you'll perhaps find more guides for Ubuntu than any other distro@tawdry sonnet

cinder wren
#

does this channel have to be about unix + python? can i ask about vnc here?

main olive
#

sure, shoot @cinder wren

cinder wren
#

okay, so my vnc server keeps crashing, ive tried all 3 vnc viewers that i can find... realvnc viewer, tightvncviewer, tigervncviewer, but after 25 minutes my server always shuts down... i cant figure out why

#

i keep getting the error com.tigervnc.rdr.SystemException: read:com.tigervnc.rdr.Exception: newPosition < 0: (-1 < 0)

#

but i really dont know why this is happening, feel free to ask me questions

#

its fairly constistent at the 25 minute mark though 24.5-29 minutes

#

ive set my ufw to allow 10.0.0.0/24 on the vncserver port

#

and i am using the option -localhost no

#

ima try this for another half n hour and see if it changes anything...
tigervncserver -geometry 814x532 :2 -localhost yes -verbose -cleanstale -clean

cinder wren
#

welp, seems 1 of those commands solved the problem

#

rofl... as soon as i said that...

#

the timing..wow

#

KeepAliveResponseTimeout seems interesting

main olive
#

that's odd

#

seems like a bug in tigervnc

#

@cinder wren maybe try another vnc server?

#

think I've used RealVNC server mode, which has been alright

#

or even x11vnc

#

which I've successfully used on very low-resource machines, like a Kindle

cinder wren
#

@main olive can i use a single window with x11vnc server?

exotic sun
#

Iโ€™m trying to create a environmental variable in my raspberry pi, but I canโ€™t create one for some reason

cinder wren
#

keep getting a bad argv0 when trying to run realvnc server ๐Ÿ˜•

vital spire
#

Iโ€™m trying to create a environmental variable in my raspberry pi, but I canโ€™t create one for some reason
@exotic sun What's the issue? Why can't you create one? How do you know?

main olive
#

thats a lot of questions asked

#

should've asked which OS is he running on raspberry pi for starters

vital spire
#

Why would that matter for an environment variable?

main olive
#

environment variables are set in completely different ways depending on operating system

#

and used also

#

in windows it's echo %MYVAR% whereas in linux's bash it's echo $MYVAR

vital spire
#

I'd assume he uses a Linux distro on a Rasperry Pi

exotic sun
#

Sorry for the late response. Iโ€™m running NOOBs or whatever the default 3b+ is. Doing echo works now, but Iโ€™m struggling to call it for my python program. I tried dotenv but itโ€™s sayingvscode not found.

fleet forum
#

hello!

#

ive made my secondary hdd dual boot into linux and given i dont use it, can anyone help me format it?

fickle granite
#

@fleet forum I think you want mkfs

#

Can't remember how to use it, but maybe the man page will tell you how

fleet forum
#

Oh I forgot to make an update

#

I managed to chance the particions via windows and just formatted it clean

#

Thanks though man

vital spire
#

Sorry for the late response. Iโ€™m running NOOBs or whatever the default 3b+ is. Doing echo works now, but Iโ€™m struggling to call it for my python program. I tried dotenv but itโ€™s sayingvscode not found.
@exotic sun The usual issues with environment variables is that they only last for the current shell session. Either try setting them in your .bashrc or make sure the python program runs in the same shell in which you set the environment variable, e.g. by running it like this $ MY_ENV='12345' python test.py.

main olive
#

also, something to note

#

you need to actually export the variable if you want child processes launched from a shell to also inherit it

cinder wren
#

@main olive hey r u able to tell me when im getting a bad argv0 with realvnc?

main olive
#

"bad argv0" indicates that it's not being run with the name it expects

cinder wren
#

wdym

#

desktop name?

#

and about the error, tbh i dont think its the vnc server, i think its my python program that i wrote

#

(the other error i was encountering where it fails after 25-31 mins)

#

still havent found out why, but eventually i will

vital spire
#

you need to actually export the variable if you want child processes launched from a shell to also inherit it
@main olive Didn't know about that, thanks!

main olive
#

desktop name?
@cinder wren nah, argv[0] is supposed to contain the name of the program being executed. there are certain scenarios where this isn't the case (for example when using the exec() call) - some programs are fine with this and don't whether the contents of argv[0] make sense or not, but others do require it to be the same as the name of the binary (for example "realvnc" for /usr/bin/realvnc etc)

exotic sun
#

Oh. So I export the variables then open the python file through the command shell and not just run it in the program?

main olive
#

well, environment variables are always inherited from a process' parent process, all the way up to the "init" process

#

if you run a process via a terminal emulator, the process inherits the terminal's environment variables

#

so, if you do something like:

$ export VALUE=12345
$ code

the launched vscode process will have the environment variable VALUE set to 12345

#

(alternate methods of doing the same thing:

$ VALUE=12345
$ export VALUE
$ code

or

$ VALUE=12345 code

)

exotic sun
#

Ah.

exotic sun
#

And that didnโ€™t work. Iโ€™m doing everythi g the way Iโ€™m supposed to and I keep getting different errors and Iโ€™m about to smash my Pi. It shouldnโ€™t take me over 3 days to program a simple program to send a text everyday

wintry compass
#

im prettymuch new to bash as it is homework im not looking for a complete script but rather someone to help me get started is anyone able to help me write a bash script that reads an integer and determines how many of each coin should be given in cents using the fewest possible coins that loops until the user types Ctrl+D

fickle granite
#

heh

#

that's a tough enough problem in python, but having to do it in bash? ugh

#

so you have my sympathy, but I can't help

wintry compass
#

yeah its pretty rough especially since im just starting out im decent at python but horrible at bash so its gonna be a challenge

livid charm
#

Iโ€™m trying to get sound to run in my python script on Linux.
I tired playsound and that didnโ€™t work
Iโ€™m try the os module out a bit
Iโ€™m looking into pydub rn
Any suggestions?

exotic sun
#

I GOT My code to work without having to save my sensitive information into the code

fickle granite
#

x l n t

cinder wren
#

@main olive so it doesn't like the name/symbolic link that I have for vncserver instead I should use the /opt/vncserver/idk.sh
Also still haven't found the cause of the crash. Going to try and not use vncdotool and see if that's the problem or if something is misconfugured on the vncserver
However having troubles using an alternate display with xdotool...so

#

Will probs try later today or tomorrow

main olive
#

hi there can someone help me on ubuntu?

night fossil
#

just ask

#

the more info you give on your question problem right away the higher is a chance to get help

#

!ask

shy yokeBOT
#

Asking good questions will yield a much higher chance of a quick response:

โ€ข Don't ask to ask your question, just go ahead and tell us your problem.
โ€ข Don't ask if anyone is knowledgeable in some area, filtering serves no purpose.
โ€ข Try to solve the problem on your own first, we're not going to write code for you.
โ€ข Show us the code you've tried and any errors or unexpected results it's giving.
โ€ข Be patient while we're helping you.

You can find a much more detailed explanation on our website.

main olive
#

iam a noob in ubuntu i installed it yesterday, i want to get to know it better, i watched some begginers guides and started with some easy codes like sudo apt-get , i need to know if its safe those clouds on settings that i can connect my accounts

shy yokeBOT
#

Hey @main olive!

It looks like you tried to attach file type(s) that we do not allow (). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .m4v, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .svg, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg.

Feel free to ask in #community-meta if you think this is a mistake.

night fossil
#

i need to know if its safe those clouds on settings that i can connect my accounts
@heady adderI am not sure what you mean by this

main olive
#

can you speak chinese

cinder wren
#

there any way to start an application with x11vnc (or another vnc) and just share the application/window without having to start one prior to x11vnc and then use x11vnc on top of the other vnc?

#

similar to remoteapp in windows

main olive
#

wat

#

you use x11vnc as an x server

#

which means that instead of running xorg, you run x11vnc - the X application running in x11vnc after that isn't really relevant, any would work

#

oh, wait no, i'm thinking of another project

#

x11vnc does require an X server to already be running

#

my bad

raven tiger
#

I have a python script that I want to execute but I don't want it to exit to the shell but rather leave the current variables in place and exit to an ipython interpreter. Does anyone know how to do this or if its possible? (beyond the obvious of using jupyter)

fickle granite
#

well, python3 -i your-script.py does what you want, apart from the ipython bit.

#

ipython -i might do the same

#

yep, it works

surreal vapor
#

Would it be possible/practical to automate Linux setups/deployments with Python

#

Or is that more likely to a be a bash-only thing

main olive
#

@surreal vapor ansible does that, and is mostly python

#

might be interested in that project

raven tiger
#

Thanks! @fickle granite

exotic sun
#

Should all my python set ups be in different directories? Because on my Pi I always get โ€œmodule not foundโ€ or โ€œdirectory not foundโ€ or some other bs.

willow kayak
#

@exotic sun use some kind of Python virtualenv manager, I personally like pipenv. Then you can have project / directory specific Python environments and libraries and one global installation for your personal use

surreal vapor
#

@main olive when it says it's written in Python, Powershell, Shell and Ruby, is it referencing bash? Or ksh or csh?

main olive
#

i need somehelp starting openvpn server

#

can someone help me debug this

main olive
#

@surreal vapor poorly worded, that can mean anything

#

most of the time, they mean sh/bash

#

but not always

#

@main olive check the logfile, the path is visible in your screenshot

#

the log file doesnt exist

#

....

nimble gale
#

I have a serious problem in Ubuntu, a wrong version of pyqt5 has apparently been installed which now breaks Spyder3 from running, I want to restore original pyqt5, does anyone know how to do this?

steel verge
nimble gale
#

Is it dangerous to try to change PyQt5 back again? wish I never messed with things

#

If would help if I knew what the DEFAULT verion of PyQt5 was when Ubuntu installed Spyder3 ๐Ÿ™‚ Anyone know reliably?

vital spire
#

@nimble gale It's not dangerous changing back.

main olive
#

Hi guys, is there any of you using ZSH ? I am trying to change to a "YS" theme but I can't. I can be more specific on my question but I am not sure this is the right place as I am new to linux, new to python and even new to discord.
Thank you

#

where can I learn more about GUI events?

#

and very simple

#

not some very hefty complex source

sudden wigeon
#

@main olive , would you like to show me your ~/.zshrc and whethere you use oh-my-zsh framework or not ๐Ÿ™‚ ??

digital haven
#
gfind . -type f -regex '.*csv|.*txt'

not too sure why this isn't matching csv or txt files?

#

(gfind is just find on osx)

summer trail
#

@digital haven - needs to be \|

digital haven
#

@summer trail ah, thanks... is there anyway to make them assume i'm writing regular expressions as default?

summer trail
#

or find . -type f -regextype posix-extended -regex '.*csv|.*txt'

#

it's not that it didn't think you were writing a regular expression, it's that there are a ton of dialects of regular expressions, and some use | for alternation and others use \|

#

by default find uses emacs-style regular expressions, where alternation is \|

digital haven
#

hrm ok thanks - guess i'll have to set an alias as it's quite a long command

dreamy wing
#

Can anyone suggest a cli script to pretty print / read apache log files. Tail is too disgusting to look at. **Have found Pimp My Logs which does exactly what I want

main olive
#

@dreamy wing for simple colour coding i've also used ccze with relative success

sudden wigeon
#

@dreamy wing bat ( https://github.com/sharkdp/bat ) could be a nice option for you, check it out

GitHub

A cat(1) clone with wings. Contribute to sharkdp/bat development by creating an account on GitHub.

digital haven
#

Where does one typically store JSON keys?

#

i have a package that requires json keys, and I'm not really sure where I should put them... I guess I need to pass the key path in as a value to the package now i think about it

fickle granite
#

what is a "JSON key"?

#

@digital haven this

digital haven
#

@fickle granite just a api key in a json file

#

probably not a helpful way to refer to it

fickle granite
#

it's secret, right?

digital haven
#

it is yeah

#

in that it shouldn't be committed at least

fickle granite
#

I'd keep it in a file and add the file's name to .gitignore

#

you can use a package called "dotenv" to export the file's contents into the environment, which is sometimes convenient

#

that's recommended by the "how to write a discord bot" thing that I read

digital haven
#

right... i used dotenv once a while back ago actually but never bothered continuing for some reason

#

i think i need to pass the keys in to the package though ๐Ÿค”

#

idk, i'm tired now ha... i'll look at this later

frank thunder
#

i have a quick question for anyone who knows can someone explain to me what the priority argument in update-alternitives means (using ubuntu 20.04) ive got everything working with it but im not ever sure what to put for that priority argument so i usually end up putting 1 or 2

magic bolt
#

hello i'm trying to create a simple systemd file that keeps ngrep running in the background and captures to a pcap file I seem to be able to get it up and running but the pcap file doesn't ever get created. I made a script just to automatically check on status of the service and this is the output

#

any help is appreciated ๐Ÿ™‚

hot prism
#

@magic bolt post some code please

main olive
#

you know those flags.. x v z f c

#

is there a reason why they're those letters.. I'm having a hard time remembering flags for some commands

fickle granite
#

hysterical raisins

#

x is short for "eXtract"

#

v is "verbose"

#

z I guess is meant to suggest "zip"

#

f is file

#

I forget what c even does ๐Ÿ™‚

#

there are long versions of those options too

main olive
#

long version?

#

you mean the one's you pass with -- ?

fickle granite
#

ya

main olive
#

I know what commands I usually use but can't recall the flags.. feel bad

summer trail
#

tar has some of the weirdest flags of an Unix command. But yeah, what @fickle granite said, and c is create.

fickle granite
#

oh yeah

#

which I never do any more ๐Ÿ™‚

#

well perhaps sometime in the last few years I've typed tar cf - . | (cd somewhere-else ; tar xf - )

summer trail
#

tar, ps, find, and dd are probably the weirdest ones - they're weird through accidents of history; they came from different systems with different argument conventions than modern GNU systems have, and original flags were retained.

fickle granite
#

just like the really short English words -- "be", "for", &c

#

they're so common that it'd be disruptive to make them regular

frank thunder
#

i have a quick question for anyone who knows can someone explain to me what the priority argument in update-alternitives means (using ubuntu 20.04) ive got everything working with it but im not ever sure what to put for that priority argument so i usually end up putting 1 or 2

edit(bumbing this question up because it got coverd)

fickle granite
#

I think it determines which program gets used -- like if you have both nano and vim, the priority determines which one gets run when you type vi. I think.

#

if you have exactly one of them, then it gets used

frank thunder
#

what would happen if i had multiple fo example 5 different things all priority 1 would it just pick one at random?

#

or should i have different prioritys for everything

summer trail
#

Priorities are assigned by package creators. The alternative with the highest priority determines the default value when in automatic mode. Additionally the local administrator may override the automatic selection with a manual selection.

frank thunder
#

awesome ill read thru them also do you just have these links on hand? or have people asked similar questions to you

summer trail
#

I just googled, and knew to put "debian" in the search to find the right thing.

main olive
#

how do I know what type of file my file is

#

I tried file <filename> but it doesn't work

#

nvm.. stat worked

#

file works 90% of the time for me

#

I'm on debian, it says command not found.. apparently I had to install it

copper turtle
#

Hello i cannot open my dbshell from django

#

im on my ubuntu

#
python manage.py dbshell```
#

it shows this error

#
CommandError: You appear not to have the 'sqlite3' program installed or on your path.
#

how do i solve this ???? check stackOverflow ,,,couldnt find anythong

main olive
#

you don't have sqlite3 installed, like it says

#

try apt install sqlite3

#

(with sudo)

copper turtle
#

try apt install sqlite3
@main olive tried already

#

i have the sqlite cli installed

#

It still doesn't work

copper turtle
#
which sqlite3

@valid wasp shows no output

#

okay sorry it shows output

#

/usr/bin/sqlite3

sly bridge
#

Is there a reason systemctl thinks my python script exits with a clean code when I run exit(1)? Specifically, I'm running a discord.py bot in an event loop.

main olive
#

can you try pasting echo $? in bash right after the script is executed

sly bridge
#

Oh, I see. It looks like a cleanup function is causing the program to exit with status 0, before I even reach the exit statement.

main olive
#

yup

chrome shale
#

Greetings

#

Bye Bye

main olive
#

@chrome shale just go ahead and ask a question right away

warped badge
#

hey there, is there anyone here who wants to help a complete linux python noob out?

main olive
#

sure

#

what issue are you having?

warped badge
#

so i recently got a linux based VPS (i want to use it to host a discord.py bot, there's no issues with that as the bot works pefectly in a windows envoirment on my own pc)

#

and well it comes about as empty as you want it, so i tried installing python 3.8.3 (latest) and pip, whilst it gives sucess it spits errors all around

#

it's running debian 8 jessie froxlor

#

i have some other picks if i want to (or custom installs) but this is the default and i guess should be fine?

#

@main olive you have any idea? maybe I could try completely deleting everything if you want to help me get a correct install

main olive
#

how did you install python and pip?

#

and what distro is this specifically?

#

ah, missed that message, debian jessie

warped badge
#

only then with the 3.8.3 instead of 3.8.2

main olive
#

you shouldn't really be doing that

warped badge
#

if i do python3.8 -V i get Python 3.8.3

#

i'm a complete noob at linux so yeah i will do things that will make you go smh

main olive
#

i forget if jessie ships with python3 or not - if it does, skip step 1:

  1. install python 3 from debian repos, ie sudo apt install python3 or whatever the package name is
  2. use pyenv to install 3.8.3
#

this will keep the system install stable (OS internals might rely on a specific python version), but allows you to use whatever version for your project with pyenv

warped badge
main olive
#

do a force reinstall with apt

#

of python3 and python3-pip

warped badge
#

so that would be sudo apt reinstall python3?

main olive
#

i think it's apt --reinstall install python3 python3-pip

warped badge
#

there it goes

main olive
warped badge
#

so yeah that's my experience so far

#

.pyenv did appear in my FTP

main olive
#

have you done exec $SHELL like the readme tells you to?

warped badge
#

yes

main olive
#

did you read the warning?

warped badge
#

uuhh not exactly

#

but idk what that means

#

i'm a total linux noob

main olive
#

add those three lines to your ~/.bashrc file, like it says

warped badge
#

and how would i do that?

#

like that's my level rn

main olive
#

nano ~/.bashrc

#

and then ctrl-x to exit

#

and y to save when it asks you to

warped badge
#

okay so i should type nano ~/.bashrc PATH="/root/.pyenv/bin:$PATH"?

main olive
#

no, nano is just a text editor

#

you just open the file up with the editor and paste those three lines in

#

preferably at the bottom

warped badge
#

ah

#

i did that

main olive
#

yeah, then do exec $SHELL again to reload the rcfile

warped badge
#

ah it works!

#

haha

#

okay so now i have pyenv

#

what would be the next step?

#

@main olive ?

main olive
#

pyenv install -v 3.8.3

#

and pyenv local 3.8.3 while in your project's directory

#

also... you really shouldn't be doing all of this as root

warped badge
#

afaik the only login to my vps i have is root

#

unless i make a new account

main olive
#

i mean... you're root

#

you can add accounts

#

:)

warped badge
#

what is the downside of doing everything as root?

main olive
#

it's easy to accidentally fuck up your entire system, and it's insecure

warped badge
#

the fuck ups i can get over with and understand, but why insecure?

main olive
#

it's the same as running everything as admin on windows, except even more powerful

#

so, let's say you run your bot or whatever project

warped badge
#

yes

main olive
#

and your bot has some sort of vulnerability

warped badge
#

and that means they would be able to access the entire VPS pretty much?

main olive
#

install openssl-dev or whatever the apt package name is for debian

warped badge
#

trying again

main olive
#

it's good to read the output of the commands you run :)

#

it may seem like mumbo jumbo at times but there's generally useful info in there

warped badge
#

i just read true their github with common issues and they also said to verify make was there

#

so i did that just to be sure

main olive
#

can you post the section that says "last 10 log lines"?

#

that should say what went wrong

warped badge
main olive
#

that's... odd

warped badge
#

Maybe it's just debian being weird?

#

I could completely wipe and start over with a fresh new image and even with a different distro

#

the distro is no matter for me as long as it runs python and the requirements for a bot

main olive
#

i generally suggest ubuntu server

#

debian is also good, but ubuntu is more beginner-friendly

warped badge
#

any linux image is possible reall, these are the officially supported ones

main olive
#

20.04 lts is the latest stable release

warped badge
#

and then minimal i guess

#

since that's the only one

main olive
#

sure

#

i'm guessing "minimal" means "vanilla with no extra fluff"

warped badge
#

it's installing ubuntu now, and everything will be gone

main olive
#

rip

#

first thing you should do is add another user

#

and do everything as that user

warped badge
#

@main olive i'm in and made a non root account

#

lets see first updates

#

doing pyenv now

#

@main olive it did pyenv without error!

#

HAHA IT WORKS

#

@main olive THANK YOU SOO MUCh

main olive
#

hey i am new for here. I would like to say. because pip3 install PyInstaller works fine under Ubuntu 20.04

radiant pike
#

So, I'm trying to edit what's supposed to be a .cfg file on an SD card I have (bootable on an Rpi) but ~90% of the drive is just a file called SYSTEM with no extension. There's also a file SYSTEM.md5, but there's no .cfg file anywhere. Only dtb files, which I understand are for the hardware, and some other files like cmdline.txt or simmilar

I tried renaming the file to SYSTEM.zip, but it doesn't open
I tried editing the file in VIM (it's waay to big for Notepad++ or default Notepad) and also changing the md5 checksum in SYSTEM.md5, but after doing so the Pi refuses to mount the system file. I've been able to roll back to the old files to get it to mount again, but I'm still stuck needing to edit this .cfg file.
Google's been useless as any search with both SYSTEM and file in it gives results about Windows .sys files

I need to edit a .cfg file that's buried in a file called SYSTEM, but have no idea how to get into this SYSTEM file. Can anyone help with this?

#

I'm not even sure if this is a good place to ask this. If not let me know

valid wasp
#

what does "file ./SYSTEM" return?

#

like this:

โžœ  ~ file foo.py 
foo.py: ASCII text

#

is that for a raspberry pi?

radiant pike
#

Yep

#

THis file's huge

valid wasp
#

I mean, vim should open anything

radiant pike
#

I accidentially ran cat on it in the pi when it was in debug mode

valid wasp
#

but Ive not used pi before maybe constrained by small mempory

radiant pike
#

In utf-8 it shows this

#

I'm on win10 trying to fix a RetroArch install

#

by editing files on the SD card

valid wasp
#

where did you get the SYSTEM file from?

radiant pike
#

This is a card that someone else asked someone else to make for them, so I'm going without information from the original install

#

Here's a ss from VIM

#

I tried editing that input_driver part

valid wasp
#

do you have any unix tools on your WIN10?

#

like the linux subsystem

radiant pike
#

I have another win10 that has WSL on it

#

if needed

valid wasp
#

you should be able to run strings on the SYSTEM file even if its a binary

radiant pike
#

also I have a separate rpi card that boots Raspbian fine

#

What do you mean run strings on the SYSTEM file? I've already tried to edit that text and the associated MD5 hash and it refused to boot

valid wasp
#

just to see if you can find anything useful since you cant open the whole thing

#

strings will pull out the strings in the binary

#

let you look thru them

#

"strings" is a command to show the strings in any file

radiant pike
#

Ah alright

valid wasp
#

unix only though, perhaps your WSL will hav eit

radiant pike
#

loading that up now

valid wasp
#

can you just nuke the SD card and do a clean retro arch install?

radiant pike
#

There's data on the current install also buried in the SYSTEM file

#

'd be nice to not lose it

#

Retroarch boots fine right now, the issue is that I changed the input drivers and now I can't get any keyboards or controllers working

valid wasp
#

hrmm. I see.
have you tried to run gzip on it to get a table of contents?

#

maybe they just renamed a tarball or something

#

ahh, so you should be able to mount the SD on a linux box and then manipulate easier I guess

radiant pike
#

THere's files on the home dir of the SD card that are like dtb

#

I searched those, they're for interfacing w/hardware

valid wasp
#

device tree blob

radiant pike
#

yeah

#

THere's one for pretty much every Pi

valid wasp
#

so you can read all of those ok I assume, just text configs

radiant pike
#

From what I've seen with retroarch there's supposed to be a retroarch.cfg file that lets you change the drivers

#

But it's apparently inside the SYSTEM file, and that's why I'm trying to get inside it/unzip/extract it whatever'll work

valid wasp
#

this shows some good info

#

talks about retroaarch.cfg

radiant pike
#

had to find an SD card reader to get this going

#

There's no retroarch.cfg file in the root of the sd card nor any subfolders

valid wasp
#

was the file created with Win32 disk Imager?

radiant pike
#

Again, no benefit of how this was made because I'm the third person to have hands on the card:
first person made the card
for Second person who wanted it
Which I now have from them

#

Can't ask the person who made the card how it was made

valid wasp
#

so Im assuming this is an image

#

have you run fsck on it to verify ?

#

maybe its corrupted

radiant pike
#

It's not corrupted-- it boots fine on the pi aside from the borked driver settings

valid wasp
#

ohhhhh!

#

I see

radiant pike
#

except when I try to edit the SYSTEM file as text, then it breaks, and no I haven't run the verify on the file

valid wasp
#

so yore trying to edit the image file binary.

radiant pike
#

If that's what a SYSTEM file is, then yes?

valid wasp
#

i dunno

#

can you ssh into the pi after its booted to then change the drivers?

radiant pike
#

also how do I mount a removable drive in wsl? /mnt doesn't work

valid wasp
#

since then youd be using the kb from your remote pc

radiant pike
#

Uh, I could try to ssh into it

#

I've got PuTTY

#

well hm I'm not sure what the configs or the ports/etc would be to ssh into it

#

if ssh is even open on it by default

valid wasp
#

that may be easier to edit the driver settings on the live system rather than the iamge

#

you can try the default ssh of 22

radiant pike
#

Default port and then what address, home IP?

radiant pike
#

I do have a box that might work to do that

main olive
#

can a bash alias use $1 for the first argument called on the alias? I doubt it since an alias isnt executing. But I dont want to make an alias for a script if i dont have to just to do that.

#

like a script that i maade myself so it supports $0 $1, etc

valid wasp
#

i mean by default ls is aliased to show colorful text based on file type and all the args to the ls work

main olive
#

thats true....

valid wasp
#

if you run unalias ls it still works

#

just w/o the color

#

best to test it out

#

๐Ÿ™‚

main olive
#

yeah, fair enough.

#

The idea im thinking on though is if it doesnt work

#

I know how to make it work

#

its just more complicated

valid wasp
#

I suppsed trouble could arise if running via cron or as a nother user depending on your script permissions

main olive
#

My aliases will be all owned by and used only by the user.

valid wasp
#

alias really is just a short cut to a longer command

#

like a url shortener for the web, but for system commands

main olive
#

Well, in the past, I have been using this.sh as a shortcut for a longer command. Then I stick the scripts on path, and I get similar behaviour,

valid wasp
#

id imagine the alias would take the commands

main olive
#

But its more of a mess than alias.

#

So i want to switch

#

at least where i can

valid wasp
#

so the question is driver script vs an alias?

#

if its something simple then use and alias, if more complicated and the script needs to make decisions then driver script

main olive
#

nah, not really. Its mainly just that many of my scripts that exist to make it easaier to type long commands i have to research before hitting otherwise accept args. Not args that go to the commands being called, but args that are custom in my scripts

valid wasp
#

but it sounds like you know all of that.
im just talking it thru

main olive
#

exampler

#
PWD=$(pwd)
VENV=$PWD/venv/

echo "Executing $0 in $PWD"


if [ -d "$VENV" ]; then
    echo "$VENV already exists..."
    exit 1
fi

if [ ! -d "$VENV" ]; then
  echo "Creating Virtual Environment"
    python3 -m virtualenv venv
fi

echo "sourcing into venv/bin/activate"
echo "(venv) will be missing from prompt."
echo "Proof of which python interpreters:"
source venv/bin/activate
which python
which python3
bash

#

btw

#

I am not good at bash lol

#
echo "Executing $0 in $1"

find $1 -mtime 0
#

@radiant pike what does file SYSTEM say

#

it's probably a filesystem file

#

you can mount it with the mount command

#

and edit the files inside as usual

#

making sure to umount afterwards

radiant pike
#

@main olive I'd need to be able to acess it on an *nix system

#

I tried to mnt the removable drive in WSL but it's not there

#

@valid wasp I've tried the blind login for homeIP.101 throgh 103 and haven't found the rpi, it's on a local DHCP box, not exactly sure the name of this kind of box, but it's a local wired connection from win10 machine to rpi

radiant pike
#

I have now gotten windows subsystem working with the mounted file and it's showing that it's a Squashfs filesystem

#

@main olive It won't work with mount

root@DESKTOP:/mnt/i# mount SYSTEM
mount: SYSTEM: can't find in /etc/fstab.
valid wasp
#

isnt squashfs readonly

#

never heard of squashfs , interesting for sure. I should get my self a cheap pi to play with

main olive
#

@radiant pike the syntax is mount [device] [destination]

#

the "device" here is SYSTEM

#

but if it's squashfs, you probably won't be able to mount it anyways

rough gazelle
#

Hello guys.

#

I need a command that will delete all directories in /tmp starting with com.google.

main olive
#

rm -rf /tmp/com.google* maybe?

rough gazelle
#

The problem is that it often prompts for user input

#

but I need to avoid that

main olive
#

what sort of user input?

rough gazelle
#

For example it asked if I wanna delete a write protecte ddirectory tmux sometging something

#

so I guess I don't wanna use the f flag

main olive
#

why is there a tmux dir in /tmp/com.google*

#

is this chromeos?

rough gazelle
#

No I mean it's in the /tmp

#

nevermind

main olive
#

make sure you don't have a space between com.google and the *

#

otherwise, it will delete all files in the current directory

#

which is... not good

rough gazelle
#

That's why I cded into the /tmp to avoid things like this

#

๐Ÿ˜„

#

I mean

#

if I use the f flag

#

won't it delete also files that are currently opened?

#

which may not be good

main olive
#

-f forces removal and doesn't prompt for user input

rough gazelle
#

Yeah, but if a file that is being removed is currently in use, isn't it possible that a process using it would crash?

#

I would like to avoid removing those files

#

that's why I don't wanna use the f flag

#

Nevermind

#

Thanks for the help

indigo kindle
#

find /tmp -type d -name com.google* -exec rm -rf "{}" ; ?

#

whitout "?" and before ; put \

acoustic fable
#

๐Ÿ‘€

main olive
#

I've got a persistent live usb with one of linux distros

#

i've also got a pc with hard drive

#

is there a way to move the whole partition with distro on usb onto a new partition on a hardrive for a dualboot?

#

any command line tool in linux preferably

#

dd?

main olive
#

not sure

#

can i do the same thing with gparted

#

ima try i suppose

main olive
#

worked like a charm, took less than 5 minutes to move the distro from separate usb onto the hard drive pog

minor wedge
#

Hello, I was not sure where to put this question. I am trying to write a script that "wraps" a binary (executable) with subprocess and continuously feeds data to its stdin and reads from its stdout.

The problem is (from my understanding of Popen) that proc.communicate() only allows me to send a single batch of data to stdin, then waits for the process to exit. Do you have any tips, guidelines or material to read on this subject?

main olive
#

@minor wedge

#

not sure but try that

#

if you aren't getting any exceptions that the stdin pipe was closed or destroyed then you just arent writing to/reading from stdin properly

minor wedge
#

@main olive the data is binary

main olive
#

you can decode it?

#

we will need more of your code

#

for context

#

in regards to how do you write to stdin and how do you read from it

minor wedge
#

sure

rare night
#

Hi, I would like to ask a question about multiprocessing in python. I have a pool of 30 worker processes running on a cluster doing numerical computations. However, some of the computation takes really long time. For these cases, I want the function running in the process to exit but keep the pool available for other tasks (there are a few hundreds). Could any one give me some suggestion? Thanks!

left plinth
#

hey man, do you have any experience with threading in python?

main olive
#

you know what.. there's very little benefit in multiprocessing

#

30 worker processes over 15/16 of your actual cores.. any actual increase in performance really depends on the use case and how much data you're shuffling around

#

I've been down this road.. and would advise against it

#

try Spark or Beam.. simpler frameworks and easier to write code for

restive robin
#

That is a good overview of the differences of concurrency options in python

lavish hemlock
#

How can i automatically email myself a critical alert email when i log in

#

i have the html code for it

#

i'm using ubuntu/unix

fickle granite
#

I don't know, but if I had that problem, the first thing I'd do is poke around the documentation for "PAM"

#

if you always log in via ssh, you can probably "hook" sshd somehow, too

lavish hemlock
#

okay thank you

heavy frost
#
eek@vps815008 ~/BumpR v3> python3.8 runme.py
fish: โ€œpython3.8 runme.pyโ€ terminated by signal SIGKILL (Forced quit)
eek@vps815008 ~/BumpR v3>

any particular reason? Sorry if I'm being dumb debian isn't my natural habitat

#

ok why was it SIGKILLing because of an importerror

#

wait it works when I sudo python3.8 but just default breaks it

sudden wigeon
#

@heavy frost did you try having a virtual env ?

summer trail
#

@heavy frost If you received a SIGKILL, it's because something sent a SIGKILL. That could have been the kernel, possibly due to the OOM killer, or a user using magic sysreq, or the runlevel changing. If it wasn't the kernel, then it was another process on the machine. Without any details, my wild guess would be that it's from the OOM killer, but there's not nearly enough information to be sure.

light haven
#

depending on the distro it might have an exception hook thing causing this

#

I think ubuntu has one

shrewd rivet
#

I'm using ubuntu focal fossa..
I'm having a problem to connect to my WiFi router with 2.4ghz band connection. I can connect to 5 ghz with no problem. In windows I can connect to both bandwidths.

heavy frost
#

@summer trail OOM is probably right, as it killed another bot i was hosting a few minutes after I sudo'd it to run

lavish hemlock
#

can someone help me ablobsob

#

i can't update or upgrade apt

#

ntp is messed up and i get an error

rich bloom
#

@lavish hemlock look for it in stack overflow bro

halcyon latch
#

i try install m2crypto, i get all red line?

#

is there anyway to get install?

#

and yes i did googling

fickle granite
#

paste the output

#

worked for me fwiw

#

actually you should grab a help channel, since your question isn't really about unix

halcyon latch
#

alright noted that

dawn stag
#

Has anyone had any issues with Anaconda deciding it doesn't want to run on Mac Catalina?

#

I was able to use everything just fine yesterday

#

Now I guess it's not being found, but I have Anaconda installed

frozen field
#

this isn't directly related to python development, it's just an issue i've often come across while developing on linux.
how come the linux/open source community was able to come up with all sorts of nice solutions and standardized processes for most common problems, but getting a default config 9/10 times just makes me want to kill myself.
some software provides a well commented config file, with a handful of the most common settings, which gives you a rough idea of the general syntax and options available. even if the config is writting in a language i don't know, i'll quickly be able to make a few modifications, and i can check the manual for anything beyond the most basic.
most of the time however the developer was like "nah, if you want to make modifications to my software, you'll have to scim through a manual the size of my fking mom"

it's just... people came up with smart standards for everything else. sometimes it's like people want the entry level for shit on linux to be really high.

i know i sound like a typical dumdum desktop user. i actually love working from the command line and i often enjoy exploring man pages and directories. i just don't understand why there's no "std-config library" or something that people can fucking agree on, since basically every setting in a command line environment is set through some config file

#

i mean they don't all have to be written in the same language. most software for windows like to use JSON for everything, which is horrible actually. it's a great format, but it's not very compact. certainly not a tool suited for everything.
it does however have these nice schema things, which combined with autocompletion, makes them very self-documenting

formal schooner
#

toml is the best config format imo

#

there are some "modern" standards now

#
  1. either generate a default config file, or provide a well-commented example config that the user can copy and paste
  2. use the TOML file format format
  3. place your config file in $XDG_CONFIG_HOME/$app_name/config.toml
#

for 99% of user-facing applications i see no reason to deviate from those recommendations

#

that should lead to a relatively sane and easy-to-handle configuration process

halcyon latch
#

salt, i did run apt-cache rdepends --installed libc6-dev

#

libc6-dev Reverse Depends: gcc-9 |python2.7-dev libstdc++-9-dev |libpython2.7-dev |libncurses-dev libgcc-9-dev clang-8 |python2.7-dev libstdc++-9-dev |libpython2.7-dev |libncurses-dev libgcc-9-dev |libexpat1-dev gcc-9 |gcc clang-8 |build-essential

formal schooner
#

@halcyon latch hmm... looks like you cant remove it then

#

You might want to look online and see if other people have had problems with dependencies and python 3 on kali

halcyon latch
#

alright thank you for the info and guide @formal schooner

modern kestrel
#

this is a stupid q but why when running commands inside a container do i sometimes see examples with -- <command> and others with -- /bin/sh <command>
What is the difference?

#

I'm looking at these in Kubernetes pods

main olive
#

there's no real difference other than one calls the command via the system shell (which can be bash, sh, anything), and one explicitly invokes sh @modern kestrel

#

they're usually more or less the same

modern kestrel
#

Ah okay thanks @main olive

formal schooner
#

usually not using the shell is better

#

unless the command is a shell script

lone heron
#

I'ma look for a way to mount them one sec

lavish hemlock
#

How do you move an SQL database

#

To another instance

trail grove
#

online or offline?

supple harbor
lavish hemlock
#

Can somebody tell me what on earth is going on with my auth.log? ?!?

#

DAFUQ

#

WHO IS FABIAN

#

what is going on!?!?

dusk shadow
#

@lavish hemlock : Is this an ESXi host?

lavish hemlock
#

No

#

It's google cloud

rustic sky
#

@lavish hemlock you are not being hacked

lavish hemlock
#

What is it then joe?

rustic sky
#

this is normal for a public host

#

people are attacking you, yes, no one has got in (hence the authentication failure)

#

it's just part of being on the internet

lavish hemlock
#

Man it's so annoying > I need the auth.log for checking legitimate things

rustic sky
#

fabian is just one of the names on the list that they are trying

fickle granite
#

my service's logs are literally 99.99% stuff like that

rustic sky
#

yeah, same

lavish hemlock
#

Oh really

rustic sky
#

why are you relying on auth.log?

lavish hemlock
#

To see failed logins

fickle granite
#

it's just part of being on the internet
this

lavish hemlock
#

for users on my instance

#

How can i search the logs for only users on my instance?

rustic sky
#

not worth it

lavish hemlock
#

oh

rustic sky
#

you should log successful logins, that's the interesting metric

lavish hemlock
#

how to do that?

rustic sky
#

Is there no log generated in auth.log on a successful login?

#

let me login to one of my nodes

dusk shadow
#

something like "systemd: pam_unix(systemd-user:session): session opened for user USERNAME by (uid=0)" in Ubuntu20 at least

rustic sky
#
May 29 01:06:41 swot sshd[15894]: Accepted publickey for joseph from MYIP port 59121 ssh2: RSA SHA256:/XTyvkWst3GFd2Yw2YI4sklUoK5Cp63mQq7MASKWzLQ
lavish hemlock
#

But how do you filter that

dusk shadow
#

grep should do it for you

lavish hemlock
#

Okay

rustic sky
#

yeah grep will do

lavish hemlock
#

No results that's weird

dusk shadow
#

logout and back in on your machine, that should give you the pattern your looking for

#

it can be different on each system

lavish hemlock
#

I just logged in and it didn't work

#

Maybe the attacks filled up the file and it can't find the successful login

dusk shadow
#

they should be rotated out, in which case, they may be in a compressed log

#

like auth.log.2.gz or something

#

you can use zgrep to look into those if you need

#

(assuming your distro has it)

lavish hemlock
#

i don't see any other file

#

i'm using tail -f /var/log/auth.log | grep "Successful"

dusk shadow
#

yea, the pattern may not be right for you

#

like in Ubuntu, that will not work

#

and in Joe's distro, his is "Accepted"

rustic sky
#

yeah I'm on debian

lavish hemlock
#

ah

#

i am ubuntu

dusk shadow
#

release?

lavish hemlock
#

18:04

#

no wait 20:04 sorry

dusk shadow
#

systemd: pam_unix(systemd-user:session): session opened for user USERNAME by (uid=0)

#

check for "session opened"

lavish hemlock
#

okay

#

uhmm

dusk shadow
#

if not, i can spin up an ubuntu20 box if you need

lavish hemlock
#

i deleted my auth.log tho

dusk shadow
#

oh, lol

lavish hemlock
#

and recreated it

#

uhh

#

yeaaaa

dusk shadow
#

that is certainly one way ๐Ÿ˜›

lavish hemlock
#

but now

dusk shadow
#

logout, and back in, what's in there?

lavish hemlock
#

it's not recording anythingg

#

ok i'll do that

dusk shadow
#

the filehandle may still be in use

rustic sky
#

yeah

lavish hemlock
dusk shadow
#

you may need to restart the syslog i think to let it refresh

lavish hemlock
#

Should i reboot the machine?

#

Oh

dusk shadow
#

try just restarting syslog first, but yea, reboot should work, but iew.

rustic sky
#

just checking auth.log on one of the worker machines in my control, 3,127 invalid user attempts on a machine that has no domain tied to it or anything

dusk shadow
#

over what time period?

rustic sky
#

a few days, but no birth time on the auth.log so not sure

#

since instance creation, about a month now, 130k invalid attempts

dusk shadow
#

wow

rustic sky
#

sadly some people must be affected since clearly people still do it

dusk shadow
#

yep, someone has been randomly trying to hack my accounts for the past 2 months (targeted) gmail, facebook, etc

#

it's nice though, b/c they reset some accounts that i forgot I had.

rustic sky