r/linux_programming • • Apr 28 '22

Help: how to kill the "Files" folder with bash or activity monitor

6 Upvotes

anyone know how to kill the "Files" application. Mine is frozen at the moment and i cant find a way to stop its process.

any help is much appreciated!


r/linux_programming • • Dec 24 '21

Router Software Development

6 Upvotes

I have recently become interested in how a WiFi router works and was wondering how one might go about developing the software for one.

EDIT: I found a solution to this question. I found a tutorial that explains how to install tools which make this possible.


r/linux_programming • • Oct 03 '21

When Is Use Of seccomp Required?

6 Upvotes

I'm working on some changes and improvements to an open source utility that accesses a sensor chip via the inb and outb functions. I noticed that one of the things this utility does is set seccomp rules (https://github.com/guedou/TS-453Be/blob/master/panq/src/utils.c) before it does much else. Is this a requirement for using the inb and outb functions to do low level I/O access? Or did the original developer set these for possibly another reason? Under what circumstances is using seccomp rules required? Trying to get a better understanding of this topic.


r/linux_programming • • Feb 01 '21

Create a core dump of a terminating process on demand

6 Upvotes

I am writing an application in C, and I need to dump the core (it gives a segfault for an unknown reason upon execution). I don't want to have programs creating core files constantly all over the place, I only need them when I debug.

Is there a way where I can generate the core file for the process that crashed using GDB generate-core-file? When I try to, it gives a predictable outcome saying it couldn't find the PID of a process that doesn't exist.

One more thing - No sysctl please. I already know about the kernel.core_pattern option, and I had to reinstall Linux after setting it (I don't know how it happened either)


r/linux_programming • • Jan 19 '21

rsync command works but not as a cronjob

6 Upvotes

This command works if I input in the terminal in order to backup locally a database file from a remote server with the date appended to each new backup file so they are all different:

rsync -avz -Iu --backup [email protected]:/home/database.sqlite /home/ProdBackups/dbBackup_(date +\%Y\%m\%d\%H\%M\%S).sqlite

But when I try running it as a cronjob inside crontab:

* * * * * rsync -avz -Iu --backup [email protected]:/home/database.sqlite /home/ProdBackups/dbBackup_(date +\%Y\%m\%d\%H\%M\%S).sqlite

I get this error:
Syntax error: "(" unexpected

How can I fix this?


r/linux_programming • • Dec 08 '20

Endeavour OS with deepin environment? Privacy?

6 Upvotes

I'm thinking about installing endeavour OS with deepin environment. But I'm concerned about my privacy.

Is it safe to use endeavour OS with deepin environment?

39 votes, Dec 15 '20
21 Safe
18 Not safe

r/linux_programming • • Nov 23 '20

Game launchers not connecting to the internet

6 Upvotes

Whenever I try to launch Epic games store or Battlenet it does not connect to the internet. I am able to go on FireFox and watch youtube no problem, so my manjaro system is connected. I also know that I have all the dependencies otherwise it would not pop up in the first place and show its GUI interface. How do I solve this problem?


r/linux_programming • • Aug 11 '20

Error on my text editor

Post image
6 Upvotes

r/linux_programming • • Jul 30 '20

Asking for a help

6 Upvotes

I'm net to Linux Terminal. My goal is to create shell script in which it list files that ends with a certain name but they are printed with number on thsir side. I only know how to list the files by issuing:

for i in *.txt

do

ls -l "i$"

done

But I don't know how to number them. I tried using cat -n but the contenst of those txt files were included even though I specified *.txt

Please help


r/linux_programming • • Jul 23 '20

Simple way to set a specific Xresources value?

6 Upvotes

I’m trying to make a script that would toggle between a light theme and a dark theme in my wm, but I’m stuck on trying to change a color in the .Xresources database file. I was thinking that I maybe I could use sed, but I can’t really figure out an efficient way. I also looked at the man page for xrdb, but I can’t really find anything usefull. I know I could just switch between different .Xresources files, but I have my Xresources split in different subfiles (with #include: ...) so I don’t know if this is really possible.

Any ideas are welcome! (Check my post history for my dotfiles which include the mentioned Xresources files)


r/linux_programming • • Jun 22 '20

Could someone explain to me why rofi behaves like this when fed this script?

Thumbnail self.linuxquestions
6 Upvotes

r/linux_programming • • Feb 29 '20

Linux GTK with Glade - YouTube

Thumbnail
youtube.com
6 Upvotes

r/linux_programming • • Feb 28 '20

Netdata release v1.20!

6 Upvotes

Hey all,

Our first major release of 2020 comes with an alpha version of our new eBPF collector. eBPF (extended Berkeley Packet Filter) is a virtual bytecode machine, built directly into the Linux kernel, that you can use for advanced monitoring and tracing. Check out the full release notes and our blog post for full details.

With this release, the eBPF collector monitors system calls inside your kernel to help you understand and visualize the behavior of your file descriptors, virtual file system (VFS) actions, and process/thread interactions. You can already use it for debugging applications and better understanding how the Linux kernel handles I/O and process management.

The eBPF collector is in a technical preview, and doesn't come enabled out of the box. If you'd like to learn more about_why_ eBPF metrics are such an important addition to Netdata, see our blog post: Linux eBPF monitoring with Netdata. When you're ready to get started, enable the
eBPF collector by following the steps in our documentation.

This release also introduces host labels, a powerful new way of organizing your Netdata-monitored systems. Netdata automatically creates a handful of labels for essential information, but you can supplement the defaults by segmenting your systems based on their location, purpose, operating system, or even when they went live.

You can use host labels to create alarms that apply only to systems with specific labels, or apply labels to metrics you archive to other databases with our exporting engine. Because labels are streamed from slave to master systems, you can now find critical information about your entire infrastructure directly from the master system.

Our host labels tutorial will walk you through creating your first host labels and putting them to use in Netdata's other features.

Finally, we introduced a new CockroachDB collector. Because we use CockroachDB internally, we wanted a better way of keeping tabs on the health and performance of our databases. Given how popular CockroachDB is right now, we know we're not alone, and are excited to share this collector with our community. See our tutorial on monitoring CockroachDB metrics for set-up details.

We also added a new squid access log collector that parses and visualizes requests, bandwidth, responses, and much more. Our apps.plugin collector has new and improved way of processing groups together, and our cgroups collector is better at LXC (Linux
container) monitoring.

Speaking of collectors, we revamped our collectors documentation to simplify how users learn about metrics collection. You can now view a collectors quickstart to learn the process of enabling collectors and monitoring more applications and services with Netdata, and see everything Netdata collects in our supported collectors list.

Breaking Changes

  • Removed deprecated bash
    collectors apache
    , cpu_apps
    , cpufreq
    , exim
    , hddtemp
    , load_average
    , mem_apps
    , mysql
    , nginx
    , phpfpm
    , postfix
    , squid
    , tomcat
    If you were still using one of these collectors with custom configurations, you can find the new collector that replaces it in the supported collectors list.

  • Modified the Netdata updater to prevent unnecessary updates right after installation and to avoid updates via local tarballs #7939. These changes introduced a critical bug to the updater, which was fixed via #8057 #8076 and #8028. See issue 8056 if your Netdata is stuck on v1.19.0-432.

Improvements

Host Labels

  • Added support for host labels

  • Improved the monitored system information detection. Added CPU freq & cores, RAM and disk space

  • Started distinguishing the monitored system's (host) OS/Kernel etc. from those of the docker container's

  • Started creating host labels from collected system info

  • Started passing labels and container environment variables via the streaming protocol

  • Started sending host labels via exporting connectors

  • Added label support to alarm definitions and started recording them in alarm logs

  • Added support for host labels to the API responses

  • Added configurable host labels to netdata.conf

  • Added Kubernetes labels

New Collectors

  • eBPF kernel collector

  • CockroachDB

  • squidlog: squid access log parser

Check out the full release notes and our blog post for full details!


r/linux_programming • • Jan 02 '20

What Linux driver/subsystem/API is used for a simple screen/monitor device?

6 Upvotes

I am developing an embedded system with a touchscreen. The touchscreen operates as both input and output, with a "virtual" keyboard overlaying the graphical output. I have a working device driver that reads input from the touch sensor and translates it correctly to key presses, created with the help of this guide on kernel.org. I want to expand this driver to also handle image output to the screen.

I want to support both getty and X, with as little duplication as possible. I am running a minimal Debian variant with cherry-picked packages, such as minimal X. Note that I do not intend on attempting to get this driver into the repository pipeline, though I might dump it on a public github.

Outputting screen images is presently done via a cringy workaround: a boot option to force rendering to the cpu's embedded graphics hardware, despite it not being connected to a display, and a daemon that continuously screen-scrapes that buffer, modifies a handful of pre-defined pixels to create the keyboard visual, and pushes it out to the real screen. This works as a proof of concept, proving that I do correctly understand the language the screen device expects, but is obviously sub-optimal.

kernel.org also has a guide for "DRM" device drivers, but that seems like serious overkill for what my hardware is capable of:

The Linux DRM layer contains code intended to support the needs of complex graphics devices, usually containing programmable pipelines well suited to 3D graphics acceleration.

None of my hardware has anything resembling 3D acceleration, so I conclude that this is probably not what I want.

What subsystem/API should I use? I figure one piece of missing terminology is what is holding back my searches, but any more information on how to accomplish this would be appreciated.

Hardware details (probably irrelevant): The cpu and screen communicate via 8080-esque parallel protocol, which the cpu does not support natively, so I'm emulating it with GPIOs (by manipulating registers via mmap). Sending a complete screen image takes about 20ms, but obtaining a complete copy from the embedded graphics buffer takes ~180ms, so skipping that step is the most important objective. The screen hardware includes enough gram memory to keep an entire frame worth of data, and supports writing a rectangular sub-region, so a hook to only update the part of the screen that has changed would be desirable. The screen is not particular about the timing of incoming data. The touch sensor input is handled by a purpose-built IC that communicates with the cpu via I2C, which the cpu does support. The present driver uses the linux/input-polldev.h interface. The cpu is a broadcom bcm2835, the screen is a tft with embedded himax hx8357 controller, the touchscreen sensor decoder is a st stmpe610, and there is a voltage levelshifter (nexperia 74lvch245A) in play between the hx8357 and the bcm2835. More details available upon request.

** Edit: TL;DR: ** DRM is what I wanted. tinydrm made it easier. Dirty flushing is your friend.


r/linux_programming • • Dec 08 '19

Best text editor for programming in multiple languages with vim emulation?

6 Upvotes

I used to use Geany as my IDE for C Programming however the vim emulation recently seems to be quite broken. Nowadays I've been using Gvim however I find it to be lacking in regards to keeping organized with what I am doing and I can't easily compile programs (using makefiles) on the fly without using a separate terminal window. What would you guys recommend?


r/linux_programming • • Oct 26 '19

looking for xcb documentation

6 Upvotes

Title. I'm getting so tired of looking everything up and getting no results. The headers aren't documented, and online results are incredibly lacking.


r/linux_programming • • Oct 18 '19

Terminal widget toolkit FINAL CUT 0.6.0 released

Thumbnail self.linux
6 Upvotes

r/linux_programming • • Jun 14 '19

Understanding about grep implementation

6 Upvotes

Hi everyone, so I was reading about grep command in my free time and I got to wondering that how does grep technically implements highlighting of matched strings in text? Like I grep for abc in xyz file then it highlights all the occurrences of abc in stdout. Any idea how it is achieved?


r/linux_programming • • Jun 06 '19

Good CI tools for multiple branches, multiple configs, multiple OS targets?

6 Upvotes

I maintain a few free software projects, and I'd like to move some of the testing to a CI tool. The projects already have automated unit and regression tests, I just want the tooling to manage running the tests on the relevant platforms and storing (& alerting on) the results.

Running the tests locally is easy, the benefit of the CI set-up would be that it remembers for me to run the builds on the platforms I don't develop on, and with configuration options I don't routinely use myself during development.

All the projects use a build/test workflow that looks exactly like this:

git checkout <some-branch>
./bootstrap
./configure <some configure options>
make distcheck

The configure options would include various choices of compiler (i.e. versions of GCC and Clang) and some other configure options (--enable-foo) and so forth. There's a sort of combinatorial explosion here; I'd like to build/test with about 3 different configure options with about 4 choices of compiler on about 4 different operating systems. Support for VPATH builds would be helpful but it's not a deal-breaker.

I'd also like to build against automatically-discovered branches (along the lines of the Jenkins Multibranch Pipeline feature). This is because 90% of my development happens on a somewhat short-lived topic branch (e.g. for a bugfix, or a set of related features) These branches, though, are mostly in a private repo because they're topic branches which have not yet been merged up to master and then origin/master. I'd also like to run CI against the code in origin/master (whether or not this points at a different SHA1 to my local master ref). Since the topic branches aren't in a publicly accessible place I realize I'm going to need to self-host this.

I don't really need long-term - or indeed any - storage of the built artifacts. But I would like to keep the output of failed tests (which appears on stderr).

There are a lot of CI tools. I'm looking to get suggestions about tools that do the above things well, so that i don't need to download and evaluate 9 different CI platforms. I'd like to begin with a shortlist of no more than 4 alternatives.


r/linux_programming • • Apr 25 '19

netdata, the open-source real-time performance and health monitoring, released v1.14 !

6 Upvotes

Hi all,

We just released netdata v1.14 !

This release contains 14 bug fixes and 24 improvements

The release introduces major additions to Kubernetes monitoring, with tens of new charts for Kubelet, kube-proxy and coredns metrics, as well as significant improvements to the netdata helm chart.

Two new collectors were added, to monitor Docker hub and Docker engine metrics.

Finally, v1.14 adds support for version 2 cgroups, OpenLDAP over TLS, NVIDIA SMI free and per process memory and configurable syslog facilities.

Improvements:

  • go.d.plugin v0.4.0 : Docker Hub and k8s coredns collectors, springboot2 URI filters support.

  • go.d.plugin v0.3.1 : Add default job to run k8s_kubelet.conf, k8s_kubeproxy, activemq modules.

  • go.d.plugin v0.3.0 : Docker engine, kubelet and kub-proxy collectors. x509check module reading certs from file support

  • Added unified cgroup support that includes v2 cgroups

  • Disk stats : Added preferred disk id pattern, so that users can see the id they prefer, when multiple ids appear for the same device

  • NVIDIA SMI : Added memory free and per process memory usage charts to the collector

  • OpenLDAP : Added TLS support, to allow monitoring of LDAPS

  • PHP-FPM : Add health check to raise alarms when the phpfm server is unreachable

  • PostgreSQL : Our configuration options to connect to a DB did not support all possible option. Added option to connect to a PostreSQL instance by defining a connection string (URI)

  • python.d.plugin : There was no way to delete obsolete dimensions in charts created by the python.d plugin. The plugin can now delete dimension at runtime.

  • netdata supports sending its logs to Syslog, but the facility was hard-coded. We now support configurable Syslog facilities in netdata.conf

  • We encountered sporadic failures of our kickstart installation scripts after nightly releases. We add integrity tests to our pipeline to ensure we prevent faulty scripts from getting deployed.

  • Kubernetes Helm Chart improvements:

    • Added serviceName in statefulset spec to align with the k8s documentation

    • Added preStart command to persist slave machine GUIDs, so that pod deletion/addition during upgrades doesn't lose the slave history

    • Disabled non-essential master netdata collector plugins to avoid duplicate data

    • Added preStop command to wait for netdata to exit gracefully before removing the container

    • Extended configuration file support to provide more control from the helm command line

    • Added option to disable Role-based access control

    • Added liveness and readiness probes

Bug Fixes:

  • Fixed cases where the netdata version produced by the binary or the configure tools of the source code was wrong. Instead of getting something like netdata-v1.14.0-rc0-39a9sf9g we would get a netdata-39a9sf9g

  • Fixed unexpected crashes of the python plugin on macOS, caused by new security changes made in High Sierra

  • Fixed problem autodetecting failed jobs in python.d plugin. It now properly restarts jobs that are being rechecked, as soon as they are able to run.

  • CouchdDB monitoring would stop sometimes with an exception. Fixed the unhandled exception causing the issue

  • The netdata api deliberately returned http error 400 when netdata ran in memory mode none. Modified the behavior to return responses, regardless of the memory mode

  • The python.d plugin sometimes does not receive SIGTERM when netdata exits, resulting in zombie processes. Added a heartbeat so that the process can exit on SIGPIPE

  • The new SMS Server Tools notifications did not handle errors well, resulting in cryptic error messages. Improved error handling

  • The installers would crash on some FreeBSD systems, because sha256sum used by the installers is not available on all FreeBSD installations. Modified the installers to properly support FreeBSD

  • Running netdata behind a proxy in FreeBSD did not work, when using UNIX sockets. Added special handling of UNIX sockets for FreeBSD

  • Fixed sporadic build failures of our Docker image, due to dependencies on the Polyverse package ( APK broken state).

  • Fix segmentation fault in streaming, when two dimensions had similar names

  • Kubernetes Helm Chart: Fixed incorrect use of namespaces in ServiceAccount and ClusterRoleBinding RBAC fixes

  • Elastic search : The option to enable HTTPS was not included in the config file, giving the erroneous impression that HTTPS was not supported. The option was added

  • RocketChat notifications were not being sent properly. Added default recipients for roles in the health alarm notification configuration


Check the release log at github.

If you are new to netdata, check a few live demos at its home page and the project home at github.

Netdata is FOSS (Free Open Source Software), released under GPLv3+.

Enjoy real-time performance and health monitoring!


r/linux_programming • • Mar 24 '19

Dealing with /dev/input/eventX buffering

6 Upvotes

hi all, i have an embedded device that runs linux with a single app on top which uses the framebuffer and manages its input directly /dev/input

i want to have a task switcher/launcher so that i can have several programs in memory and switch between them by sigstop/sigcont (all using the framebuffer and raw input dev).

The problem is that the input events get buffered (like at least 20 events), so on sigcont the app starts processing events that the other one already got and im looking for a way to prevent that.

there is no uinput, i can’t modify the app.

My ideas so far:

-inject a lib in every app, get the file input descriptor, pass it to the parent, and purge it on switch

-ptrace before switching, get fd, purge

-hack the kernel, add ioctl to purge all client queues, use on switch (not preferred)

  • remap the /dev/ nodes paths, use EVIOGRAB, get exclusive access and don’t know after that

What am i missing, is there a better solution? Anyway to disable the buffering/prevent the kernel from sending events to a suspended process?


r/linux_programming • • Mar 14 '19

Input Devices representation in Go

6 Upvotes

Hi all,

I'm writing a go package that I want to use to detect available input devices. My current approach is to initially read /proc/bus/input/devices then scan it for updates, and parse its contents int a data structure like this:

type Device struct {
	Id           DeviceId
	Name         string
	PhysycalPath string
	SysfsPath    string
	UID          string
	Handlers     []string
	Bitmaps      Bitmaps
}

type DeviceId struct {
	Bus     uint16
	Vendor  uint16
	Product uint16
	Version uint16
}

type Bitmaps struct {
	Props        []uint64
	Events       []uint64
	Keys         []uint64
	RelativeAxes []uint64
	AbsoluteAxes []uint64
	Misc         []uint64
	Leds         []uint64
	SoundEffects []uint64
	Switches     []uint64
}

It is based on what this question on stackoverflow and what I could make out of the kernel

Does this make sense at all? My eventual goal is to create a daemon that listens to keyboard and mouse events and turns on the keyboard backlight, or off when idle for a couple of seconds, but again, my main motivation is curiosity and I would like to understand the system a bit better.

I'm writing this in Go, because it's a language I'm familiar with, but would like to practice in the meantime.

Thanks in advance for your guidance! :)


r/linux_programming • • Jan 18 '19

Display image as overlay on linux framebuffer?

6 Upvotes

I was wondering if there was an application that lets you display an image overlay on top of the linux framebuffer. I have been porting a script that uses this to different platforms but I have not found any other programs that displays images to the framebuffer.

I have been looking to get this feature working on ODROID and/or Ubuntu. I would love a more universal option but if there are different programs per platform I could adjust the script i'm working on as needed.

On the Raspberry Pi there is pngview which uses Dispmanx to display png files directly to the framebuffer (https://github.com/AndrewFromMelbourne/raspidmx/tree/master/pngview).

Here is a picture of pngview in action: https://imgur.com/a/J9iek (top left hand corner)


r/linux_programming • • Dec 12 '18

How do I get a line from a text file and use it as a parameter for a bash command?

6 Upvotes

I have a text file where each line is a file path that has to be used as a parameter to a bash command. How do I do that? How do I get the line to use as a parameter? Basically, this is what I need to do:

command line1
command line2
command line3
etc. until the end of the document

Also, I expect each command to take a long time, so I want to use screen to detach from the screen and let it keep running while I do other stuff, so, I think I need to multiplex or something? I don't know/remember how to do that. Any help would be greatly appreciated.