Can I use an existing EFI partition as /boot? Posted: 03 Sep 2021 09:51 AM PDT So I'm planning to switch full-time to Pop_OS! and while backing up (which is another can of worms I'll be explaining later), I realized "Wait, do I have to create a new partition for boot? Or can I use an existing one?" I didn't really know what the answer to that was so I decided, before switching to Pop_OS!, I'm gonna ask here. Can I use an existing EFI partition as /boot? Now, I'm gonna cover the second can of worms I was talking about. So while I was backing everything up, this anxiety crept in like "Is everything backed up? Can I be sure that the copy process didn't fail? HAVE I BACKED UP EVERYTHING I WANT?!" and this anxiety is keeping me from fully committing to linux. So the 2nd question of the thread is: How can I overcome the anxiety of whether or not I've backed up everything? |
Is there an output character to indicate the end of a command in bash from stdout? Posted: 03 Sep 2021 09:34 AM PDT I am trying to build a web-app where i can run a bash terminal directly from the browser. I have got the basic functionality working where i fire up a bash process and redirect the stdout to a textarea in my web page and route text from an input field to stdin of the bash process. It works well, however i am trying to make the application aesthetically pleasing. QUESTION: Is there a way i can detect the end of the output of a command i type in bash so i can indicate to the user that command has finished through a customized prompt. |
What method will determine why systemd failed to load a "Wanted" target? Posted: 03 Sep 2021 09:01 AM PDT I have an Ubuntu 20.04 system that uses systemd with a default target of graphical.target : $ systemctl get-default graphical.target If I follow the chain of "Requires" and "Wants", I find that graphical.target ends up "Wanting" a unit file widget.target . I notice that sometimes widget.target loads at startup, and sometimes it doesn't. This is verified by the output of $ systemctl list-units --type target , which doesn't include widget.target on those instances where it fails to load. The machine is currently in a state where widget.target failed to load on the last boot. If I examine the logs for this unit since the last boot using $ journalctl -u widget.target -b , journalctl returns -- No entries -- . If I extend the search beyond the last boot, the only entries are routine ones that are not errors and don't refer to widget.target at all. Does systemd provide any other method for explaining to me why it wouldn't load a "Wanted" target? |
How to do a find for two different names Posted: 03 Sep 2021 09:03 AM PDT We have code that generates a large number of files with names like stdout, stdout.qsub, stderr, stderr.foo, etc. I would like to do find <dir> -name (stdout|stderr) -exec ... and only find stdout and stderr files, no stdout.qsub, etc. So I can't do '-name "std*"'. In this case, I can do '-name "std[eo][ru][rt]"', and it works because there won't be any stdeut files to be found by that search. Is there a cleaner way to do this than '-name "std[eo][ru][rt]"'? |
AWK: Get the line where the maximum of a column value occurs Posted: 03 Sep 2021 09:10 AM PDT I am interested in the maximum value of the 5th column. But, I also want to be able to capture the 6th and the 9th values of that row into an array. How do I do this? The command below tries to get only the 5th column value. myVar=$(bash myScript.sh | awk -v max=0 '{if($5>max){max=$5;max6=$6;max9=$9}}END{print $5}') Edit: print $5 is printing the maximum of the 5th column. Thanks. |
TOP command combined with printf Posted: 03 Sep 2021 08:40 AM PDT I have a simple while true statement: #!/bin/bash while true; do printf -- '-%.0s' {1..100}; echo "" | top -l 1 >> file.txt sleep 10 done The issue I am facing is that the printf statement is only outputting to console instead of within the file. The desired outcome of my command is to have the top command output to a file with a --- separator between each new top. Like so: ---------------- top output --------------- top output etc... I have also tried: #!/bin/bash while true; do ( printf -- '-%.0s' {1..100}; echo "" top -l 1 ) >> file.txt sleep 10 done |
Isn't fedora's DNF a failure? [closed] Posted: 03 Sep 2021 07:55 AM PDT Fedora's DNF is very slow, It is also like bad dream. It is not comparable to apt, not at all!. Isn't Fedora's DNF a failure? I can't even dnf autoremove offline!. There is little information about it in Google too. |
How to escape special characters in MATE Search Tool regex? Posted: 03 Sep 2021 07:47 AM PDT MATE Search Tool has an option "Contains the text" where text is always treated as a regex. The problem is I don't know how to escape special symbols there. For example, when searching for files containing text 1.0 a lot of unneeded files are found because dot is interpreted as "any symbol" instead of dot. I have tried 1\.0 1\\.0 1\\\\.0 1\\\\\\\\.0 but no luck. How do I search for plain text in files using MATE Search Tool? |
sh: Syntax error: "(" unexpected (expecting "fi") Posted: 03 Sep 2021 07:34 AM PDT I am getting an error when using sh, but not bash. Any idea why? $ sh test.sh test.sh: 5: test.sh: Syntax error: "(" unexpected (expecting "fi") #!/bin/bash if [ 1 -eq 1 ] then declare -a methods=(Method1 Method2 Method3) for i in "${methods[@]}" do echo $i done else echo not found fi |
Mounting shared folder from local NAS device Posted: 03 Sep 2021 08:51 AM PDT I'm trying to mount a folder from local NAS device. The model is Zyxel NAS 326. On the Ubuntu 18.04 client, I try to run these commands: # does nothing sudo mount -v -o vers=3.0 -t nfs 192.168.1.33:/i-data/5519db32/nfs/Hiddenslate1 /media/NAS/volume1/ ### outputs mount.nfs: timeout set for Fri Sep 3 16:31:59 2021 mount.nfs: trying text-based options 'vers=3.0,addr=192.168.1.33' mount.nfs: prog 100003, trying vers=3, prot=6 mount.nfs: trying 192.168.1.33 prog 100003 vers 3 prot TCP port 2049 mount.nfs: prog 100005, trying vers=3, prot=17 mount.nfs: trying 192.168.1.33 prog 100005 vers 3 prot UDP port 38280 # gives permission denied error sudo mount -v -o vers=3.0 -t nfs 192.168.1.33:/Volume1/i-data/5519db32/nfs/Hiddenslate1 /media/NAS/volume1/ # does nothing sudo mount -v -o vers=4.0 -t nfs 192.168.1.33:/Hiddenslate1 /media/NAS/volume1/ ### outputs mount.nfs: timeout set for Fri Sep 3 16:32:31 2021 mount.nfs: trying text-based options 'vers=4.0,addr=192.168.1.33,clientaddr=192.168.1.66' # gives no such file or dir error sudo mount -v -o vers=4.0 -t nfs 192.168.1.33:/Volume1/Hiddenslate1 /media/NAS/volume1/ I understand the second and fourth errors but first or third one should work. I can't see anything in the /media/NAS/volume1 . What sould I do check? The output of rpcinfo 192.168.1.33 | egrep "service|nfs" program version netid address service owner 100003 3 tcp 0.0.0.0.8.1 nfs superuser 100003 4 tcp 0.0.0.0.8.1 nfs superuser 100003 3 udp 0.0.0.0.8.1 nfs superuser 100003 4 udp 0.0.0.0.8.1 nfs superuser showmount -e 192.168.1.33 : Export list for 192.168.1.33: /i-data/5519db32/nfs * /i-data/5519db32/nfs/Hiddenslate1 (everyone) /i-data/76a39839/nfs/Hiddenslate2 (everyone) |
kworker hogging CPU after getting additional SSD - high acpi interrupts on gpe11, masking or disabling causes system freeze Posted: 03 Sep 2021 09:50 AM PDT Mine is a 7 year old Dell Inspiron 3542 (Intel i5), have been running Linux for about 5 years now. Recently I got an additional SSD fitted in the HDD slot and moved the HDD into the place of DVD Drive using a caddy. Then I did a fresh install of Xubuntu 20.04 onto the SSD. I noticed high CPU usage on CPU 0 (~75%) even when nothing much is running on the PC. top command shows me a kworker process hogging CPU: 184 root 20 0 0 0 0 I 75.7 0.0 17:31.07 kworker/0:2-kacpid The usual solution with other similar problems posted here is to figure out which GPE is causing too many interrupts and disable that. Output of grep . -r /sys/firmware/acpi/interrupts shows the below lines with high values: /sys/firmware/acpi/interrupts/gpe11:11640215 EN STS enabled unmasked /sys/firmware/acpi/interrupts/sci:11640301 Disabling or masking gpe11 with echo mask > /sys/firmware/acpi/interrupts/gpe11 causes the system to freeze (monitor, keyboard and mouse become unresponsive, if any sound was playing the sound starts looping like a DJ did something) Disabling or masking sci resets the gpe11 and sci interrupts to zero, but they start increasing again. No effect on cpu usage, which is still high Other experiments and observations: - The usual kernel parameter changes such as
acpi=off and acpi_mask_gpe=0x11 caused a blank screen at boot - The problem persists on OS booted from Live USB too
- The problem persists on Xubuntu 18.04, and Arch Linux latest release Live USB too
- Output of
cat /proc/interrupts is below (truncated till acpi): CPU0 CPU1 CPU2 CPU3 0: 6 0 0 0 IO-APIC 2-edge timer 1: 9379 0 0 0 IO-APIC 1-edge i8042 8: 0 1 0 0 IO-APIC 8-edge rtc0 9: 0 21362967 0 0 IO-APIC 9-fasteoi acpi - Relevant Output of
echo l > /proc/sysrq-trigger onto dmesg is below [ 2174.058304] CPU: 0 PID: 184 Comm: kworker/0:2 Not tainted 5.11.0-27-generic #29~20.04.1-Ubuntu [ 2174.058305] Hardware name: Dell Inc. Inspiron 3542/0926J6, BIOS A03 05/27/2014 [ 2174.058307] Workqueue: kacpid acpi_os_execute_deferred [ 2174.058309] RIP: 0010:acpi_ns_search_one_scope+0x16a/0x208 [ 2174.058310] Code: 49 89 1f 45 31 c0 b9 10 00 00 00 bf 74 00 00 00 48 c7 c2 b0 e8 ca a0 48 c7 c6 90 e8 ca a0 e8 f3 d9 00 00 31 c0 e9 8f 00 00 00 <48> 8b 5b 20 e9 4c ff ff ff f6 05 7d dc 19 01 04 74 55 f6 05 c3 34 [ 2174.058312] RSP: 0018:ffffb5850051fb80 EFLAGS: 00000212 [ 2174.058313] RAX: 0000000037314547 RBX: ffff8947808f57b0 RCX: 0000000000000010 [ 2174.058314] RDX: ffffffffa0cae8b0 RSI: ffffffffa0cae890 RDI: 0000000000000042 [ 2174.058315] RBP: ffffb5850051fbb0 R08: 0000000000000005 R09: 0000000000000003 [ 2174.058317] R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffa1a7e880 [ 2174.058318] R13: ffff8947801d1b40 R14: 0000000000000000 R15: ffffb5850051fc60 [ 2174.058319] FS: 0000000000000000(0000) GS:ffff8947aba00000(0000) knlGS:0000000000000000 [ 2174.058320] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2174.058321] CR2: 00007f4c9b5e4d9c CR3: 0000000069074001 CR4: 00000000001706f0 [ 2174.058322] Call Trace: [ 2174.058323] acpi_ns_search_and_enter+0x347/0x4ca [ 2174.058325] acpi_ns_lookup+0x63e/0x866 [ 2174.058326] acpi_ps_get_next_namepath+0xbc/0x35a [ 2174.058327] acpi_ps_get_next_arg+0x69d/0x79a [ 2174.058328] ? acpi_ut_trace_ptr+0x2b/0x71 [ 2174.058329] acpi_ps_parse_loop+0x4be/0x924 [ 2174.058330] acpi_ps_parse_aml+0x1af/0x550 [ 2174.058331] acpi_ps_execute_method+0x208/0x2ca [ 2174.058332] acpi_ns_evaluate+0x34e/0x4f0 [ 2174.058333] acpi_ev_asynch_execute_gpe_method+0xc0/0x15e [ 2174.058334] acpi_os_execute_deferred+0x1a/0x30 [ 2174.058335] process_one_work+0x220/0x3c0 [ 2174.058336] worker_thread+0x4d/0x3f0 [ 2174.058337] kthread+0x114/0x150 [ 2174.058338] ? process_one_work+0x3c0/0x3c0 [ 2174.058339] ? kthread_park+0x90/0x90 [ 2174.058340] ret_from_fork+0x22/0x30 - Output of
sudo dmidecode for 0x0011 is below. Not sure if 0x0011 corresponds to gpe11 . If that's not how the GPE numbering works, I can provide full output. Handle 0x0011, DMI type 10, 6 bytes On Board Device Information Type: Video Status: Enabled Description: Mobile Intel HD Graphics - Tried removing HDD Caddy, system won't boot at all (stuck at kernel panic) - from both SSD and Live USB
- Tried flipping the switch on Caddy, same result as removing the caddy
- Tried doing BIOS Update but the update failed. That is a separate issue because Dell provides only EXE files for updating
|
Understanding the output of xrandr --query Posted: 03 Sep 2021 07:41 AM PDT I called the xrandr --query command in the shell to find out display-connectors and displays connected. It is displayed: Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192 LVDS connected (normal left inverted right x axis y axis) 1366x768 60.02 + 1280x720 59.97 1152x768 59.95 1024x768 59.95 800x600 59.96 848x480 59.94 720x480 59.94 640x480 59.94 HDMI-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 521mm x 293mm 1920x1080 60.00*+ 50.00 59.94 1920x1080i 60.00 50.00 59.94 1600x900 60.00 1280x1024 75.02 60.02 1152x864 75.00 1280x720 60.00 50.00 59.94 1024x768 75.03 60.00 800x600 75.00 60.32 720x576 50.00 720x576i 50.00 720x480 60.00 59.94 720x480i 60.00 59.94 640x480 75.00 60.00 59.94 720x400 70.08 VGA-0 disconnected (normal left inverted right x axis y axis) I roughly understand what all this means: There are LVDS, HDMI-0 and VGA-0 connectors. There is nothing connected to the VGA-0 connector. There is a display connected to the LVDS connector. The modes in which that display can be used are listed. But it is not in use. There is a display connected to the HDMI-0 connector. The modes in which that display can be used are listed. *+ in the list of modes denotes that that display is in use as primary display in the mode 1920x1080 60.00 50.00 59.94 . But I do not understand everything. In particular: Question 1: I do not understand what the very first line Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192 is about. What is it about? (None of the displays connected does provide a mode 320 x 200 . None of the displays connected does provide a mode 8192 x 8192 .) Question 2: I do not understand what the string (normal left inverted right x axis y axis) in the line for the display at HDMI-0 means. Can someone tell me what this means? The reason for the question is: I wish to have a command line where xrandr is called so that all displays except for this HDMI-0 display are turned off. So far I have the following command line: xrandr --output VGA-0 --off --output LVDS --off --output HDMI-0 --primary --mode 1920x1080 --pos 0x0 --rotate normal Does the said string (normal left inverted right x axis y axis) indicate that xrandr needs to be called with a set of parameters differing from the set of parameters provided in the command line I've got so far? If so: Which set of parameters? |
How to verify Electrum signature in Linux? Posted: 03 Sep 2021 08:37 AM PDT I am trying to install https://electrum.org/#download for that I am following the instructions, but when I trying to verify the signature, I have the following error: └─$ gpg --verify Electrum-4.1.5.tar.gz.ThomasV.asc Electrum-4.1.5.tar.gz 2 ⨯ gpg: Signature made Mon 19 Jul 2021 09:22:29 PM MSK gpg: using RSA key 6694D8DE7BE8EE5631BED9502BD5824B7F9470E6 gpg: Can't check signature: No public key ┌──(katya12㉿kali)-[/home/katya/soft/electrum] └─$ gpg --import Electrum-4.1.5.tar.gz.ThomasV.asc 2 ⨯ gpg: no valid OpenPGP data found. gpg: Total number processed: 0 There is an instruction On Linux, you can import that key using the following command: gpg --import ThomasV.asc. But there is no ThomasV.asc file anywhere. Could you tell me how to verify the signature of last Electrum version for Linux? |
How to select based on an allowlist/blocklist using jq Posted: 03 Sep 2021 07:37 AM PDT Using jq , how can we select json elements from an array based on inclusion/exclusion of each element's key in some allowlist/blocklist? Here is what I tried (not implemented blocklist): allowlist='["happy", "good"]' blocklist='["sad", "bad"]' jq --argjson allowlist "$allowlist" \ --argjson blocklist "$blocklist" \ '.[] | select(.my_key | ascii_downcase | contains($allowlist[]))' \ <<< '[{"my_key": "neutral"}, {"my_key": "neutral good"}, {"my_key": "neutral bad"}, {"my_key": "good"}, {"my_key": "bad"}, {"my_key": "happy sad bad"}, {"my_key": "neutral happy sad"}]' Expected output: {"my_key": "neutral good"} {"my_key": "good"} |
Grep specific lines when numbered words are involved Posted: 03 Sep 2021 07:17 AM PDT I have a file with the following structure. name #chrom chromStart chromEnd encodeLabel description EH38E1310153 chr1 181251 181601 pELS EH38E1310153 EH38E1310154 chr2 190865 191071 dELS EH38E1310154 EH38E1310158 chr3 778562 778912 PLS EH38E1310158 EH38E1310159 chr4 779086 779355 PLS EH38E1310159 EH38E1310160 chr8 779727 780060 pELS EH38E1310160 EH38E1310162 chr17 790397 790626 CTCF-only EH38E1310162 EH38E1310164 chr18 807736 807916 dELS EH38E1310164 EH38E1310165 chr19 812113 812266 dELS EH38E1310165 I need the lines with chr1 and that only. Here is what I've tried so far: grep 'chr1' filename.txt > Output.txt This pulls out the following lines: EH38E1310153 chr1 181251 181601 pELS EH38E1310153 EH38E1310162 chr17 790397 790626 CTCF-only EH38E1310162 EH38E1310164 chr18 807736 807916 dELS EH38E1310164 EH38E1310165 chr19 812113 812266 dELS EH38E1310165 It seems like the default grep search is greedy, when I need it to be specific. I do not need chr1* . I tried the -o flag, but this simply returned chr1 . I need the whole line. How can I solve this? |
Why can't paste or type special character into MariaDB shell? Posted: 03 Sep 2021 07:10 AM PDT My os info: uname -a Linux debian 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64 GNU/Linux Locale setting: locale LANG=en_HK.UTF-8 LANGUAGE=en_HK:en LC_CTYPE="en_HK.UTF-8" LC_NUMERIC="en_HK.UTF-8" LC_TIME="en_HK.UTF-8" LC_COLLATE="en_HK.UTF-8" LC_MONETARY="en_HK.UTF-8" LC_MESSAGES="en_HK.UTF-8" LC_PAPER="en_HK.UTF-8" LC_NAME="en_HK.UTF-8" LC_ADDRESS="en_HK.UTF-8" LC_TELEPHONE="en_HK.UTF-8" LC_MEASUREMENT="en_HK.UTF-8" LC_IDENTIFICATION="en_HK.UTF-8" LC_ALL= Copy a special character å from webpage in the clipboard,and i can paste it into both mousepad and shell terminal, it can be shown normally. The mysql version info: mysql --version mysql Ver 15.1 Distrib 10.5.11-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper The character and collation setting in MariaDB: MariaDB [(none)]> show variables like '%char%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8mb4 | | character_set_connection | utf8mb4 | | character_set_database | utf8mb4 | | character_set_filesystem | binary | | character_set_results | utf8mb4 | | character_set_server | utf8mb4 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.001 sec) show variables like 'collation%'; +----------------------+--------------------+ | Variable_name | Value | +----------------------+--------------------+ | collation_connection | utf8mb4_general_ci | | collation_database | utf8mb4_general_ci | | collation_server | utf8mb4_general_ci | +----------------------+--------------------+ 3 rows in set (0.001 sec) I can paste it into sqlite3 shell from clipboard,and can type the special character into sqlite3 shell! And i can execute msyql select command on bash shell and show special character. debian@debian:~$ mysql -u root -D test -p -e 'select "å" ;' +----+ | å | +----+ | å | +----+ Mariadb shell can show special character properly: select * from `character`; +---------+ | special | +---------+ | å | +---------+ 1 row in set (0.000 sec) Enter into MariaDB ,mouse cursor into MariaDB shell, the special character å can't be pasted into MariaDB shell,and i can't type special character å into the Mariadb shell too! I can't type the below sql command in Mariadb shell: select * from `character` where special="å"; How can make MariaDB shell accept it as input and show it normally? |
Only failed bash script should run next time Posted: 03 Sep 2021 07:11 AM PDT I have a main script, containing multiple child script inside it. once i will run the main script, it will start execution of all child script sequentially. some script will pass and some could be fail. Second time when i run this main script, i want only the failure child script should run not the successful one. Any help will be really appreciated. My second issue is, there is one argument say 'r' is common for all script..while 'd' is optional. eg: mainscript.sh -r India -d 2021-05-21 but my first child script doesn't have d param, so it is failing in every run. How can i ignore this invalid param and run the script. #!/bin/bash recall() { script1.sh $* ; script2.sh $* ; script3.sh $* ; script4.sh $* ; script5.sh $* exit } recall $* |
Fill down multiple columns in HTML file with AWK Posted: 03 Sep 2021 09:36 AM PDT using AWK I am trying to fill down a HTML table (rows/columns) based on the previous value. Similar to excel. eg: table user$ csv2html.awk table.csv rowing | fast | good | fast | good swim | | | | slow | | increase | late | golf | red | bad I want this html table to then become the following: table rowing | fast | good rowing | fast | good swim | fast | good swim | fast | slow swim | fast | increase swim | late | increase golf | red | bad The table can have any number of columns/rows and the values can vary across many different words. I am simply trying to understand how to parse the html and then fill down the value that I find in each column/row. Output must be to a new html file that keeps formatting. UPDATE: <html><body><table> <tr> <th>Column1</th> <th>Column2</th> <th>Column3</th> </tr> <tr> <td>rowing</td> <td>fast</td> <td>good</td> </tr> <tr> <td></td> <td>fast</td> <td>good</td> </tr> <tr> <td>swim</td> <td></td> <td></td> </tr> </table></body></html> |
How to use awk to extract just the band name from the output of tageditor? Posted: 03 Sep 2021 07:37 AM PDT I'm trying to organize my Music better m4a, mp3, etc. Since the files are tagged I thought I could make a script to read the file and pull the album and artist info from the file then mv the file in the proper folder. I also wanted to learn some AWK in the process. I started with: for file in *.m4a; do tageditor get artist -f "$file" | awk '/Artist/{ print }' done Output: Artist Periphery Artist Meshuggah, Tomas Haake, Marten Hagström, Fredrik Thordendal, Artist Varials, Bryan Garris Artist Cannibal Corpse Artist Lamb of God Artist Ingested Artist Linkin Park Artist Car Bomb Artist Whitechapel Artist Divine Destruction Artist Ingested, Sean Hynes, Sam Yates, Jason Evans, Lyn Jeffs Then: for file in *.m4a; do tageditor get artist -f "$file" | awk '/Artist/{ print $2 }' done Output: Periphery Angelmaker, Meshuggah, Varials, Cannibal Lamb Ingested Linkin Car Whitechapel Divine Ingested, Since AWK is space-delimited, artists like Lamb of God get chopped off. I also get the , for artists who only go by one name but list the contributing parties. I know I can do it with SED but I wanted to learn some AWK. |
excluding relative paths in duplicity Posted: 03 Sep 2021 07:23 AM PDT The duplicity documentation doesn't appear to fully document its behaviour when relative paths (or bare filenames) are passed to the --exclude option. If I pass the option --exclude foo , for example, will this cause each file or directory named foo in the entire heirarchy under source_directory to be excluded, or will it only exclude a file or directory with that name in source_directory itself? If the latter is the case, is there a way to exclude source_directory/foo without having to type the full path to source_directory for each such option (other than by using a shell variable)? |
How can I emulate a full system in a docker container? Posted: 03 Sep 2021 07:35 AM PDT I want to emulate a reasonably complete Linux system as correctly as possible in a Docker container. Before you ask: I know that in pretty much all cases you shouldn't do this in a container but in a virtual machine. I just happen to have a combination of things that I want to do which makes a container a better solution. A good solution would be to write a Dockerfile that does something like this: - Use a Linux distribution as base image
- Install
tini as init -replacement - Launch
login with CMD - Use a volume for
/etc - ... and so on ...
This works for me (so far) but I have a strong feeling that I'm reinventing the wheel. I assume others also want(ed) to do something similar and that their source is available somewhere. I would rather start from their code (and make some changes so that it fits my needs). Reasons: less work, better stability, more features, possibility to donate back. So, the short version of my question: Can you point me to a git-repo that provides code to build a Docker image that emulates a Linux system as correctly as possible ? Edit: It seems that the description of what exactly my system should be like is unclear. Maybe it's better to read the question as: What is there available that does something similar, in docker, to what I am doing ? Edit 2: Yet another way to rephrase what I want to create: A full-blown VM as docker container |
checkbashisms: what's wrong with `type'? Posted: 03 Sep 2021 09:14 AM PDT #!/bin/sh foo() { echo "in foo" } type foo checkbashisms.pl obviously does not like type , why? $ checkbashisms.pl foo.sh possible bashism in foo.sh line 7(type): type foo Is it not POSIX? But it's supported by all common shells (i.e. bash , zsh , dash , busybox sh , mksh ; even in ksh ; maybe just csh does not support it), should not there be a way how to suppress this warning? |
Bash's read builtin errors on a string-based timeout option specification but not an array-based one. Why? Posted: 03 Sep 2021 09:46 AM PDT In reading through the source to fff to learn more about Bash programming, I saw a timeout option passed to read as an array here: read "${read_flags[@]}" -srn 1 && key "$REPLY" The value of read_flags is set like this: read_flags=(-t 0.05) (The resulting read invocation intended is therefore read -t 0.05 -srn 1 ). I can't quite figure out why a string could not have been used, i.e.: read_flags="-t 0.05" read "$read_flags" -srn 1 && key "$REPLY" This string based approach results in an "invalid timeout specification". Investigating, I came up with a test script parmtest : show() { for i in "$@"; do printf '[%s]' "$i"; done printf '\n' } opt_string="-t 1" opt_array=(-t 1) echo 'Using string-based option...' show string "$opt_string" x y z read "$opt_string" echo echo 'Using array-based option...' show array "${opt_array[@]}" x y z read "${opt_array[@]}" Running this, with bash parmtest ($BASH_VERSION is 5.1.4(1)-release), gives: Using string-based option... [string][-t 1][x][y][z] parmtest: line 11: read: 1: invalid timeout specification Using array-based option... [array][-t][1][x][y][z] (1 second delay...) I can see from the debug output that the value of 1 in the array based approach is separate and without whitespace. I can also see from the error message that there's an extra space before the 1 : read: 1: invalid timeout specification . My suspicions are in that area. The strange thing is that if I use this approach with another command, e.g. date , the problem doesn't exist: show() { for i in "$@"; do printf '[%s]' "$i"; done printf '\n' } opt_string="-d 1" opt_array=(-d 1) echo 'Using string-based option...' show string "$opt_string" x y z date "$opt_string" echo echo 'Using array-based option...' show array "${opt_array[@]}" x y z date "${opt_array[@]}" (The only differences are the opt_string and opt_array now specify -d not -t and I'm calling date not read in each case). When run with bash parmtest this produces: Using string-based option... [string][-d 1][x][y][z] Wed Sep 1 01:00:00 UTC 2021 Using array-based option... [array][-d][1][x][y][z] Wed Sep 1 01:00:00 UTC 2021 No error. I've searched, but in vain, to find an answer to this. Moreover, the author wrote this bit directly in one go and used an array immediately, which makes me wonder. Thank you in advance. Update 03 Sep : Here's the blog post where I've written up what I've learned so far from reading through fff , and I've referenced this question and the great answers in it too: Exploring fff part 1 - main. |
Why I get "Access denied for user \'root\'@\'localhost\' (using password: NO)" after I added .env variables? Posted: 03 Sep 2021 08:01 AM PDT I'm using mariadb with nodejs on centos 8. Whenever I add process.env variables to my mysql.createConnection function I get error Access denied for user \'root\'@\'localhost\' (using password: NO) but it worked before I replaced code like host: localhost with host: process.env.DATABASE_HOST . Code that worked before using .env varaibles : const express = require('express'); const mysql = require("mysql"); const dotenv = require('dotenv'); dotenv.config({ path: './.env'}); const app = express(); const db = mysql.createConnection({ host: 'localhost', user: 'root', password: 'DBPASSWORD', database: 'nodejs-login' }); db.connect( (error) => { if(error) { console.log(error) } else { console.log("MySQL Connected...") } }) app.get("/", (req, res) => { res.send("<h1>Home page</h1>") }); app.listen(3000, () => { console.log("server started on Port 3000"); }) Terminal: server started on Port 3000 MySQL Connected... After adding .env variables: const express = require('express'); const mysql = require("mysql"); const dotenv = require('dotenv'); dotenv.config({ path: './.env'}); const app = express(); const db = mysql.createConnection({ host: process.env.DATABASE_HOST, user: process.env.DATABASE_USER, password: process.env.DATABASE_PASSWORD, database: process.env.DATABASE }); db.connect( (error) => { if(error) { console.log(error) } else { console.log("MySQL Connected...") } }) app.get("/", (req, res) => { res.send("<h1>Home page</h1>") }); app.listen(3000, () => { console.log("server started on Port 3000"); }) Project location on my system and project files: $ pwd /var/www/node $ ls -a . .. app.js .env node_modules package.json package-lock.json .env file content: DATABASE = nodejs-login DATABASE_HOST = localhost DATABASE_USER = root DATABASE_PASSSWORD = "DBPASSWORD" Terminal: server started on Port 3000 { Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password: NO) at Handshake.Sequence._packetToError (/var/www/node/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14) at Handshake.ErrorPacket (/var/www/node/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18) at Protocol._parsePacket (/var/www/node/node_modules/mysql/lib/protocol/Protocol.js:291:23) at Parser._parsePacket (/var/www/node/node_modules/mysql/lib/protocol/Parser.js:433:10) at Parser.write (/var/www/node/node_modules/mysql/lib/protocol/Parser.js:43:10) at Protocol.write (/var/www/node/node_modules/mysql/lib/protocol/Protocol.js:38:16) at Socket.<anonymous> (/var/www/node/node_modules/mysql/lib/Connection.js:88:28) at Socket.<anonymous> (/var/www/node/node_modules/mysql/lib/Connection.js:526:10) at Socket.emit (events.js:198:13) at addChunk (_stream_readable.js:288:12) -------------------- at Protocol._enqueue (/var/www/node/node_modules/mysql/lib/protocol/Protocol.js:144:48) at Protocol.handshake (/var/www/node/node_modules/mysql/lib/protocol/Protocol.js:51:23) at Connection.connect (/var/www/node/node_modules/mysql/lib/Connection.js:116:18) at Object.<anonymous> (/var/www/node/app.js:16:4) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) code: 'ER_ACCESS_DENIED_ERROR', errno: 1045, sqlMessage: 'Access denied for user \'root\'@\'localhost\' (using password: NO)', sqlState: '28000', fatal: true } |
Microphone issues on debian 10 Posted: 03 Sep 2021 08:55 AM PDT I'm trying to set up discord chat with debian 10 installed on macbook pro. there are two input devices listed in discord. Default, and Built-in Audio Analog Stereo. I was using Default, and it worked fine. When I shut the computer down and started it back up the next day, discord says that it can't detect any input from my mic. I just want to use my built-in laptop mic. alsamixer : sudo alsamixer : What should I change? EDIT: Also: why is the "Mic" level empty? |
How to install Netis WF2190 driver on Debian? Posted: 03 Sep 2021 07:08 AM PDT I'm trying to install the driver for Netis WF 2190 usb dongle on Debian but I keep getting an error and I don't know what to do. It's the first time I use linux and I have no idea how to get internet on my machine. I downloaded the script from their site, ran it using sudo sh install.sh but to no avail. This is the error I get I've seen this asked before but the solution found no longer works for me. Can someone guide me what I have to do? I'm currently using my android phone as tethering so I have internet on my pc |
How to add a public key into system keyring for kernel without recompile? Posted: 03 Sep 2021 07:13 AM PDT I want to add a public key from the keypair that I used to sign my kernel module, into system_keyring. However, there's a problem: With the command of cat /proc/keys | grep system_keyring , I've got the entry (ID) of system_keyring. However, when trying to add my public key with this command: keyctl padd asymmetric "" 0xXXXXXXXX</test/signing_key.x509 , I've got `Permission denied" error. I think it is due to the restriction described in the "module_signing.txt" https://01.org/linuxgraphics/gfx-docs/drm/admin-guide/module-signing.html : Note, however, that the kernel will only permit keys to be added to .system_keyring if the new key's X.509 wrapper is validly signed by a key that is already resident in the .system_keyring at the time the key was added. However, I cannot find any document to describe how to sign the "X.509 wrapper" with the key already resident in the .system_keyring. Also, I think the keys in that keyring is only public key. So, I don't even think it will work, even if I can extract the public key out of the keyring and sign the "X.509 wrapper" with that public key. Anyway, need some help here. Or, even if something can give me a hint of how to submit my kernel module to RedHat so that it can be signed by RedHat and installed on user's installation without rebuild the kernel? |
How to mount an NTFS partition writable for a non-root user? Posted: 03 Sep 2021 09:03 AM PDT I am using Debian 8.8 and am using ntfs-3g to mount an NTFS partition in /etc/fstab . Here is my entry: /dev/sdc1 /mnt/data_backup ntfs-3g rw,uid=1000,gid=1000,dmask=0002,fmask=0003 0 0 It is fine for my account userA to read and write the partition. However, my workstation is open to another userB which is not in the root group. Is there any way to make the partition writable for the non-root userB ? And the best result will be that userB can only append but cannot remove the files in the partition. An FTP solution is also acceptable. Thanks! |
Pacman orphan packages Posted: 03 Sep 2021 08:52 AM PDT I was under the impression that "orphaned" packages listed by pacman are packages that have been installed as a dependency but are no longer needed. But looking at the orphaned results I can see packages like Inkscape and ttf fonts which clearly don't fit that description. So now I'm not sure if I should be deleting them or not. Can someone explain what "orphaned" packages are? List of orphaned packages in pamac: Same list from pacman -Qdtq : |
How to uninstall a .deb installed with dpkg? Posted: 03 Sep 2021 09:37 AM PDT I installed Unified Remote using dpkg : dpkg -i urserver.deb How do I uninstall it so I can reinstall from scratch? |
No comments:
Post a Comment