@pec ssh中不能打开图像窗口。除非ssh的时候加上 -X
ROS Group 产品服务
Product Service 开源代码库
Github 官网
Official website 技术交流
Technological exchanges 激光雷达
LIDAR ROS教程
ROS Tourials 深度学习
Deep Learning 机器视觉
Computer Vision
weijiz 发布的帖子
-
RE: 使用xiaoqiang_track进行人体跟随和追踪
@huapiaoxiang21 支持现在应该只支持python3, https://git.bwbot.org/publish/body_pose
-
netplan导致systemd-networkd-wait-online.service卡住的问题
如果用netplan控制网络设备,同时把设备设置成固定ip。如果对应的设备不存在,那么在系统启动后
systemd-networkd-wait-online.service
就会卡住几分钟,导致后续的服务无法执行。比如下面的网络设置
network: version: 2 ethernets: enx00e04c680c9b: dhcp4: false addresses: - 192.168.198.1/24 routes: - to: default via: 192.168.198.1 metric: 200 enx344b50000000: dhcp4: true dhcp4-overrides: route-metric: 90
这样即使
enx00e04c680c9b
这个网络设备不存在或者enx00e04c680c9b
网口上没有插网线systemd-networkd-wait-online.service
这个服务也还是会卡住。这是因为netplan默认的后台用的是systemd-network。按照这样设置之后系统图形界面中也是看不到被控制的网卡的。同时由于网络同时受两个后端控制,还可能导致dns错误等问题。我们可以让netplan也使用NetworkManager作为后端来解决这个问题。只需要在配置中增加
renderer: NetworkManager
最后配置如下
network: version: 2 renderer: NetworkManager ethernets: enx00e04c680c9b: dhcp4: false addresses: - 192.168.198.1/24 routes: - to: default via: 192.168.198.1 metric: 200 enx344b50000000: dhcp4: true dhcp4-overrides: route-metric: 90
这样就不会存在卡住的问题。同时网卡也可以在系统网络设置界面中看到。
-
linux 优化启动速度
https://wiki.archlinux.org/title/Improving_performance/Boot_process
Improving the boot performance of a system can provide reduced boot wait times and serves as a means to learn more about how certain system files and scripts interact with one another. This article attempts to aggregate methods on how to improve the boot performance of an Arch Linux system.
1 Analyzing the boot process
1.1 Using systemd-analyze
systemd provides a tool called systemd-analyze that can be used to show timing details about the boot process, including an svg plot showing units waiting for their dependencies. You can see which unit files are causing your boot process to slow down. You can then optimize your system accordingly.
To see how much time was spent in kernelspace and userspace on boot, simply use:
$ systemd-analyze
Tip: If you boot via UEFI and use a boot loader which implements systemd’s Boot Loader Interface (which currently systemd-boot and GRUB do), systemd-analyze can additionally show you how much time was spent in the EFI firmware and the boot loader itself.
To list the started unit files, sorted by the time each of them took to start up:
$ systemd-analyze blame
At some points of the boot process, things can not proceed until a given unit succeeds. To see which units find themselves at these critical points in the startup chain, do:
$ systemd-analyze critical-chain
You can also create an SVG file which describes your boot process graphically, similar to Bootchart:
$ systemd-analyze plot > plot.svg
See systemd-analyze(1) for details.
1.2 Using bootchart2
You could also use Bootchart2 to visualize the boot sequence.
2 Using systemd instead of busybox on early init
By default, the Mkinitcpio configuration uses the base and udev hooks for building the initramfs. Faster boot times can be achieved by replacing them with systemd.
See Mkinitcpio#Common hooks for more details. See also Fsck#Boot time checking if replacing the fsck hook.
3 Compiling a custom kernel
Compiling a custom kernel can reduce boot time and memory usage. Though with the standardization of the 64-bit architecture and the modular nature of the Linux kernel, these benefits may not be as great as expected. See Kernel#Compilation for more info.
4 Initramfs
In a similar approach to #Compiling a custom kernel, the initramfs can be slimmed down. A simple way is to include the mkinitcpio autodetect hook. If you want to go further than that, see Minimal initramfs.
Depending on your hardware (processor and storage speed), using lz4 instead of the default zstd compression option may be quicker since the faster decompression speed at boot time usually offsets the slightly larger size of the initramfs that has to be read from disk. See Mkinitcpio#COMPRESSION.
5 Choose the adequate way to start for services
One central feature of systemd is D-Bus and socket activation. This feature should be preferred for most cases as it causes services to be started only when they are first accessed and is generally a good thing (e.g. having cups.service enabled at boot time is usually not useful for desktop use, enable instead cups.socket which will only start the service when actually printing).
However, if you know that a service (like upower) will always be started during boot, then the overall boot time might be reduced by starting it as early as possible. This can be achieved (if the service file is set up for it, which in most cases it is) by enabling upower.service.
This will cause systemd to start UPower as soon as possible, without causing races with the socket or D-Bus activation.
6 Staggered spin-up
Some hardware implements staggered spin-up, which causes the OS to probe ATA interfaces serially, which can spin up the drives one-by-one and reduce the peak power usage. This slows down the boot speed, and on most consumer hardware provides no benefits at all since the drives will already spin-up immediately when the power is turned on. To check if SSS is being used:
# dmesg | grep SSS
If it was not used during boot, there will be no output.
To disable it, add the libahci.ignore_sss=1 kernel parameter.
7. Filesystem mounts
Thanks to mkinitcpio’s fsck hook, you can avoid a possibly costly remount of the root partition by changing ro to rw on the kernel line: options can be set with rootflags=rw,other_mount_options. The entry must be removed from the /etc/fstab file, otherwise the systemd-remount-fs.service will continue to try applying these settings. Alternatively, one could try to mask that unit.
If Btrfs is in use for the root filesystem, there is no need for a fsck on every boot like other filesystems. If this is the case, mkinitcpio’s fsck hook can be removed. You may also want to mask the systemd-fsck-root.service, or tell it not to fsck the root filesystem from the kernel command line using fsck.mode=skip. Without mkinitcpio’s fsck hook, systemd will still fsck any relevant filesystems with the systemd-fsck@.service
You can also remove API filesystems from /etc/fstab, as systemd will mount them itself (see pacman -Ql systemd | grep ‘.mount$’ for a list). It is not uncommon for users to have a /tmp entry carried over from sysvinit, but you may have noticed from the command above that systemd already takes care of this. Ergo, it may be safely removed.
Other filesystems, like /home or EFI system partition, can be mounted with custom mount units. Adding noauto,x-systemd.automount to mount options will buffer all access to that partition, and will fsck and mount it on first access, reducing the number of filesystems it must fsck/mount during the boot process.
Note:
This will make your /home filesystem type autofs, which is ignored by mlocate by default. The speedup of automounting /home may not be more than a second or two, depending on your system, so this trick may not be worth it.
If the system is installed into a btrfs subvolume (specifically: the root directory / itself is a subvolume) and /home is a separate file system, you may also want to prevent the creation of a /home subvolume. Mask the home.conf tmpfile: ln -s /dev/null /etc/tmpfiles.d/home.conf.
8. Less output during boot
For some systems, particularly those with an SSD, the slow performance of the TTY is actually a bottleneck, and so less output means faster booting. See the Silent boot article for suggestions.
9. Changing boot loader
Changing your boot loader (e.g. a simpler boot loader such as systemd-boot) may reduce boot time by seconds.
If your setup allows it, try using only EFISTUB for even shorter boot times.
10. Suspend to RAM
The best way to reduce boot time is not booting at all. Consider suspending your system to RAM instead.
-
RE: solve raspbian SD card corruption issues with read-only mounted root partition
@weijiz 注意在orangepi5中我们改了/sbin/init文件,这个是挂载的入口
-
RE: 自动充电测试xiaoqiang_local.launch失败
@yao 用检测工具时是否点击使能充电。还有一个可能是充电器如果是脉冲式充电,电流也可能会很小。可以在参数里面设置current_bias把电流偏置提高试试
-
RE: 自动充电测试xiaoqiang_local.launch失败
@yao 你的摄像头tf又没了。没有摄像头tf机器人不能知道二维码相对于机器人的位置。搜索一下论坛很多人都有你这个问题。参考一下别人的设置
-
RE: 自动充电测试xiaoqiang_local.launch失败
@yao 那个是reconfigure节点自动退出,这个节点是设置参数的,设置完就自动退出。这是正常现象。launch也不是卡住,launch正常运行时就是这样的输出。
-
requests session 无法设置cookie
python的网络请求库requests有session的功能,可以对cookie自动处理。但是在使用中发现,post请求,服务器在响应中设置cookie是不会生效的。只有先GET再POST才会生效。感觉可能是requests的session只会在GET请求的时候才会设置cookie
-
Shrinking images on Linux
Shrinking images on Linux
by FrozenCow
Friday February 21, 2013When creating images from existing ISOs you often need to allocate a number of MB for the image to at least fit the files that are in the ISO. Predicting the exact size of the image is hard, even for a program. In this case you will create an image that is larger than actually needed: the image is much larger than the files on the image are combined.
This post will show how to shrink an existing image to a more optimal size. We will do this on Linux, since all required tools are available there: GParted, fdisk and truncate.
RequirementsA Linux PC Some knowledge how the terminal works will helps The unoptimal image (myimage.img in this example)
Creating loopback device
GParted is a great application that can handle partition tables and filesystems quite well. In this tutorial we will use GParted to shrink the filesystem (and its accompaning partition in the partition table).
GParted operates on devices, not simple files like images. This is why we first need to create a device for the image. We do this using the loopback-functionality of Linux.
First we will enable loopback if it wasn’t already enabled:
$ sudo modprobe loop
Now we can request a new (free) loopback device:
$ sudo losetup -f
This will return the path to a free loopback device. In this example this is /dev/loop0.
Next we create a device of the image:
$ sudo losetup /dev/loop0 myimage.img
Now we have a device /dev/loop0 that represents myimage.img. We want to access the partitions that are on the image, so we need to ask the kernel to load those too:
$ sudo partprobe /dev/loop0
This should give us the device /dev/loop0p1, which represents the first partition in myimage.img. We do not need this device directly, but GParted requires it.
Resize partition using GPartedNext we can load the device using GParted:
$ sudo gparted /dev/loop0
This should show a window similar to the following:
Now notice a few things:
There is one partition. The partition allocates the entire disk/device/image. The partition is filled partly.
We want to resize this partition so that is fits it content, but not more than that.
Select the partition and click Resize/Move. A window similar to the following will popup:
Drag the right bar to the left as much as possible.
Note that sometimes GParted will need a few MB extra to place some filesystem-related data. You can press the up-arrow at the New size-box a few times to do so. For example, I pressed it 10 times (=10MiB) for FAT32 to work. For NTFS you might not need to at all.
Finally press Resize/Move. You will return to the GParted window. This time it will look similar to the following:
Notice that there is a part of the disk unallocated. This part of the disk will not be used by the partition, so we can shave this part off of the image later. GParted is a tool for disks, so it doesn’t shrink images, only partitions, we have to do the shrinking of the image ourselves.
Press Apply in GParted. It will now move files and finally shrink the partition, so it can take a minute or two, most of the time it finishes quickly. Afterwards close GParted.
Now we don’t need the loopback-device anymore, so unload it:
$ sudo losetup -d /dev/loop0
Shaving the image
Now that we have all the important data at the beginning of the image it is time to shave of that unallocated part. We will first need to know where our partition ends and where the unallocated part begins. We do this using fdisk:
$ fdisk -l myimage.img
Here we will see an output similar to the following:
Disk myimage.img: 6144 MB, 6144000000 bytes, 12000000 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
Disk identifier: 0x000ea37dDevice Boot Start End Blocks Id System
myimage.img1 2048 9181183 4589568 b W95 FAT32
Note two things in the output:
The partition ends on block 9181183 (shown under End) The block-size is 512 bytes (shown as sectors of 1 * 512)
We will use these numbers in the rest of the example. The block-size (512) is often the same, but the ending block (9181183) will differ for you. The numbers mean that the parition ends on byte 9181183512 of the file. After that byte comes the unallocated-part. Only the first 9181183512 bytes will be useful for our image.
Next we shrink the image-file to a size that can just contain the partition. For this we will use the truncate command (thanks uggla!). With the truncate command need to supply the size of the file in bytes. The last block was 9181183 and block-numbers start at 0. That means we need (9181183+1)*512 bytes. This is important, else the partition will not fit the image. So now we use truncate with the calculations:
$ truncate --size=$[(9181183+1)*512] myimage.img
Now copy the new image over to your phone, where it should act exactly the same as the old/big image.
-
solve raspbian SD card corruption issues with read-only mounted root partition
Raspbian, the default debian-based distribution that runs on most Raspberry PI’s has one significant issue, when the Rpi is used as a headless system which will just be unplugged rather than shut down regularily: It runs ext4 as its root filesystem. Ext4 has a journal which can be easily corrupted when power is lost during a write operation and it is not particularly friendly to or optimized for flash devices.
I have therefore written a small init-script which can be run before the actual init is launched, which will mount the root filesystem read-only and then mount a temporary filesystem residing in ram on top of it using overlayfs. with this setup, all applications can simply read and write to their directories within the root file system but all changes are simply going to the ram, nothing is written to the disk. This means, that there will be no write operations on the SD card anymore and therefore it should last much longer. Of course this also means, that all changes that are made between reboots are lost once the raspberry is either rebooted or the power is cut. In headless environments this is often the desired scenario, when the raspberry pi is simply there to fulfill a simple task and no data needs to be preserved.
If on the other hand, data should be stored (say you want to build an appliance that logs data), you can simply creat an additional partition on the sd card or use an external usb stick or similar and mount this read-writeable as you would normally do through fstab. my script will only mess with the root partition, all ohter mounts are not affected by it.
if you need a writeable partition, consider using f2fs on it, which is optimized for flash memory and should be more robust on a power loss than ext4.
Installationdownload the script below and copy it to /sbin/overlayRoot.sh make it executable sudo chmod +x /sbin/overlayRoot.sh disable swap: sudo dphys-swapfile swapoff sudo dphys-swapfile uninstall sudo update-rc.d dphys-swapfile remove after you have set up and configured your raspberry pi the way you want it, simply activate the overlayRoot script as alternate init script by adding this entry to the end of your cmdline.txt file in the boot partition of the raspbian sd card: init=/sbin/overlayRoot.sh then reboot to make changes, simply remove the entry above and reboot and your raspberry is writeable again. then re-enable and reboot for it to be readonly again.
The Script
overlayRoot.sh
#!/bin/sh # Read-only Root-FS for Raspian using overlayfs # Version 1.1 # # Version History: # 1.0: initial release # 1.1: adopted new fstab style with PARTUUID. the script will now look for a /dev/xyz definiton first # (old raspbian), if that is not found, it will look for a partition with LABEL=rootfs, if that # is not found it look for a PARTUUID string in fstab for / and convert that to a device name # using the blkid command. # # Created 2017 by Pascal Suter @ DALCO AG, Switzerland to work on Raspian as custom init script # (raspbian does not use an initramfs on boot) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see # <http://www.gnu.org/licenses/>. # # # Tested with Raspbian mini, 2018-10-09 # # This script will mount the root filesystem read-only and overlay it with a temporary tempfs # which is read-write mounted. This is done using the overlayFS which is part of the linux kernel # since version 3.18. # when this script is in use, all changes made to anywhere in the root filesystem mount will be lost # upon reboot of the system. The SD card will only be accessed as read-only drive, which significantly # helps to prolong its life and prevent filesystem coruption in environments where the system is usually # not shut down properly # # Install: # copy this script to /sbin/overlayRoot.sh, make it executable and add "init=/sbin/overlayRoot.sh" to the # cmdline.txt file in the raspbian image's boot partition. # I strongly recommend to disable swapping before using this. it will work with swap but that just does # not make sens as the swap file will be stored in the tempfs which again resides in the ram. # run these commands on the booted raspberry pi BEFORE you set the init=/sbin/overlayRoot.sh boot option: # sudo dphys-swapfile swapoff # sudo dphys-swapfile uninstall # sudo update-rc.d dphys-swapfile remove # # To install software, run upgrades and do other changes to the raspberry setup, simply remove the init= # entry from the cmdline.txt file and reboot, make the changes, add the init= entry and reboot once more. fail(){ echo -e "$1" /bin/bash } # load module modprobe overlay if [ $? -ne 0 ]; then fail "ERROR: missing overlay kernel module" fi # mount /proc mount -t proc proc /proc if [ $? -ne 0 ]; then fail "ERROR: could not mount proc" fi # create a writable fs to then create our mountpoints mount -t tmpfs inittemp /mnt if [ $? -ne 0 ]; then fail "ERROR: could not create a temporary filesystem to mount the base filesystems for overlayfs" fi mkdir /mnt/lower mkdir /mnt/rw mount -t tmpfs root-rw /mnt/rw if [ $? -ne 0 ]; then fail "ERROR: could not create tempfs for upper filesystem" fi mkdir /mnt/rw/upper mkdir /mnt/rw/work mkdir /mnt/newroot # mount root filesystem readonly rootDev=`awk '$2 == "/" {print $1}' /etc/fstab` rootMountOpt=`awk '$2 == "/" {print $4}' /etc/fstab` rootFsType=`awk '$2 == "/" {print $3}' /etc/fstab` echo "check if we can locate the root device based on fstab" blkid $rootDev if [ $? -gt 0 ]; then echo "no success, try if a filesystem with label 'rootfs' is avaialble" rootDevFstab=$rootDev rootDev=`blkid -L "rootfs"` if [ $? -gt 0 ]; then echo "no luck either, try to further parse fstab's root device definition" echo "try if fstab contains a PARTUUID definition" echo "$rootDevFstab" | grep 'PARTUUID=\(.*\)-\([0-9]\{2\}\)' if [ $? -gt 0 ]; then fail "could not find a root filesystem device in fstab. Make sure that fstab contains a device definition or a PARTUUID entry for / or that the root filesystem has a label 'rootfs' assigned to it" fi device="" partition="" eval `echo "$rootDevFstab" | sed -e 's/PARTUUID=\(.*\)-\([0-9]\{2\}\)/device=\1;partition=\2/'` rootDev=`blkid -t "PTUUID=$device" | awk -F : '{print $1}'`p$(($partition)) blkid $rootDev if [ $? -gt 0 ]; then fail "The PARTUUID entry in fstab could not be converted into a valid device name. Make sure that fstab contains a device definition or a PARTUUID entry for / or that the root filesystem has a label 'rootfs' assigned to it" fi fi fi mount -t ${rootFsType} -o ${rootMountOpt},ro ${rootDev} /mnt/lower if [ $? -ne 0 ]; then fail "ERROR: could not ro-mount original root partition" fi mount -t overlay -o lowerdir=/mnt/lower,upperdir=/mnt/rw/upper,workdir=/mnt/rw/work overlayfs-root /mnt/newroot if [ $? -ne 0 ]; then fail "ERROR: could not mount overlayFS" fi # create mountpoints inside the new root filesystem-overlay mkdir /mnt/newroot/ro mkdir /mnt/newroot/rw # remove root mount from fstab (this is already a non-permanent modification) grep -v "$rootDev" /mnt/lower/etc/fstab > /mnt/newroot/etc/fstab echo "#the original root mount has been removed by overlayRoot.sh" >> /mnt/newroot/etc/fstab echo "#this is only a temporary modification, the original fstab" >> /mnt/newroot/etc/fstab echo "#stored on the disk can be found in /ro/etc/fstab" >> /mnt/newroot/etc/fstab # change to the new overlay root cd /mnt/newroot pivot_root . mnt exec chroot . sh -c "$(cat <<END # move ro and rw mounts to the new root mount --move /mnt/mnt/lower/ /ro if [ $? -ne 0 ]; then echo "ERROR: could not move ro-root into newroot" /bin/bash fi mount --move /mnt/mnt/rw /rw if [ $? -ne 0 ]; then echo "ERROR: could not move tempfs rw mount into newroot" /bin/bash fi # unmount unneeded mounts so we can unmout the old readonly root umount /mnt/mnt umount /mnt/proc umount /mnt/dev umount /mnt # continue with regular init exec /sbin/init END )"
-
如何禁止xbox手柄控制win10的uwp应用
默认xbox手柄在win10上是可以控制UWP应用的。这个功能有时候会非常讨厌。关键windows没哟提供任何能够关闭这个功能的地方。
虽然不能关闭这个功能但是我们可以用xjoyoff直接把xbox摇杆操作映射成鼠标操作。这样手柄就不能控制app,而是控制鼠标了。