分类 电脑 下的文章

使用 grub4dos 来引导硬盘上的 grml.iso livecd - debian

需求:将 LiveCD grml.iso 保存在 ntfs 分区上,使用 grub4dos 来引导,加载 grml.iso 文件。

本例,硬盘是 MBR 分区,只有一个 NTFS 分区,已经安装有 Windows 22H2。grml.iso 保存在 C:\iso\grml.iso。

尝试:

  1. 先安装 grub4dos, 将 grub4dos ,用 bcdedit 将 grub4dos 添加到启动菜单中
  2. 这里的 C:\menu.lst 文件内容,其中 findiso 参数是让它能在设备中查找iso文件,toram=grml.squashfs 是避免 ntfs-3g 自动将 ntfs 分区挂载为“可读写”,导致重启或关机时会挂死

    title grml
    find --set-root --ignore-floppies --ignore-cd /iso/grml.iso
    map /iso/grml.iso (0xff)
    map --hook
    set opts=" toram=grml.squashfs dns=8.8.8.8 ip=192.168.1.108::192.168.1.1:255.255.255.0:testbox:eth0:off ssh=mima "
    kernel (0xff)/boot/grml/vmlinuz apm=power-off boot=live live-media-path=/live/grml/ bootid=grml001 findiso=/iso/grml.iso  nomce net.ifnames=0 %opts%
    initrd (0xff)/boot/grml/initrd.img
    map --unhook
    boot
    savedefault --wait=2

参考:

testdisk 恢复磁盘分区后无法进入系统 - 1234F: - 错误

现象:一台机子,在 fdisk 里查看,没有分区。尝试使用 testdisk,盲猜是 gpt 分区类型,自动分析出有三个分区。写入、保存磁盘分区信息后,机子无法自动引导到操作系统,提示 1234F:

尝试:估计磁盘的原有分区是 mbr ,并不是 gpt ,因为里边没有 EFI 分区,且原系统中,没有 efi 相关的文件。然后再次运行 testdisk ,将分区信息保存为 mbr 。再次重启机子,依然是 1234F: ,无法引导系统。最后,在急救系统里,grub-install 到磁盘,重新安装 grub 。之后,就可以看到 grub 的引导信息,顺利进入到 debian 系统了。

参考:

在 FreeBSD 13.2 里尝试安装 iRedMail 1.6.8 - 放弃

原因:看到 iRedMail 群里有人说在 FreeBSD 13.2 里安装出错,提示如:

lsof-4.99.3_1,8 requires kernel sources.
error code 1
stop.
make stopped in /usr/ports/sysutils/lsof
error code 1
stop
make stooped to /usr/ports/devel/py-Jinjia2
error failed to downloading package, please fix it manually and then relaunch iRedMail installer.

我在一台国外的机子,配置是 Atom C2750, 8GB 内存里测试 iRedMail 的安装。遇到同样的报错信息。虽然可以手工下载 ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/13.2-RELEASE/src.txz 后继续安装,但通过 ports 编译软件,所需的时间太长了。过了约24小时,还没完成,当前界面信息停留在:

l' -Cprefer-dynamic -Z binary-dep-depinfo -L native=/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage0-rustc/x86_64-unknown-freebsd/release/build/psm-d1aad399e5dbb6f5/out -L native=/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage0-rustc/x86_64-unknown-freebsd/release/build/rustc_llvm-938455d976a8c95f/out -L native=/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/llvm/build/lib`
    Building [=======================> ] 316/323: rustc_driver_impl

但我不想等待结果,放弃了。

-- Build files have been written to: /usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/lld/build
running: cd "/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/lld/build" && DESTDIR="" "cmake" "--build" "." "--target" "install" "--config" "Release" "--" "-j" "1"
[  1% 3/127] Building CXX object Common/CMakeFiles/lldCommon.dir/CommonLinkerContext.cpp.o^C
ninja: build stopped: interrupted by user.

Build completed unsuccessfully in 14:46:49
*** Error code 1
*** Signal 2

参考:

在已有Debian系统的硬盘里安装 FreeBSD 13.2

需求:硬盘原先已经有Windows,debian 12 系统了,现在想在一个分区里再安装个 FreeBSD 13.2。

步骤:

  1. 将机子从rescue系统启动,以qemu虚拟机的方式,从 https://download.freebsd.org/releases/amd64/amd64/ISO-IMAGES/13.2/FreeBSD-13.2-RELEASE-amd64-bootonly.iso 开始往硬盘的第4个分区里安装 FreeBSD
  2. 安装过程中,勾选 sshd ,且在 /etc/rc.conf 里添加静态IP的配置内容,如:

    ifconfig_igb0="inet 144.172.126.97 netmask 255.255.255.0"
    ifconfig_igb1="inet 144.172.126.97 netmask 255.255.255.0"
    defaultrouter="144.172.126.1"
  3. FreeBSD安装结束后,将机子从 Debian 12 系统启动,手工修改 /boot/grub/grub.cfg 启动菜单内容,添加如:

    menuentry "FreeBSD 13.2" {
    insmod ufs2
    set root=(hd0,4)
    kfreebsd /boot/loader
    }
  4. 执行如 grub-reboot 4 && reboot 的命令,就可以单次尝试从grub里引导 FreeBSD 系统了
  5. gpart show 的输出信息:

    root@dr3:~ # gpart show
    =>        63  3907029105  ada0  MBR  (1.8T)
          63        1985        - free -  (993K)
        2048   419430400     1  ntfs  (200G)
    419432448  3221225472     2  linux-data  (1.5T)
     3640657920   104857600     3  ntfs  (50G)
     3745515520   161480704     4  freebsd  [active]  (77G)
     3906996224       32944        - free -  (16M)
    
    =>        0  161480704  ada0s4  BSD  (77G)
          0  153092096       1  freebsd-ufs  (73G)
     153092096    8073216       2  freebsd-swap  (3.8G)
     161165312     315392          - free -  (154M)

参考:

在 debian 12 里安装 request tracker 5

假设:RT5的访问网址是 https://rt.demo.anqun.org ,“售后”队列的收件箱是 support@rt.demo.anqun.org ,搭配 apache 与 mariadb 数据库。

步骤:

  1. hostnamectl set-hostname rt.demo.anqun.org # 设置好主机名
  2. apt update # 更新软件源
  3. apt install mariadb-server # 先安装数据库
  4. systemctl start mariadb # 启动数据库
  5. apt install apache2 rt5-db-mysql rt5-apache2 rt5-fcgi request-tracker5 # 安装RT5,如果提示输入RT的实例名称,我这里是填写了完整的主机名 rt.demo.anqun.org,还会提示设置RT使用的数据库密码和默认用户root的密码
  6. a2dismod mpm_event
  7. a2enmod mpm_prefork # 切换apache的运行模块
  8. a2enmod ssl # 启用https访问
  9. /etc/request-tracker5/RT_SiteConfig.d/50-debconf.pm # 修改配置文件中的 $WebPath 为空,因为本例是访问到/路径
  10. /etc/apache2/sites-enabled/rt.conf # RT的站点设置内容,如下:

    <VirtualHost *:443>
        ### Optional apache logs for RT
        # Ensure that your log rotation scripts know about these files
        # ErrorLog /opt/rt5/var/log/apache2.error
        # TransferLog /opt/rt5/var/log/apache2.access
        # LogLevel debug
        ServerName rt.demo.anqun.org
    
    SSLEngine on
    SSLCertificateFile  /root/.acme.sh/rt.demo.anqun.org_ecc/rt.demo.anqun.org.cer
    SSLCertificateKeyFile /root/.acme.sh/rt.demo.anqun.org_ecc/rt.demo.anqun.org.key
    SSLCertificateChainFile  /root/.acme.sh/rt.demo.anqun.org_ecc/ca.cer
    
        AddDefaultCharset UTF-8
        FcgidInitialEnv RT_SITE_CONFIG /etc/request-tracker5/RT_SiteConfig.pm
    # The defaults are unlikely to be big enough for an RT site handling
    # attachments
        FcgidMaxRequestLen 1073741824
    #        ScriptAlias / /opt/rt5/sbin/rt-server.fcgi/
    # Use the handler
    # Note: If you switch the configuration to be served up from / use a
    # trailing / - ie:
    #   ScriptAlias / /usr/share/request-tracker5/libexec/rt-server.fcgi/
    ScriptAlias / /usr/share/request-tracker5/libexec/rt-server.fcgi/
    
        DocumentRoot "/usr/share/request-tracker5/html"
    
    # Alias "/static" "/usr/share/request-tracker5/static"
    <Location />
    DirectoryIndex index.html
    #            Require all granted
    #            Options +ExecCGI
    #            AddHandler fcgid-script fcgi
    </Location>
    
    # Limit mail gateway access to localhost by default
    <Location /REST/1.0/NoAuth>
    <IfVersion >= 2.3>
        Require local
    </IfVersion>
    <IfVersion < 2.3>
        Order Allow,Deny
        Allow from 127.0.0.1
    </IfVersion>
    </Location>
    </VirtualHost>
  11. systemctl restart apache2 # 重启apache服务后,看看能否访问到RT的web页面。如果root能成功登录,请创建“售后”的队列,且设置收件箱为support。简化测试,让everyone可以有创建和回复工单的权限
  12. dpkg-reconfigure exim4-config # 配置 exim4 ,关键是填写收件箱的域,如 rt.demo.anqun.org 和监听的网络接口(本例是留空,表示在所有的网络接口里监听25端口)
  13. /etc/exim4/conf.d/router/050_exim4-config_rt5support # 创建收件箱地址的router,内容如下:

    rt5support_router:
    driver = accept
    local_parts = support
    transport = rt5support_transport
    
    rt5supportcomment_router:
    driver = accept
    local_parts = support-comment
    transport = rt5supportcomment_transport
  14. /etc/exim4/conf.d/transport/50_exim4-config_rt5support_pipe # 创建收件箱的pipe,内容如下:

    rt5support_transport:
     driver = pipe
     command = "/usr/bin/rt-mailgate --queue 售后 --action correspond --url https://rt.demo.anqun.org"
    
    rt5supportcomment_transport:
     driver = pipe
     command = "/usr/bin/rt-mailgate --queue 售后 --action comment --url https://rt.demo.anqun.org"
  15. update-exim4.conf.template -r && update-exim4.conf && systemctl reload exim4 # 将exim4的配置更新
  16. 如果顺利,发往suuport@rt.demo.anqun.org的邮件,会自动出现在“售后”队列中,从web里可以查看到

参考: