Tuesday, May 31, 2022

Recent Questions - Ask Different

Recent Questions - Ask Different


File Vault decryption paused, switch to external?

Posted: 31 May 2022 05:12 PM PDT

I have an old MacBook Pro that was running super sloooow. I decided to upgrade to an SSD. The original drive was encrypted, so I wanted to decrypt before I cloned the drive. I think that's where I made a mistake. I should have removed the drive and hooked it to my other Mac as an external, but instead I turned off File Vault encryption in the original Mac. It's been 1 week and the decryption is at 8%. I am assuming it's because the old computer is so slow that it is taking this long. Can I shut the computer down, move the drive to an external enclosure, and resume decryption using my other Mac? Will this speed things up? By the way, the drive is HFS Extended Journaled, and both my old machine and new one are running High Sierra. And yes, stupid me, don't have a backup for the old computer data. One last thing, can I use time machine on this partially decrypted drive, then use the backup to create a clone?

Run iOS/iPadOS shortcut every 30 minutes

Posted: 31 May 2022 04:26 PM PDT

I want to create an automation on my apple devices to run a set of tasks every 30 minutes. Currently, there only seems to be an option to run an automation at a certain time of day.

Is there a way to trigger an iOS shortcut automation to run every 30 minutes? The only way I can think of to make this work is to create 48 automations (One for every 30 minutes) and have them run daily, but I think its easy to understand why that is not really a solution.

Thanks in advance

Cannot open imported Keychain files

Posted: 31 May 2022 03:47 PM PDT

I was able recover Keychains folders from corrupted partition and I wanted to add them to test account in order to export needed password. This password was only available locally on that machine. However, when I try to open login.keychain-db, it does not have any effect on Keychain app.

Is there any way to recover it?

Permissions issue with shared folder using SMB. macOS can't open Linux files, but Linux can open macOS files without issue

Posted: 31 May 2022 03:46 PM PDT

I have a shared folder on macOS Catalina (It's just the default Public folder) that can be accessed by an Ubuntu machine. The share is set up using SMB.

If the Linux machine copies over a photo, text file, whatever into the shared folder, the macOS machine cannot open it. I get a permissions error. If the macOS machine does the same, the Linux machine has no problems whatsoever.

I have tried many settings on macOS to no avail including "Apply to enclosed items".

Here's a screenshot of all the sharing settings on macOS so you can see what I have done. Permissions issue

Settings for access to Files & Folders are ignored?

Posted: 31 May 2022 02:22 PM PDT

Recently after updating an app (Watchman's watchman, using Homebrew) is behaving like it no longer has access to Files & Folders, despite the fact that I have given it access in Security settings. In fact, I have several (old?) instances that I've given access:

enter image description here

Is there a reason that an app would behave this way? I'd originally thought it might be an issue with the app itself, but have not seen reports that this is the case, and am now thinking something may be wrong with how I've set up Privacy for the app?

Are there other settings that might be affecting an app's access to Files & Folders? I know I can give the app Full Disk Access, which would also cover Files & Folders, but doing that does not fix the issue.

iPhone performing autoblur on any use of camera

Posted: 31 May 2022 02:13 PM PDT

iPhone is doing autoblur when the person is far away from camera. How to stop autoblur? Went into Apple store, but they could not help. This is happening during video conferencing in several apps.

Homebrew won't install from casks

Posted: 31 May 2022 04:23 PM PDT

I've just wiped & reinstalled my M1 Macbook Pro (Monterey 12.4), and at some point during setup Homebrew has stopped working when installing from cask - the download completes, then nothing. It doesn't even return to the prompt.

For example, if I try to install VLC:

brew install --cask vlc  ==> Auto-updated Homebrew!  Updated 1 tap (homebrew/core).  ==> Updated Formulae  Updated 2 formulae.    ==> Downloading https://download.videolan.org/vlc/3.0.17.3/macosx/vlc-3.0.17.3-arm64.dmg  ######################################################################## 100.0%  

... and then silence.

If I ^C and try again, I get:

brew install --cask vlc  ==> Downloading https://download.videolan.org/vlc/3.0.17.3/macosx/vlc-3.0.17.3-arm64.dmg  Already downloaded: /Users/adam/Library/Caches/Homebrew/downloads/409341b2af745d1aeb51a7bcf0fa728f37a3cb0323b662988fcbd4b2d6c3021c--vlc-3.0.17.3-arm64.dmg  

I assume it's a permissions issue, but I'm not sure where to start.

My Homebrew version:

Homebrew 3.4.11  Homebrew/homebrew-core (git revision ea77abc722f; last commit 2022-05-31)  Homebrew/homebrew-cask (git revision c858075186; last commit 2022-05-31)  

How to add/classify extensions for Spotlight searches?

Posted: 31 May 2022 11:54 AM PDT

When add query something trip kind:image to search by kind in Spotlight, it seems to be just a extension to the extension-type search. If so, how can I add new document types to the the definition of image in this case, so I get those in the results.

Otherwise I would only get the old classic types (bmp, png, svg, icns, gif, etc), some big-name (read: Adobe) proprietary formats (ai, psd ) but not the newer formats that — might I add — have their proper QuickLook plugins registered in the system and, in Finder, behave exactly like others in the category e.g; .afdesign, .pxm (Affinity Designer and Pixelmator, respectively).

How can I modify the [I assume System-]files to expand these definitions? I'm in High Sierra, BTW.

Is there a GUI website copier application compatible with MacOS that also include Javascript elements? [closed]

Posted: 31 May 2022 11:22 AM PDT

I'm looking for website copier software with a GUI (because I'm not experienced with command line and it confuses me), compatible with MacOS, that also includes Javascript elements. The website I want to copy is also password protected and has a specific cookie set. I have the API key.

SiteSucker worked almost perfectly for me besides the fact it doesn't incorporate Javascript. Not looking to create a virtual PC.

Recommended way to install Java with brew (just to run Java apps without a development environment)

Posted: 31 May 2022 12:22 PM PDT

I saw today:

brew install --cask ripme    ==> Caveats  ripme requires Java 8+. You can install the latest version with:    brew install --cask temurin  

There are so many brew packages for Java, I don't have the overview anymore:

brew info temurin  temurin: 18.0.1,10  https://adoptium.net/  Not installed  From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/temurin.rb  ==> Name  Eclipse Temurin Java Development Kit  ==> Description  JDK from the Eclipse Foundation (Adoptium)  ==> Artifacts  OpenJDK18U-jdk_x64_mac_hotspot_18.0.1_10.pkg (Pkg)  ==> Analytics  install: 4,556 (30 days), 14,596 (90 days), 39,378 (365 days)  

Is this the recommend way of installing Java with brew?

At the moment, Java is installed with this package/tap:

brew info adoptopenjdk14  adoptopenjdk14: 14.0.2,12  https://adoptopenjdk.net/  /usr/local/Caskroom/adoptopenjdk14/14.0.2,12 (191.6MB)  From: https://github.com/adoptopenjdk/homebrew-openjdk/blob/HEAD/Casks/adoptopenjdk14.rb  ==> Name  AdoptOpenJDK 14  ==> Description  AdoptOpenJDK OpenJDK (Java) Development Kit  ==> Artifacts  OpenJDK14U-jdk_x64_mac_hotspot_14.0.2_12.pkg (Pkg)  

I don't do any Java dev work, I just use some apps which are Java-based.

M1 MacBook Pro Drops Wifi Periodically

Posted: 31 May 2022 12:44 PM PDT

My 2021 M1 Pro MacBook Pro drops wifi periodically, it does this on all networks I've tried, including at the Apple Store. Sometimes it automatically reconnects, sometimes it doesn't.

Turning off bluetooth significantly reduces the frequency of the problem but doesn't eradicate it. Obviously I'd like a solution where I can have bluetooth on.

How can I diagnose this further?

Here's some other misc notes:

  • I've tried on every macOS apart from 12.4, I'm going to try that now
  • When wifi and bluetooth are both on, they will both drop at the same time. My headphones will lose audio for a second and I see the wifi reconnecting
  • A genius ran a hardware test which said everything was fine
  • iPad and multiple iPhones all fine on my home network
  • M1 MacBook Air is fine on my home network
  • Tried soft and hard reinstalls of macOS
  • Renewed DHCP lease
  • Created a new network location
  • When plugged into wired ethernet the wifi still drops
  • I've tried turning off 2.4g on my home wifi router

Toolbox/Podman Alternative for MacOS

Posted: 31 May 2022 03:05 PM PDT

I primarily develop on Linux and recently bought a Macbook, and am looking to make the development experience familiar to what I am used to. Note that this focuses on work native to the OS, rather than working over SSH which I have no problems with.

One way I used to deal with lack of package support on a Linux distro was to use Toolbox with Arch Linux, and keep development packages in a container.

This is what I would like to do with macOS as well. I have a podman setup on macOS but the Toolbox tool seems very specific to Linux. Is there a somewhat equivalent tool for mac?

I don't need desktop integration, and only need CLI packages and libraries. I am also willing to manually write podman-compose files if no such tool exists.

Bash script or AppleScript to connect & disconnect an Airplay display in Monterey+

Posted: 31 May 2022 04:06 PM PDT

In System Preferences > Displays, bottom left corner is "Add Display". I can choose another (Monterey+) Mac, Apple TV, iPad, possibly other things, to effectively become an additional display for my Mac. It's pretty cool.

I want to automate connecting and disconnecting to one of those. Either AppleScript or bash is fine. I'd really prefer not to use GUI scripting if possible, but if it's the only way I'll take that over no solution.

An anyone say definitively if this is possible, and/or how to do it?

Thanks!

How can I see ALL global shortcuts currently active across Finder + other apps?

Posted: 31 May 2022 11:46 AM PDT

I've just started using Amethyst and would love to be able to use the CTRL+optn+NumPad[0-9] shortcuts, but some of these just don't work and I'm assuming something else already has these shortcuts that are overriding Amethyst's. I've looked in SysPrefs/Keyboard Shortcuts, as well as some of the other apps like Alfred and Keyboard Maestro, but there's nothing with those matching key combinations.

Is there a way to globally retrieve ALL possible keyboard shortcuts that are currently active across the system?

An error occurred while loading the update

Posted: 31 May 2022 11:05 AM PDT

So yesterday I tried to update my iMac 2017 to the Monterey version, but I received this message

"An error occurred while loading the update"

enter image description here

ps: image from internet

enter image description here

Any ideas on how i can fix that without losing my data ?

Can't find standbydelayhigh and standbydelaylow on MacBook Pro 2021

Posted: 31 May 2022 12:56 PM PDT

When, on my MacBook Pro (M1 Pro) Monterey 12.1, I run

sudo pmset -g

I get these current power settings:

System-wide power settings:  Currently in use:   standby              1   Sleep On Power Button 1   SleepServices        0   hibernatefile        /var/vm/sleepimage   powernap             0   networkoversleep     0   disksleep            10   sleep                1 (sleep prevented by powerd)   hibernatemode        3   ttyskeepawake        1   displaysleep         15   tcpkeepalive         0   lowpowermode         0   womp                 0  

Where can I find the current values for standbydelayhigh or standbydelaylow?

MFI certification/ Detecting local wifi networks

Posted: 31 May 2022 05:02 PM PDT

I am re-posting my previous question in regards to enabling our app to detect local wifi networks so that users can connect the product to wifi.

My company is developing an app enabled sound machine. The sound machine similar to many other products today like security cameras, computers, iPhones, even some air purifiers, takes you through a set up process through the app where you can then connect the device to a Wi-Fi network.

Typically of course this Wi-Fi network that you connect to will be the Wi-Fi network in your home, or office, or wherever you will be keeping this product. When you are going through the app and get to the portion where you then connect the product to Wi-Fi all of the Wi-Fi network names in the area will pop up. So for example, if you live in apartment building your Wi-Fi network name will pop up along with maybe three or four of your neighbors.

Now this is the screen we are having a challenge with. You can manually type in your Wi-Fi network name and password and it will connect with no issues. But we are unable to get the app to detect the Wi-Fi network names in the area. This creates a massive inconvenience for users because at that point they have to type in both their WiFi network name and the password manually. They are unable to just click on their Wi-Fi network name then enter the password like other apps.

We have been reaching out to Apple development program but for some reason they have been denying us the ability to do this. We are Wondering if that is because of not having an MFI certification. Or if there is a different implementation that we are not considering.

How to enable hibernation on M1 Mac

Posted: 31 May 2022 12:50 PM PDT

I am trying to enable Windows-like hibernation (powering off the device) on an M1 Mac mini. Current power mode configuration of any Mac can be displayed with pmset -g command, and this command's output does not include a hibernatemode entry. I try to enable hibernation with sudo pmset -a hibernatemode 25 where 25 indicates power-off hibernation. Unfortunately this doesn't power the device off because the power light is still on when I put the device to sleep. Curiously enough, running pmset -g again still does not include a hibernatemode entry.

Is hibernation removed in new M1 Macs or macOS Big Sur? If not, what is the correct way to enable it?

New Macbook Pro 2019 has high temperature with low CPU usage

Posted: 31 May 2022 10:15 AM PDT

I got a Macbook Pro 2019 with Intel Core i9 Processors and it seems to heat up and get the fans spinning even with very low cpu usage.

For Example, today when I was on a video call, Both my fans were spinning quite loud and my CPU Temperature was at 57deg Celcius. When I looked at Activity Monitor, my CPU was 97.44% idle.

Is this a problem with the computer or is this normal?

MacBook Air (13-inch, 2017) [MacOs Catalina 10.15.6] Yellow tint when watching video in Netflix, Youtube or even Videos(Quick Time)

Posted: 31 May 2022 01:07 PM PDT

I noticed recently that when i try watching youtube videos in full screen, when i didn't move my mouse and the play bar disappeared , my screen turn yellowish. This happen only during full screen and only if i connect my MacBook Air with an external monitor via thunderbolt (I connect monitor with HDMI through a converter [HDMItoThunderbolt].

If i unplug the monitor from my MacBook, it becomes normal.

Any solution for this? I reach help from apple support but they seems can't fixed this issue.

zsh can't see and doesn't load the ~/.zshrc startup file

Posted: 31 May 2022 12:00 PM PDT

After upgrading to Catalina and encountering the zsh upgrade reminder when launching Terminal, I've decided to switch to zsh.

The default interactive shell is now zsh.  To update your account to use zsh, please run `chsh -s /bin/zsh`.  For more details, please visit https://support.apple.com/kb/HT208050.  

However, I'm having trouble getting Terminal/zsh to recognize the .zshrc startup file located in my home folder. ~/zshrc isn't loaded on launch, and executing source ~/.zshrc returns source: no such file or directory.

The file only contains one line, an alias tying python to python3.

Finder showing .zshrc presence next to an open TextEdit window of the file Terminal showing the lack of any aliases and the failed source command

macOS/iMac - LG UltraFine controls

Posted: 31 May 2022 10:32 AM PDT

For seemingly no reason, the macOS hotkey to control the brightness (control + F1/F2) of my LG UltraFine secondary display has stopped working.

Also, the Sound Preferences do not show LG UltraFine speakers anymore, so I cannot set the sound output to that display.

When I try to open LG Screen Manager, it quits immediately.

Can anyone else using LG UltraFine (23.7" 4K, specifically) confirm facing this issue? Any suggestions on how to fix this?


This Apple bug/personal oversight has become a nuisance on my home setup. Not only can I not control the display and sound on my UltraFine monitor through the iMac, I am unable to send the sound output from my iPad to the monitor. All this was earlier working without any problem.

When going to Apple > About This Mac > Displays, the UltraFine display shows up, implying that the monitor is being identified. But the sound and brightness controls are not working.

I have tried three different devices, an iMac, an iPad, a MBP. Neither worked, leading me to believe that the issue is with macOS/iPadOS.

Any way to use disassembled MacBook Pro keyboard and trackpad as input to Mac mini?

Posted: 31 May 2022 01:28 PM PDT

I have a mid-2012 MacBook Pro (non-retina) lying around that I don't need. It does not startup, but it's keyboard and mouse work fine. I have no use for the computer anymore.

I also have a Mac mini and I was wondering whether there is any hardware/software that allows me to use the keyboard and trackpad from my MBP as direct input to my Mac mini, just like an external keyboard/trackpad, without having to go through the OS on my MBP.

In other words, I was looking for some sort of adapter that would connect my keyboard and trackpad from my MBP to a USB input which I could use on the Mac mini. I do not want a solution like this: https://apple.stackexchange.com/a/338568

Thanks

How to use youtube-dl --cookies

Posted: 31 May 2022 07:29 PM PDT

How do I use the --cookies option to youtube-dl to download a Youtube video? Can anyone provide a worked example of how to obtain the relevant cookies for Youtube and put it in the appropriate format for youtube-dl?

Context: I want to download a private Youtube video. For various reasons, the method of logging into my Google account is complicated and involves two-factor authentication and not supported by youtube-dl's existing command-line options. Therefore, it seems the best way is to log in manually in my browser, obtain the authentication cookies somehow, and use the --cookies option -- but I can't find a worked example of how to do this.

Why does Finder tell me Pixie is zero bytes in size, but takes up 406 KB?

Posted: 31 May 2022 12:00 PM PDT

Pixie, the additional Xcode app for magnifying pixels of the screen and finding their values, takes up 406 KB of space. Finder, however, says that it's zero bytes in size. In the below screenshot, you see that under Size it says "zero bytes", followed by "406 KB on disk". What does this discrepancy mean?

Get Info for Pixie

I have relaunched Finder, but the problem persists. Pixie is fully functional.

QuickLook doesn’t work with Chat transcript files

Posted: 31 May 2022 10:35 AM PDT

Trying to use QuickLook for Chat transcript files isn't working anymore on my machine.

First it takes >10 seconds to load (for files <20KB) - and then when it does finally load, it's just an icon. I can't actually read the chat.

Anybody else having this experience?

I'm not even quite sure what to try resetting! Deleting the QuickLook plists does not seem to have changed anything.

Add Compose key to OS X

Posted: 31 May 2022 12:40 PM PDT

I want to change one of my keys on my keyboard to a Compose key so I can easily type common accents or characters, e.g.: Compose+e+' -> é.

Is there a setting I can change or a program I can install to add this feature? For instance, I would like to use Caps Lock as Compose.

Do I have to run a disk integrity check after a kernel panic?

Posted: 31 May 2022 03:14 PM PDT

Relatively new to Macs, I'm used to Windows wanting to verify HD data integrity after an unexpected shutdown. I know they use different file systems, but do Macs need to do anything like this?

Restarting sound service?

Posted: 31 May 2022 03:13 PM PDT

My macbook pro running Snow Leopard stopped making sounds a couple hours ago. I've found other reports of people with sounds working through headphones, but that's not the problem I'm seeing. I get no sound when my headphones are plugged in either.

I'm wondering if there's a LaunchAgent or LaunchDaemon to restart which would remedy this. I've already tried killing the coreaudio daemon (and it dutifully automatically restarted) but that didn't fix it.

I need to reboot for an OS update, so I think that'll probably rectify things.

Is there another way?

OSCHINA 社区最新讨论话题

OSCHINA 社区最新讨论话题


高并发更新数据库字段,使用数据库的乐观锁实现,为什么要加version字段,而不是直接用业务字段?

Posted: 31 May 2022 06:29 AM PDT

我在很多文章博客中看到别人对这个问题的解决方案都是加个额外的version字段,而且在业务中还要先查询出来 比如这种代码: int amount = 100; int userId = 1; User user = selectBy("select balance, version from account where user_id = #{userId}", userId); if(user.getBalanc...

Rust 内存泄露?如何修复?

Posted: 31 May 2022 02:11 AM PDT

根据 Rust 的规则,泄漏内存是完全安全的。事实上,我们可以使用函数故意泄漏尽可能多的内存std::mem::forget。 关于内存泄漏的唯一"不安全"的事情是它们最终可能导致你的程序被内核杀死。以可预测方式结束的程序也被认为是安全行为。Rust 的安全保证是为了保护我们免受无效的内存访问,而不是资源匮乏。 Rust语言的优...

这才是,2022年的 API 文档该有的样子!

Posted: 31 May 2022 03:30 AM PDT

前后端差点打起来 事情是这样的:今天我们公司的后端说他接口写完了,并分享了一个接口文档给我。用的就是 Swagger UI 自动生成的那种接口文档,就像这种: 这种 Swagger 文档我每次看着就头大,毛病多多: 查看多级模型时要一级级点开 在接口数量变多的时候非常难用,连分类菜单都没有 提交参数为 JSON 的时候不能格式化...

workbench下如何自定义梁单元截面?

Posted: 31 May 2022 02:15 AM PDT

一是如何读入CAD下截面图形文件,二是如何手工自建截面。 推荐一下这方面的操作手册或指南,谢谢。

服务端开门套接字使用accept方法后产生的连接套接字是为什么能和客户端进行通信?

Posted: 31 May 2022 01:29 AM PDT

举例: 主机A与服务器B进行TCP通信: 1、服务器B绑定端口888 2、主机A对服务器B的888端口发起TCP请求,三握手后,主机A和服务器B建立通信主机A套接字和服务器B的套接字大致如下: 主机A套接字 源地址 192.168.1.2 目的地址 192.168.1.3 源端口 777 目的端口 888 服务器B套接字 源地址 192.168.1.3 目的地址 192.168.1.2 ...

Echarts 折线数据大导致无法渲染

Posted: 30 May 2022 04:54 AM PDT

正常vue +Echarts自定义组件,数据量大约在10万以内,可以正常显示 如图1,由于想看到所有的数据,所以x轴设置滚动,即Echarts的宽度是动态变化的,改动时间范围后图表貌似渲染不出来,鼠标放上去还有显示信息,求解,平台返回的数据是正常的 图2

PROFIBUS从站开发

Posted: 30 May 2022 08:19 PM PDT

大佬们路过看看,开发SCP3从站时遇到问题:程序走完set prm--check cfg 之后诊断报文一直回复static_diag=1,从站未准备好,这是什么原因导致的?(从站用的是ADSP-blackfin536+SPC3) PS:我看的资料都只说明该位为1带来的后果,没有讲为何为1、以及怎么解决它?手册里资料提到这一位的好像只有两个地方:1.failure of su...

如何自建直播服务器

Posted: 30 May 2022 02:20 AM PDT

现在用的腾讯云的直播。老板嫌流量贵,要自己搭建直播服务器。目前从网上搜索结果看,大部分观点是人数较少可以使用开源的软件自己搭建,人数多的情况下建议使用第三方。有做过自建直播服务器的大佬没,给个建议。

使用winsw 将jar 注册成windows 自启动服务后访问win 语音服务报错

Posted: 30 May 2022 10:57 PM PDT

使用winsw 将jar 注册成windows 自启动服务后访问系统自带的文字转语音服务就会报错, 直接使用java -jar XXX.jar 没有问题; 报错内容如下: com.jacob.com.ComFailException: Invoke of: Speak Source: Description: 没有注册类 at com.jacob.com.Dispatch.invokev(Native Method) ~[jacob-1.20.jar!/:na] ...

java的多线程怎么让子线程有异常时自动回滚?

Posted: 30 May 2022 06:48 PM PDT

好像spring的事务注解方式没法在子线程中起作用,查了下网上都用编程式手动代码去控制子线程事务,是否还有其他更简便的方式?

controller中有重载方法,info日志报Generating unique operation named,可以通过配置给消除么

Posted: 30 May 2022 02:31 AM PDT

controller中有重载方法,info日志报Generating unique operation named,可以通过配置给消除么

请问java怎么和python对接,我训练了一个python模型,需要用java传一段文本进去,模型生成结果返回给我

Posted: 29 May 2022 02:57 AM PDT

我训练了一个python模型,需要用java传一段文本进去,模型生成结果返回给我,我在后端,返回给前端

为什么官方代码不能直接编译通过

Posted: 30 May 2022 07:29 PM PDT

编译下载 的Oneos2.1.0代码里面 templates中的mm32f3277g8p-cmcc-oneos代码出现错误 硬件:中国移动万藕启物开发板 软件:Oneos2.1.0

正则表达式:字符串[[Rust]]匹配正则表达式(.*?),却不能匹配[(.*?)]是为什么

Posted: 29 May 2022 01:20 AM PDT

在线正则表达式测试网站:在线正则表达式测试 (oschina.net) 能匹配(.*?),还匹配了9处,明明只有8个字符 不能匹配[(.*?)],究竟是为什么?

@ApiOperationSupport(ignoreParameters = {}) 忽略参数无效

Posted: 30 May 2022 12:17 AM PDT

@ApiOperationSupport(ignoreParameters = {"zldjInvite.id","zldjInvite.createTime","zldjInvite.jobContent"}) 忽略参数无效 knife4j版本 2.0.2-2.0.9 API文档上 该接口 还是会显示id,createTime,jobContent 3个参数...

OneOSCube使用问题

Posted: 29 May 2022 11:17 PM PDT

拿OneOSCube新建了一个STM32F407VE的工程, 工程默认状态直接拿keil编译是不是sh就应该好使?

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


You to know how many sectors to load from in the boot loader

Posted: 31 May 2022 05:08 PM PDT

So I was exploring how boot loaders works and I came across one question that I can't seem to find any answer. How does the boot loader knows exactly how many sectors it has to read to load the whole kernel ?

I'm writing a boot loader and it's a pain in the ass to have to manually change how many sectors to read by calculating the exact amount of sectors. Surely there is a way to automate this process but I don't know how. I heard about filesystems, BPB and BDB and I get confused about all of those things. I truly want to know how the whole process works. Fat12 is a simple filesystem but what happens if the kernel is too big for a floppy disk ?

Any explanation would be welcome.

Only apply neovim rule to one folder

Posted: 31 May 2022 04:51 PM PDT

I have a notes folder that is also a git repo with an autocmd in my init.vim set to auto-commit to the repo every time the file gets saved. This behavior is undesirable in git repo folders with actual code, so I was wondering how to selectively apply the rule to only one folder.

how can i append this command to add the hostname next to the IP Address within python

Posted: 31 May 2022 04:15 PM PDT

how can i append this command to add the hostname next to the IP Address I have the majority of the detail that I want so far,however it would be great if the IP Address was to resolve to its hostname.

***# Import modules  import subprocess  import ipaddress  # Prompt the user to input a network address  net4 = input("Enter a network address in CIDR format(ex.192.168.1.0/24): ")  # Create the network  ip_net = ipaddress.ip_network(net4)  # Get all hosts on that network  all_hosts = list(ip_net.hosts())  # Configure subprocess to hide the console window  info = subprocess.STARTUPINFO()  info.dwFlags |= subprocess.STARTF_USESHOWWINDOW  info.wShowWindow = subprocess.SW_HIDE  # For each IP address in the subnet,   # run the ping command with subprocess.popen interface  for i in range(len(all_hosts)):  output = subprocess.Popen(['ping', '-n', '1', '-w', '500', str(all_hosts[i])],   stdout=subprocess.PIPE, startupinfo=info).communicate()[0]      if "Destination host unreachable" in output.decode('utf-8'):       print(str(all_hosts[i]), "is Offline")   elif "Request timed out" in output.decode('utf-8'):       print(str(all_hosts[i]), "is Offline")   else:       print(str(all_hosts[i]), "is Online")***  

zsh: tab rotates between directories, what key to select and enter one?

Posted: 31 May 2022 03:40 PM PDT

I am trying to complete path within a directory tree. When I press tab at any directory level, completion rotates among all possible directory completions. Is there a way to bind a key to "select" & enter a directory to then hit tab again and complete the files/directories in that folder?

`unexpected end of file` after a while loop

Posted: 31 May 2022 03:44 PM PDT

The entirety of my Openbox autostart file is as follows:

# Compositor  picom &    # Korean input  ibus-daemon -dr &    # Screensaver  xscreensaver -no-splash &    # Wallpaper  while true; do      nitrogen --random --set-auto      sleep 3600  end  

But when I login, it appears as though only picom was run successfully.

Running bash ~/.config/openbox/autostart from a terminal indicates

/home/max/.config/openbox/autostart: line 33: syntax error: unexpected end of file  

so I think something is wrong with my while loop, but what?

Unable to print in Firefox on Debian

Posted: 31 May 2022 04:13 PM PDT

Here is what I have done on my env.:

# Install the driver with the deb file  sudo dpkg -i --force-all brscan4–0.4.10-1.amd64.deb  # Verify that the driver was correctly installed  dpkg -l | grep Brother  # Find all the devices on your network that have the open ports 9100, 515, 631  # The device that has those open ports (and might have the name: (Hon Hai Precision Ind.)) should be your printer/scanner  sudo nmap -p 9100,515,631 192.168.0.0/24  # Setup your printer on your system  brsaneconfig4 -a name=DCP-L2550DW model=DCP-L2550DW ip=192.168.0.0  # Verify that it is set up correctly  brsaneconfig4 -q | grep DCP-L2550DW  

Here is the evidence that the printer is registered properly:

* DCP-L2550DW  [  192.168.0.109]  DCP-L2550DW  

I am able to scan documents with gscan2pdf (printer/scanner). But I am unable to print with Firefox. All I see when I try to print is to export the page into a PDF format.

Is there something I am missing?

More details:

  • uname -r 4.19.0-20-amd64
  • lsb_release -a
     No LSB modules are available.       Distributor ID: Debian       Description:    Debian GNU/Linux 10 (buster)       Release:        10       Codename:       buster  

How to sync fingerprint login across Windows 11 and Linux Mint 20

Posted: 31 May 2022 03:31 PM PDT

I am a novice and I am trying to sync my fingerprints across Windows 11 and Linux Mint on a dual boot Lenovo T480. GitHub suggests an edit to the "/etc/python-validity/dbus-service.yaml" file, which is read only. I have attempted to edit the file with text editor without success. Any suggestions on how to do this?

CONFIG_SOMETHING on vendor/phone_defconfig won't work, have to pass them on `make`

Posted: 31 May 2022 02:52 PM PDT

On https://github.com/MoonBase-Project/MSM-4.19-MiBengal/ I had to do

make CONFIG_HAVE_KVM=y CONFIG_KVM=y CONFIG_KVM_ARM_HOST=y O=out ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- vendor/citrus-perf_defconfig  make CONFIG_HAVE_KVM=y CONFIG_KVM=y CONFIG_KVM_ARM_HOST=y O=out ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- -j$(nproc --all) 2>&1 | tee kernel.log  

because putting

CONFIG_HAVE_KVM=y   CONFIG_KVM=y   CONFIG_KVM_ARM_HOST=y  

on vendor/citrus-perf_defconfig wouldn't work no matter what I tried. The .config generated from it wouldn't have the KVM configs.

Also I tried to print:

$(info ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ KVM)  $(info $$CONFIG_KVM_ARM_HOST is [${CONFIG_KVM_ARM_HOST}])  

but it was empty, except when passed on make

What is happening?

Backup created with rsync takes up more space on external drive than on source

Posted: 31 May 2022 02:24 PM PDT

I am using rsync to make a backup of Ubuntu running on a Raspberry Pi. I exclude all the usual directories whose contents are only created after boot up anyway.

The rsync writes to a backup image that I partition format and loop device mount and that image is written to an attached external USB drive. The data on the USB storage drive takes up a lot more space compared with the space it occupies on the source SD Card .. about 5325MB vs 3881MB.

Trying to Debug
I ran this rsync command to double check if some mysterious extra files were being created on the destination that are not on the source or were the same files getting bigger when they were on the destination compared with them on the source:

sudo rsync -nrlpgoDv --delete --exclude-from='/home/ubuntu/exclude-list.txt' / /mnt/dst_root/

But I don't see any big differences between the source and destination in terms of numbers of files or the size they occupy in source vs destination.

My Question
Why is this? Is it something to do with the Sector size?

Using fdisk -l my source Ubuntu OS has:

Disk /dev/mmcblk0: 29.54 GiB, 31719424000 bytes, 61952000 sectors  Units: sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 512 bytes  I/O size (minimum/optimal): 512 bytes / 512 bytes  Disklabel type: dos  Disk identifier: 0x12345678    Device         Boot  Start      End  Sectors  Size Id Type  /dev/mmcblk0p1 *      2048   526335   524288  256M  c W95 FAT32 (LBA)  /dev/mmcblk0p2      526336 61951966 61425631 29.3G 83 Linux  

I write the backup to an image file on the external storage drive. I partitioned the backup image like this:

echo "label: dos" | sfdisk "${IMGFILE}" > /dev/null      sfdisk "${IMGFILE}" <<EOF > /dev/null  ,256MiB,c  ,+,83  EOF  

I then format the root partition of that backup image file in a script like this:
mkfs.ext4 -q -b 4096 "${LOOP}p2" > /dev/null

Now fdisk on that loop device attached backup image gives:

Disk /dev/loop6: 5.62 GiB, 6035603456 bytes, 11788288 sectors  Units: sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 512 bytes  I/O size (minimum/optimal): 512 bytes / 512 bytes  Disklabel type: dos  Disk identifier: 0x12345678    Device       Boot  Start      End  Sectors  Size Id Type  /dev/loop6p1        2048   526335   524288  256M  c W95 FAT32 (LBA)  /dev/loop6p2      526336 11788287 11261952  5.4G 83 Linux  

fdisk -l on that external storage drive that the backup image is saved to:

Disk /dev/sda: 3.64 TiB, 4000752599040 bytes, 7813969920 sectors  Disk model: My Passport 2627  Units: sectors of 1 * 512 = 512 bytes  Sector size (logical/physical): 512 bytes / 4096 bytes  I/O size (minimum/optimal): 4096 bytes / 4096 bytes  Disklabel type: gpt  Disk identifier: B5B6FD62-945C-466D-7T49-YU5D4RRE7087    Device     Start        End    Sectors  Size Type  /dev/sda1   2048 7813967871 7813965824  3.6T Linux filesystem  

Is the data taking up more space on the USB drive because of differences in Sector Size vs I/O size maybe?

Separately my backup script tries to shrink down the root file system on the backup image using resize2fs (after the file system is unmounted). There are no errors but resize2fs does a really bad job of eliminating the free space in the backed up root file system. It never eliminates all the empty space and sometimes removes no empty space. Maybe this is also related to the sector size?

Update

After some investigation I think the issue might be related to - snap. It is installed in my Ubuntu system. From reading it looks like snap applications are stored in compressed squashfs file systems. Maybe when I rsync those they take up more space in the destination ext4 file system?

Any advice much appreciated!

Unable to play videos in browsers on Fedora 35

Posted: 31 May 2022 02:09 PM PDT

I upgraded from Fedora 32 to Fedora 35 in last December. Lately I have found out that I am unable to play any videos on web browsers. The video loads but never starts. It's stuck at 00:00. If I move the video forward on the slider, the video skips to the correct frame, but still just sticks there. I get the message "If playback doesn't begin shortly, try restarting you device." in the browser. This happens at least on Firefox, Chrome and Midori.

Rebooting the system makes the problem go away, but it comes back shortly afterwards.

Playing locally stored MP4 files from my own filesystem on VLC is working OK.

What could be the reason for this?

When using fedy to install pulseaudio-module-bluetooth-freeworld-1.4-8.fc35.x86_64 this error shows up: Error: Problem: problem with installed package pulseaudio-module-bluetooth-freeworld-1.4-8.fc35.x86_64 - package pulseaudio-module-bluetooth-freeworld-1.4-8.fc35.x86_64 conflicts with pulseaudio-module-bluetooth < 15.0-100 provided by pipewire-pulseaudio-0.3.38-1.fc35.x86_64. I tried "sudo dnf remove pulseaudio" but it told me that this would also remove gnome-shells. How would I go about resolving the conflict?

How do you prevent uas and usb_storage kernel modules from being automatically loaded when a USB flash drive is connected?

Posted: 31 May 2022 02:08 PM PDT

I generate a kernel Image using buildroot that I put onto an SD card to boot from. In buildroot I modularized USB Mass Storage. When I boot up my board without a USB connected to it I can see that no modules are running by using lsmos. But the instant I plug my USB in, the modules uas and usb_storage automatically load and allow access to the USB. I want to prevent this and only allow access to the USB if I manually load in those two modules.

I have read a few articles online about blacklisting the modules or editing files related to the modules; however, this doesn't work because any changes I make are erased when I power off. So I need another option that is permanent, perhaps done in the buildroot settings prior to generating the Image?

High IO load by [md0_raid1]

Posted: 31 May 2022 05:07 PM PDT

I'm experiencing a 99% IO load caused by [md0_raid1] process every 20-30 seconds. That 99% IO is very short-term, about 1-2 seconds, but it causes lag for other processes due to io wait (it's very harmful for gaming server). Is this normal behaviour? How can I avoid these high IO lags? I would be grateful for any advice.

I have SW RAID 1 (Ext4) on new Linux Debian 9.3 server, I run apache/mysql webserver and several Minecraft servers.

iotop:

Total DISK READ :       0.00 B/s | Total DISK WRITE :      15.30 K/s  Actual DISK READ:       0.00 B/s | Actual DISK WRITE:        0.0 B/s    TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND    199 be/4 root        0.00 B/s    0.00 B/s  0.00 % 99.99 % [md0_raid1]  45302 be/4 root        0.00 B/s    3.82 K/s  0.00 %  0.00 % java -Xms~spigot.jar  51303 be/4 root        0.00 B/s    3.82 K/s  0.00 %  0.00 % java -Xms~spigot.jar  51306 be/4 root        0.00 B/s    3.82 K/s  0.00 %  0.00 % java -Xms~spigot.jar  51200 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % java -Xmx~ee-private      1 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % init      2 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kthreadd]      3 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/0]      5 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kworker/0:0H]  

mdstat:

md1 : active raid1 sda5[0] sdb5[1]      33501184 blocks super 1.2 [2/2] [UU]    md0 : active raid1 sda1[0] sdb1[1]      943111168 blocks super 1.2 [2/2] [UU]      bitmap: 5/8 pages [20KB], 65536KB chunk  

HW specs:

Intel Xeon 1231v3 (3.4 Ghz) 4C/8T 8MB  32 GB DDR3 ECC 1600 MHz  2x SATA 6G 1TB 7.2k (SW RAID 1)  

lspci specs:

https://gist.github.com/FreeWall/98f4bc8029387dbe4d47feacdd37aa85

How to remove newline character within a column in a tsv file?

Posted: 31 May 2022 02:58 PM PDT

enter image description here

I need "This contains newline" in one row, newline from the column2 and column4 need to remove.

nb: For your understanding the data I upload an image if you want I will upload the text content

"column1"   "column2"          "column3"    "column4"           " column5"  "DATA"       "THIS                 "DATA"   "THIS                "DATA"               CONTAIN NEWLINE"                 CONTAIN NEWLINE"    I need to remove the newline and output looks like:  "column1"   "column2"                "column3"  "column4"                " column5"  "DATA"      "THIS CONTAIN NEWLINE"    "DATA"    "THIS CONTAIN NEWLINE"     "DATA"  

User's incrontab not working (only root's) when incrond is run as a service

Posted: 31 May 2022 03:03 PM PDT

Here is my incrontab (tony's incrontab):

/home/tony/Workspace/cocoonr/ui/static/ui/img/icons/vector IN_MODIFY,IN_CREATE,IN_MOVED_TO /bin/sh /home/tony/Workspace/cocoonr/boilerplate/svg2djangohtml $@/$# /home/tony/Workspace/cocoonr/ui/templates/inc/icons/  

I tested it multiple times changing some things, no way to make it work when incrond is run as a service (using openrc).

If I run incrond in foreground (incrond -n), then tony's incrontab works

If I set root's incrontab to the one given above, it works even when run as a service.

My tony is in /etc/incron.allow:

root  tony  

And there is no /etc/incron.deny.

I even tried with a much simpler incrontab:

/tmp/foo IN_ATTRIB touch /tmp/bar  

The results are the same.

How to make user's incrontab working?

/sbin/init does not exist - Bailing out, you are on your own. Good luck

Posted: 31 May 2022 03:24 PM PDT

I'm trying to install arch linux. When I boot up, it gives me the message found below.

ERROR: Root device mounted successfully, but /sbin/init does not exist.  Bailing out, you are on your own now. Good luck.    sh: can't access tty: job control turned off  [rootfs /]# _  

Linux Mint 14.1 with Cinnamon - Mouse Sensitivity not Working

Posted: 31 May 2022 04:05 PM PDT

64-bit if that matters. My mouse sensitivity slider does nothing, but my acceleration slider works. I'd like acceleration off and sensitivity how I like it, but it refuses to work. I have tested the option on two computers, and both do not change the sensitivity. Any help?